Regular Expression or something of that sort RRS feed

  • Question

  • User739135361 posted


    I have a task where in I need to guate user input, and compare it with some specific form of sentences. For instances, I have to check if user has mentioned anything about his/ her work? such as "I have worked on 200 items", "I have handled such and such situations","I have mininal score offs on my work" etc etc... If user keys in same excact work life would be easy. But thats not going to happen eveytime. So the requiement is is their an approach / regual expression or something of that sort where in we could guage if the user is intending to say something from the set of sentences / phrases we have. 

    Secondly, the sentence "I have worked on 200 items", could be diffent for different users so can we comepare such sentence with a expression like : "I have worked on % items" or something of that sort? Any approach towards this will be appreciated.

    Hope I am clear and not consufsing everyone. 


    Monday, July 15, 2019 8:02 AM

All replies

  • User753101303 posted


    I would rather than have a look at a framework such as  https://www.ibm.com/watson/services/natural-language-understanding/ or AWs, Microsoft, Google etc...

    You want to detect from a source (comments or really just a short sentence) if someone is talking about "work") ?

    Monday, July 15, 2019 8:23 AM
  • User-821857111 posted

    You will be wasting your time trying to solve this problem with Regex. Regex is purely a pattern matching tool. Things either match the specified pattern, or they don't. Regex is unable to discern context and vary its results accordingly. These days, the kind of task that you describe is usually covered by Natural Language Processing (https://en.wikipedia.org/wiki/Natural_language_processing) - a form of AI coupled with machine learning. The more data you feed it, the better it gets at being able to place phrases in context. 

    It's highly advanced and is a technique that's used by a lot of CV parsing companies, for example. Azure has an offer that might be relevant: https://azure.microsoft.com/en-gb/services/cognitive-services/text-analytics/

    Monday, July 15, 2019 8:25 AM
  • User409696431 posted

    Just a comment on your requirement:  There is no reason to assume that the word "work" would be used by someone describing their work.  "I have built several asp.net applications..."  "I provide customization for those looking for ..."  "I am a mason and have built ...."    And so on.  Your requirement, just the piece you have described, is far more complicated than it may seem.

    Monday, July 15, 2019 7:16 PM
  • User1520731567 posted

    Hi N1ZAM,

    You need to spend long time matching a large number of keywords by Regex.

    In addition,for example:'I do not know whether to laugh or cry.'

    Unless you know the situation, you may not be able to accurately test users' emotions even if the keyword matches successfully sometimes.

    A small idea, maybe you can let the user actively click on the button to vent their emotions. (one star(sad), two stars(normal),three stars(happy) and so on...).

    This is just a matter of adding a field which can store emotions data.

    Best Regards.

    Yuki Tao

    Tuesday, July 16, 2019 6:13 AM