Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Jun Tangunan
  Where is Jun Tangunan?
 Cabanatuan
 Philippines
 Jun Tangunan
 To: Tony Vignone
  Where is Tony Vignone?
 St Augustine
 Florida - United States
 Tony Vignone
 Tags
Subject: RE: Discussion on Inconsistent Data
Thread ID: 395339 Message ID: 395371 # Views: 44 # Ratings: 2
Version: Visual FoxPro 9 SP2 Category: Databases, Tables and SQL Server
Date: Tuesday, January 14, 2014 6:36:47 AM         
   


> > 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.
>
> Try this for start then enhance depending on what it cannot parse.
>
>
clear
> ?parse("MEDICAL + BENEFIT + LIFE")
> ?parse("MEDICAL + BEN + LIFE")
> ?parse("MED+ BEN + LIFE")
> ?parse("MEDICAL + BENEFIT + LIFE + VISION")
> ?parse("MEDICAL + BENEFIT + LIFE + VISION, DENTAL")
> PROCEDURE Parse(cString)
> 	local i,n,delims,out
> 	delims = "+,"
> 	out = ""
> 	n = getwordcount(cString,delims)
> 	if left(getwordnum(cString,1,delims),3) = "MED" then
> 		out = "MEDICAL"
> 		if n > 3 then
> 			for i=4 to getwordcount(cString,delims)
> 				out = out+","+getwordnum(cString,i,delims)
> 			next	
> 		endif
> 	else
> 		out = "Cannot Interpret"
> 	endif
> RETURN out

>
> Tony


That will work only as long as the sequence of the words starts with 'MED'. It will fail when the encoder change the sequence like:

?parse("BENEFIT + MEDICAL + LIFE + VISION, DENTAL")





https://vfpx.codeplex.com/releases/view/99045
http://sandstorm36.blogspot.com

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