Solved

GENERATING PAIR OF WORDS

Posted on 2003-10-24
7
232 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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Scam emails are a huge burden for many businesses. Spotting one is not always easy. Follow our tips to identify if an email you receive is a scam.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

708 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

11 Experts available now in Live!

Get 1:1 Help Now