Classification of requests for virtual assistant in Java?

This is my first post on Stack Overflow, so please let me know if I'm more thorough in asking questions in the future.

I am currently working on a Virtual Assistant app for Android using Java and while it is still going well, I am not sure how to approach the classification of user input. So far, I have implemented Stanford NLP Parser within the program so that phrases, phrases, and words can be applied to the raw text. This allowed me to recognize direct information about the program and extract it from it, simply by looking for specific tags.

(ROOT
  (SBARQ <--- Indicates that the sentence is a question
    (WHNP (WP Who))
      (SQ (VBD were)
        (NP (DT the) (FW samurai))) <--- Subject of question
      (. ?)))

      

While this looks like a step forward, I hope that ultimately the assistant will be able to categorize different types of questions (weather related questions, time and date questions, etc.) and is also able to recognize questions that are not directly, but asking for the same information (eg, "can you tell me about the samurai?" as opposed to "who was the samurai?"). Doing this just by using Stanford NLP Parser and looking for specific tags seems like a very daunting task. Does anyone have any advice on alternative approaches I could take?

Thank you!

+3


source to share


1 answer


With regard to virtual assistants or chat rooms, this is commonly referred to as target classification . There are tons of ways to do this, but usually you provide labeled examples and train the model to distinguish them. Here are some examples from a blog post on the topic:

# 3 classes of training data
training_data = []
training_data.append({"class":"greeting", "sentence":"how are you?"})
training_data.append({"class":"greeting", "sentence":"how is your day?"})
training_data.append({"class":"greeting", "sentence":"good day"})
training_data.append({"class":"greeting", "sentence":"how is it going today?"})

training_data.append({"class":"goodbye", "sentence":"have a nice day"})
training_data.append({"class":"goodbye", "sentence":"see you later"})
training_data.append({"class":"goodbye", "sentence":"have a nice day"})
training_data.append({"class":"goodbye", "sentence":"talk to you soon"})

training_data.append({"class":"sandwich", "sentence":"make me a sandwich"})
training_data.append({"class":"sandwich", "sentence":"can you make a sandwich?"})
training_data.append({"class":"sandwich", "sentence":"having a sandwich today?"})
training_data.append({"class":"sandwich", "sentence":"what for lunch?"})

      

As long as your training data is specific to your application, this is in principle no different from automatically categorizing emails or news articles.



An easy-to-use basic algorithm for classifying Naive Bayes text . Later methods involve using Spacing between words> or neural networks.

The part where you retrieve the object is also called the slot definition , and the intent and slot architectures are common for helpers. Even if you want to build something from scratch, looking at the configuration screens for chatbot platforms like rasa can be helpful to get an idea of ​​how to use the training data.

+2


source







All Articles