?
Solved

GENERATING PAIR OF WORDS

Posted on 2003-10-24
7
Medium Priority
?
240 Views
Last Modified: 2010-04-16
Dear Friends,


This question I address for Pascal or Delphi programmers.

I would need your help to build a script which will generate a set of pair of all words found in a File putting the list/results of pair of words in another File.

For example:

Source
<FileA>This title will become a featured solution after answer




Results:
<FileB>
This title
title will
will become
become a
a featured
featured solution
solution after
after answer



Hesitate not in contact me for further details.

The points may be increased!

Thank you in advance.


dict
0
Comment
Question by:dict
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
7 Comments
 
LVL 101

Expert Comment

by:mlmcc
ID: 9614022
Do you mean as written or in your example is This will a good pair?

mlmcc
0
 
LVL 2

Accepted Solution

by:
MrT-RSI earned 180 total points
ID: 9615232
SpaceIndex := 0;
PrevSpaceIndex := 0;
PrevPrevSpaceIndex := 0;

for Index := 1 to Length(S) do begin {S = your input string}
  if S[Index] = ' ' then begin
    PrevPrevSpaceIndex := PrevSpaceIndex;
    PrevSpaceIndex := SpaceIndex;
    SpaceIndex := Index;
    if PrevPrevSpaceIndex <> PrevSpaceIndex then begin
      Z := Copy(S,PrevPrevSpaceIndex + 1,SpaceIndex - PrevPrevSpaceIndex - 1); {= your output string}
    end;
  end;
end;

Something like this ?

- Rob
0
 

Author Comment

by:dict
ID: 9615970
Yes, more or less in this way.

dict.
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:dict
ID: 9634343
Dear MrT-RSI,

I Tested your program in Delphi 5 and BP 7.0

There are two problems in BP.

It not show the last word, for example:

´ I will go to cinema´

 it divides in this way:

I will
will go
go to

So, it shown not the word "cinema"

I added other feature for your program, reading the text from files, then it omit the first and the last word from each line:

For example

I will go to cinema

it shown:

will go
go to

It shown not ´I´ and ´cinema´
 
Please, I would need your helpful to do works fine this program!

Thank you.

dict.
0
 
LVL 2

Expert Comment

by:MrT-RSI
ID: 9635356
come on - be creative !
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 9638869
Seeing as this is probably homework maybe we should let him solve his own problem

mlmcc
0
 
LVL 2

Expert Comment

by:MrT-RSI
ID: 9643698
my idea !
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Active Directory can easily get cluttered with unused service, user and computer accounts. In this article, I will show you the way I like to implement ADCleanup..
Ready to get certified? Check out some courses that help you prepare for third-party exams.
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses
Course of the Month7 days, 21 hours left to enroll

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question