Can VB code unjumble short sentences in a database?
An assignment is to put text phrases into a database and change the word order of some. Sometimes the adjective comes after the noun. The mistakes – where they occur – are very similar.
Rather like this -
seeking holidays in new zealand gold.
expeditions fishing in china.
australia ski-ing in.
programming holidays in newcastle cheap.
apartment holiday skiing
argentine cheap holiday ski
chalet Africa ski
accommodation luxury ski
accommodation private ski
cabin Georgia in romantic
I’m wondering if IF ELSE and sql might do the job. Perhaps the only way (?) would be a long list of Ifs and ELSEs. Have any of our experts experience in this area please? Or is this an impossible task? Any advice/help would be gratefully received.
Originally posted by bscorer
What are you wanting the program to do? VB can manipulate the text anyway you want, but you have to tell the program what is incorrect and how to correct it.
Have you done this before, bscorer? One of the troubles is that the phrases don't have exactly the same mistake. "the cat sat on the mat" can be "sat on the mat the cat" and "cat sat on the mat the". (If you have done this sort of manipulating, I'd be pleased to see an example of the coding.)
Your reply is encouraging, thanks very much. Cheers
Originally posted by kupe
Thanks, DoktorBlue. I need to rearrange the phrases so they make sense.
Okay, we are getting somewhere! You have to specify abstractly (and not based on examples), when a phrase makes sense. If you can determine, whether a phrase makes sense or not, you can permutate all words in a phrase until either there are no more permutations or you Phrase_Makes_Sense(Phrase as String) evaluates to TRUE.
Make everything as simple as possible, but not simpler! - A. Einstein
DB Problems? DB Explorer, BTrieve Re-engineering, DB Conversions & ETL? Conversion Tool
VB can minipulate strings anyway you want using LEFT, MID, and RIGHT commands. But you have to come up with a set of rules that tell the program the text is ordered incorrectly, there is no way vb can just reorder the text for you. This seems very difficult to do if users can enter anything in the text box. Don't know if this will help but you could limit entries to combo boxes, ie list of countries, list of activities. This way at least you know what text you are dealing with and what order it has been selected.
Thanks, bscorer. Yes, that's the way it looks to me now. I've searched through VBA Word sites - surprisingly few comparatively - for DoktorBlue's suggestions, but I think the demand is too difficult to answer.
Instead, I have persuaded the User to have each of these sentences divided into separate words. Whereas the sentence was in a single field, I plan to put each word into its own field (such as Nouns, Adjectives, PlaceNames, Activities), and here I am with the morning coffee wondering how I am going to do that, which string function I could use.
It would be good to code to move each word into its own cell in Excel afterwards, but exporting is so simple between the two programs that that part isn't a problem. Of course to have it all automated would look better.