Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Tony Vignone
  Where is Tony Vignone?
 St Augustine
 Florida - United States
 Tony Vignone
 To: Vilhelm-Ion Praisach
  Where is Vilhelm-Ion Praisach?
 Resita
 Romania
 Vilhelm-Ion Praisach
 Tags
Subject: RE: Discussion on Inconsistent Data
Thread ID: 395339 Message ID: 395358 # Views: 36 # Ratings: 3
Version: Visual FoxPro 9 SP2 Category: Databases, Tables and SQL Server
Date: Tuesday, January 14, 2014 7:00:35 PM         
   


> > I am tasked with writing a software package for a third party to use. Unfortunately, for one part of the program, I continually have to go only so far in the program and then stop completely (SET STEP ON) and then pick up some information which I need to translate.
> >
> > For example, some data may come in as "MEDICAL + BENEFIT + LIFE" and I am supposed to translate it as "MEDICAL".
> > If it comes in as "MEDICAL + BEN + LIFE", it still has to translate as "MEDICAL".
> > If the data comes in to me as "MED + BEN + LIFE", same thing, as 'MEDICAL".
> >
> > What I am saying is that there are no controls on the way the data comes in so even artificial intelligence might have difficulty interpreting this properly.
> >
> > Other examples are:
> >
> > "MEDICAL+BENEFIT + LIFE", translates as "MEDICAL".
> >
> > In this case, the person doing the free hand typing, left out the normal spacing between the word MEDICAL and BENEFIT". How can you get around this type of thing? How do you programmatically interpret as well as a person can in a program?
> >
> > Another example, "MEDICAL + BENEFIT + LIFE + VISION", interprets as "MEDICAL, VISION".
> >
> > Last example, "MEDICAL + BENEFIT + LIFE + VISION, DENTAL", interprets as "MEDICAL, VISION, DENTAL".
> >
> > There are literally so many ways a person can type something that it would seem almost impossible to always know what the interpretation should ultimately be.
> >
> > Cecil Champenois, Jr.
>
>
> I believe you must define a keyword dictionary.
> Type in the first textbox various expressions containing at least one of the words Medical, Med, Vision, etc.
> The result would appear in the second textbox.
>
>
PUBLIC oFrm
> CREATE TABLE keyword_dict (Id I AUTOINC,Word C(240),Translatio C(254))
> INSERT INTO keyword_dict (Word,Translatio) VALUES ('Medical','Medical')
> INSERT INTO keyword_dict (Word,Translatio) VALUES ('Med','Medical')
> INSERT INTO keyword_dict (Word,Translatio) VALUES ('Vision','Vision')
> INSERT INTO keyword_dict (Word,Translatio) VALUES ('Visio','Vision')
> INSERT INTO keyword_dict (Word,Translatio) VALUES ('Dental','Dental')
> INSERT INTO keyword_dict (Word,Translatio) VALUES ('Dent','Dental')
> INDEX on LOWER(Word) TAG word
> 
> oFrm=CREATEOBJECT("MyForm")
> oFrm.show()
> 
> DEFINE CLASS MyForm as Form
> 	ADD OBJECT txt1 as textbox WITH width=200,value=SPACE(240)
> 	ADD OBJECT txt2 as textbox WITH width=200,top=50
> 	PROCEDURE txt1.Valid
> 		LOCAL lni,lnWord,laWord[1],lcComma
> 		ThisForm.txt2.Value=''
> 		lcComma=''
> 		lnWord=ALINES(laWord,This.value,1+4,SPACE(1),",",CHR(9),".",";",":","-","+")
> 		FOR lni=1 TO lnWord
> 			SELECT keyword_dict
> 			IF SEEK(LOWER(laWord[lni]))
> 				ThisForm.txt2.Value=ThisForm.txt2.Value+lcComma+ALLTRIM(Translatio)
> 				lcComma=','
> 			ENDIF
> 		NEXT
> 	ENDPROC
> ENDDEFINE

>
>
>
> My respects

Good thought. However you dictionary implies:
?word = left(translatio,len(word))
So you need only the 'translatio' field, 'word' is superfluous. Each word in the input can be tested as above.

Tony

ENTIRE THREAD

Discussion on Inconsistent Data Posted by Cecil Champenois @ 1/13/2014 6:15:46 PM
RE: Discussion on Inconsistent Data Posted by David Mustakim @ 1/13/2014 6:40:05 PM
RE: Discussion on Inconsistent Data Posted by Cecil Champenois @ 1/13/2014 6:46:51 PM
RE: Discussion on Inconsistent Data Posted by Tony Vignone @ 1/13/2014 6:49:00 PM
RE: Discussion on Inconsistent Data Posted by Jun Tangunan @ 1/14/2014 6:36:47 AM
RE: Discussion on Inconsistent Data Posted by Cecil Champenois @ 1/14/2014 3:12:39 PM
RE: Discussion on Inconsistent Data Posted by Tony Vignone @ 1/14/2014 6:58:46 PM
RE: Discussion on Inconsistent Data Posted by Cecil Champenois @ 1/14/2014 7:44:48 PM
RE: Discussion on Inconsistent Data Posted by Tony Vignone @ 1/14/2014 11:12:28 PM
RE: Discussion on Inconsistent Data Posted by Vilhelm-Ion Praisach @ 1/13/2014 7:00:25 PM
RE: Discussion on Inconsistent Data Posted by Tony Vignone @ 1/14/2014 7:00:35 PM
RE: Discussion on Inconsistent Data Posted by Vilhelm-Ion Praisach @ 1/14/2014 7:53:25 PM
RE: Discussion on Inconsistent Data Posted by Tony Vignone @ 1/14/2014 11:08:17 PM
RE: Discussion on Inconsistent Data Posted by Pete Sass @ 1/13/2014 7:55:46 PM
RE: Discussion on Inconsistent Data Posted by Cecil Champenois @ 1/13/2014 9:09:42 PM
RE: Discussion on Inconsistent Data Posted by David Mustakim @ 1/13/2014 9:24:52 PM
RE: Discussion on Inconsistent Data Posted by Cecil Champenois @ 1/13/2014 9:49:26 PM
RE: Discussion on Inconsistent Data Posted by Pete Sass @ 1/13/2014 9:41:48 PM
RE: Discussion on Inconsistent Data Posted by Cecil Champenois @ 1/13/2014 9:51:13 PM
RE: Discussion on Inconsistent Data Posted by Michel Levy @ 1/13/2014 10:01:45 PM
RE: Discussion on Inconsistent Data Posted by Vilhelm-Ion Praisach @ 1/14/2014 6:45:45 AM
RE: Discussion on Inconsistent Data Posted by Jun Tangunan @ 1/14/2014 1:15:20 AM
RE: Discussion on Inconsistent Data Posted by Tore Bleken @ 1/14/2014 8:53:53 AM