Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"Fuzzy", Incremental or Soft Search

Status
Not open for further replies.

academica

Technical User
Feb 21, 2010
28
CN
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:
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
 
why not use the $ operator?

Ali Koumaiha
TeknoSoft Inc.
Michigan
 
You might want to look at
How to make an incremental search in Grid
faq184-1214

Comments from Ramani's in the above FAQ:
What we achieve is
a. An interactive search when the user keys in the txtSearch text box.
b. IF THE FIRST CHARACTER OF THE SEARCH IS "*" WILDCARD, then search the key field contents for the presence of the word or letters that follow the wild card.


In the instance you show above you appear to be looking for not the "First Characters", but instead something else so you might need to make some modifications, but it should be a start for you.

Additional possibilities might be found by doing a Google search for:
vfp jkey
or
vfp "incremental search"

Good Luck,
JRB-Bldr





 
Thank you for your responses. The code at FAQ184-1214 is very helpful, indeed.

Eventually I solved my problem. The difference from the typical incremental search is that in my case it is performed without user interface and control. It's too simple to be worth sharing, but I would publish it here if anyone is interested.
 

Of course someone might be interested - if not today, then at some later time, someone may be looking for a solution, just like you just did, and find this thread.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top