Results 1 to 5 of 5
  1. #1
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Boolean Text (A2k)

    Is it possible to take a string text and look for key words from the sentence.

    Let me explain.

    I would like to try and set up a question answer facility.

    A question can be asked, and an answer given, dependent on certain keywords in the original question.
    The facility may return many answers, but the user has the option to select the one which best suits his needs.

    Is this possible ?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Boolean Text (A2k)

    The technical answer: you can use the InStr function to test whether a keyword occurs in a string. InStr(strText, strKey) will return a positive number if strKey occurs within strText, and 0 if it doesn't. For example, if

    strText = "Dave Willett is a member of Woody's Lounge"
    strKey = "member"

    then the InStr expression will return 19, the position of the first "m" of "member" in strText.

    BUT

    This might become very complicated, if you want to check that the keyword occurs as a whole word, if you want to do fuzzy matching, etc.

  3. #3
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Boolean Text (A2k)

    So, by using strText as an unbound text, and this sentence returns lets say 3 key words, could an answer be obtained using the 3 key words as the most apt answer, and how would I return an answer, example:

    Q.
    strText = "Are there any members of Woody's Lounge"

    A.
    strAnswer1 = "Woody's welcomes new members into it's Lounge" ( 3 key words )
    strAnswer2 = "Join Woody's Lounge today" ( 2 key words )

    Would the answer be pulled from a query ???

    I wouldnt know where to start this, and it's only thoughts at this stage, any further comments would be welcome or even a short eample.
    Thanks again.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Boolean Text (A2k)

    It would be best to store the question, perhaps temporarily, in a table, because you can then run a query against it.

    I have attached a demo database. I chose to use a phrases (answers) table and a separate keywords table that has to be populated by the developer; matching on all words in the phrases to be searched is difficult because you have to exclude common words such as "the" and "is". Finally, there is a questions table.

    There are three queries:
    qryScores calculates the number of matches between each question and each phrase.
    qryHighScores calculates the highest score per question. I excluded scores of 0.
    qryBestPhrases selects the phrases with the highest score for each question. There may be more than one such phrase for a single question.
    Attached Files Attached Files

  5. #5
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Boolean Text (A2k)

    Thats clever.
    Hopefully, this should help me along.
    I could use this as a basis for a help system.

    Thanks for taking the time to compile the demo, it's appreciated.

Posting Permissions

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