I need to find words and phrases in a table (a dictionary) and am looking for a better algorithm. I will appreciate your input.
Variables: Word, Phrase
Table records:
...
in
in order
in order to
in spite
... etc.
I read each word sequentially from a text file. My difficulty is to find the phrase without asking the user unnecessary questions.
Consider the following strings:
String 1: “put them IN the box”
String 2: “put them IN ORDER so that…”
String 3: “put them here IN ORDER TO close the box…”
Here is my algorithm:
This drawback here is that in (case C) the user is asked whether to append phrases like 'put them', 'put them in' and so on.
Is is possible to position the record pointer at 'IN' in String1, at 'IN ORDER' in String2 and 'IN ORDER TO' in String3. How can I realize this incremental Searching?
Thank you in advance for your understanding.
VFP 9.0 SP2 on XP SP3
Variables: Word, Phrase
Table records:
...
in
in order
in order to
in spite
... etc.
I read each word sequentially from a text file. My difficulty is to find the phrase without asking the user unnecessary questions.
Consider the following strings:
String 1: “put them IN the box”
String 2: “put them IN ORDER so that…”
String 3: “put them here IN ORDER TO close the box…”
Here is my algorithm:
Code:
IF FOUND(Word)
add to Phrase (case A)
IF FOUND(Phrase)
do something else (case B)
ELSE
ask the user whether to append (case C)
Phrase = ‘’
ENDIF
ELSE
ask the user whether to append (case D)
ENDIF
Word = ‘’
NEXT WORD
This drawback here is that in (case C) the user is asked whether to append phrases like 'put them', 'put them in' and so on.
Is is possible to position the record pointer at 'IN' in String1, at 'IN ORDER' in String2 and 'IN ORDER TO' in String3. How can I realize this incremental Searching?
Thank you in advance for your understanding.
VFP 9.0 SP2 on XP SP3