Solved

GENERATING PAIR OF WORDS

Posted on 2003-10-24
7
235 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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

SEO can be a real minefield to navigate, but there are three simple ways to up your SEO game just be re-assessing your content output.
Data breaches are on the rise, and companies are preparing by boosting their cybersecurity budgets. According to the Cybersecurity Market Report (http://www.cybersecurityventures.com/cybersecurity-market-report), worldwide spending on cybersecurity …
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

813 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now