Solved

GENERATING PAIR OF WORDS

Posted on 2003-10-24
7
237 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
  • 3
  • 2
  • 2
7 Comments
 
LVL 100

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 60 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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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 100

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Interbase BDE 4 463
audio record to file 4 1,130
Getting the Real Line Count in FireMonkey 3's TMemo Component 8 1,629
my delphi exe application have  problem with windows explorer ! 12 90
Arrow Electronics was searching for a KVM  (Keyboard/Video/Mouse) switch that could display on one single monitor the current status of all units being tested on the rack.
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

756 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