Results 1 to 8 of 8
  1. #1
    Join Date
    May 2003
    Posts
    19

    Unanswered: Changing word positions

    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

    Im 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.

  2. #2
    Join Date
    Jul 2003
    Posts
    48

    Re: Changing word positions

    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.

  3. #3
    Join Date
    May 2003
    Posts
    19

    Re: Changing word positions

    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

  4. #4
    Join Date
    Aug 2003
    Location
    Delft, The Netherlands (EU)
    Posts
    447

    Re: Changing word positions

    I guess bScorer is asking what do you want to achive.

    Spelling checken incl. grammatica? Consider to buy a spelling component, and add it to your project.

    Any other special requirements: try to make them explicit.
    Make everything as simple as possible, but not simpler! - A. Einstein
    DB Problems? DB Explorer, BTrieve Re-engineering, DB Conversions & ETL? Conversion Tool

  5. #5
    Join Date
    May 2003
    Posts
    19
    Thanks, DoktorBlue. I need to rearrange the phrases so they make sense. For example,

    "seeking holidays in new zealand gold" should be "gold seeking holidays in new zealand" and

    "expeditions fishing in china" should be "fishing expeditions in china" and

    "australia ski-ing in" should be "ski-ing in australia"

    The question is: Can VB do that for me and if it can, I 'd be very pleased to see some sample code.

    Cheers

  6. #6
    Join Date
    Aug 2003
    Location
    Delft, The Netherlands (EU)
    Posts
    447
    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

  7. #7
    Join Date
    Jul 2003
    Posts
    48
    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.

  8. #8
    Join Date
    May 2003
    Posts
    19
    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.

    Thanks for coming back. Cheers.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •