Python Forum
Check text contains words similar to themes/topics (thesaurus)
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Check text contains words similar to themes/topics (thesaurus)
#1
I'm a beginner in python and am needing some help (either code, or point me in the right direction for help).

I have some free text fields where i need to assess if they reach a benchmark of completion. ie sales people needing to complete a free text field based on customer's needs - I am needing to flag these as "pass" or "not pass" for training purposes - ie not pass is where people are lazy and put N/A or junk text, or, where they don't mention something about the topic required. Pass would need to contain relevant info relating to the field topic/theme.

I'm getting some examples of what are considered 'good' completions. I'm thinking of just basing the first version around length and presence of keywords - ie is the text long enough (ie needs to be a min of 5 words) - this part is fine, the part i need help with is trying to work out how to determine are any key words listed in the text that match the topic/theme. Think

ie for the field is based on the customer's current situation i might be looking for any words related to situation, current, help, doing, needs etc ... for the field based on next steps i might look for words relating to going, decision, recommend, choose

Any ideas/help would be appreciated! Pray
Reply
#2
One of these packages will probably do the trick: https://pypi.org/search/?q=synonym&o=
I leave it up to you to choose.

Also, depending on how much you want to get into the subject, there is a package that will do this as a small part of what it's capable of: NLTK -- the Natural Language Tool Kit.
Not trivial at all to learn entire package, but to use for a simple synonym producer, might not be so bad, see: https://www.w3resource.com/python-exerci...cise-7.php

NLTK package itself is here: https://www.nltk.org/
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  find and group similar words with re? cartonics 4 714 Oct-27-2023, 05:36 PM
Last Post: deanhystad
  Form that puts diacritics on the words in the text Melcu54 13 1,460 Aug-22-2023, 07:07 AM
Last Post: Pedroski55
  Extract a string between 2 words from a text file OscarBoots 2 1,865 Nov-02-2021, 08:50 AM
Last Post: ibreeden
  Generate a string of words for multiple lists of words in txt files in order. AnicraftPlayz 2 2,790 Aug-11-2021, 03:45 PM
Last Post: jamesaarr
  Open and read multiple text files and match words kozaizsvemira 3 6,729 Jul-07-2021, 11:27 AM
Last Post: Larz60+
  Sum similar items tester_V 3 1,947 Jun-29-2021, 06:58 AM
Last Post: tester_V
  Counting the most relevant words in a text file caiomartins 2 2,473 Sep-21-2020, 08:39 AM
Last Post: caiomartins
  check if letters in a words Vimart 4 5,476 Aug-10-2020, 09:59 PM
Last Post: deanhystad
  how to check if string contains ALL words from the list? zarize 6 7,182 Jul-22-2020, 07:04 PM
Last Post: zarize
  Python: if 'X' in 'Y' but with two similar strings as 'X' DreamingInsanity 6 3,852 Feb-01-2019, 01:28 PM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020