4
$\begingroup$

I am trying to pick a technique for classifying conversational text. I am concerned about treating the problem at a level of fidelity of each individual message because people often say things like, "ok" or short responses that have no inferable meaning. How does conversation classification typical handle these types of problems?

To elaborate, a conversation might be:

P1: Hi I want to buy a car?
P2: Ok. Great!
P1: What cars do you have?
P2: A large variety!

The topic is cars, but this can not be inferred by anything P2 says, nor should it be. So would you break a conversation into blocks of time, or is there a technique for partitioning?

$\endgroup$
5
  • $\begingroup$ I feel like there has to be a lot of knowledge out there on this subject, but I wonder how much of it is publicly available (as opposed to siloed under NDAs). $\endgroup$ Commented Oct 7, 2018 at 21:03
  • $\begingroup$ that's kind of what i'm thinking. It's bizarre how I find a lot of research very adjacent to this, but few papers discussing this exact problem. $\endgroup$
    – Rob
    Commented Oct 7, 2018 at 21:24
  • $\begingroup$ It's neither a common problem nor a simple one. It's basically a sequence identification/tagging task. $\endgroup$ Commented Oct 7, 2018 at 21:32
  • $\begingroup$ yeah, my thoughts were to just like, use a convolution around sentences and max pool. $\endgroup$
    – Rob
    Commented Oct 8, 2018 at 0:24
  • $\begingroup$ Apparently Convolutional RNNs are a thing for sequence extraction. $\endgroup$ Commented Oct 8, 2018 at 5:05

4 Answers 4

2
$\begingroup$

There are multiple techniques that help with the problem you sketch, the applicability of which usually depends on the classification technique and the corpus. But I get the idea you would be helped by some practical examples. So let's go over some of them. Feel free to comment if I tread over familiar grounds, or you want me to elaborate on some of them. Or where to start experimenting with them

  • Stopping A simple technique is applying a stoplist: A list of common words that should be removed. There are pre-packaged lists, but most packages allow you to provide your own.
  • TF/IDF A technique that transforms your features by weighing words by their term frequency (how often do they occur in the document) divided by the document frequency (how often does the word occur in other documents. This way frequent words are made less relevant to the document
  • POS Many packages offer you a part-of-sentence-tagger, that will tag the words by their grammatical function (Verb for instance). You can leverage that in the tokenization step to filter out words (usually you'll look for verbs and nouns). Some vectorizers can do this straight out. (This could also be done with NER)
  • Stemming transforms inflections of words (eg: train/trains) to a stem. This might make some of your words a little more relevant by upping the chance a pair of them collides
  • Restricting your vectorizer: Most packages sport a vectorizer that you can instruct to either look for a minimum/maximum document count (ignore words that either occur in to many different documents, or to little different documents), or to cap the amount of features (words). Capping the amount of words usually selects for most frequently used words.
  • Encoding word/token based features to more semantic features: Word2Vec, but also older techniques such as LDA/LSI.
  • Picking the classification algorithm: Some algorithms are very capable of handeling large feature spaces (Naive Bayes for instance), some algorithms learn to transform the feature space to find better ways to weigh the features.

Packages such as Sklearn, NLTK and Gensim offer most of these techniques.

Let me know if this was helpful

$\endgroup$
1
$\begingroup$

The topic of the conversation should be expressed in one word within the conversation. So instead of making your model guess from a bunch of different combinations of chars, try instead to train your model to guess what word within the conversation is the topic. You probably shouldn't plug in the P1, P2, ... thing because the person speaking is not relevant.

This problem doesn't have to be solved using ML because there is already a traditional solution. Check this link: https://github.com/vgrabovets/multi_rake

$\endgroup$
1
  • $\begingroup$ interesting technique but i don't think this will scale or generalize very well $\endgroup$
    – Rob
    Commented Oct 9, 2018 at 18:41
1
$\begingroup$

This is a natural language processing problem for which there are many tools, including key word in context, part-of-speech identification, stop words, tokenizing, etc. See, e.g., the NLTK package in Python. The key thing to keep in mind is that we are evolving dialects of informal writing (email, texting, etc) that don't adhere to the conventions of formal written English, which means that some of the tools may need tuning for each corpus.

$\endgroup$
4
  • $\begingroup$ You're basically just telling me some of the popular techniques in NLP and claiming it answers my question. From reading your response I'm left with the feeling you didn't actually read my question. $\endgroup$
    – Rob
    Commented Oct 9, 2018 at 18:40
  • $\begingroup$ Hi, Rob. I did read the question, and it wasn't clear to me from the question or the comments if you were looking for something different than traditional NLP. In the example there's only one noun used by one speaker (the simplest possible case). If you're trying to go beyond that to determine how the second speaker engages, you'd want a combination of stop words/neutral filler phrases and a valence analysis to gauge the topic/reaction tenor, perhaps over a time series. Take a look at s3.amazonaws.com/alexaprize/2017/technical-article/… $\endgroup$ Commented Oct 10, 2018 at 19:24
  • $\begingroup$ thanks, didn't mean to be too rude I just feel like suggesting bag of words is such a catch all to NLP questions, and really doesn't help a lot. this article def looks interesting, appreciate your time. $\endgroup$
    – Rob
    Commented Oct 10, 2018 at 20:56
  • 1
    $\begingroup$ No worries, Rob. Anything on the merits can't be rude! Hope the paper gives you some leads. $\endgroup$ Commented Oct 10, 2018 at 21:54
0
$\begingroup$

It's late, but here is an example of how to do this in keras with a special neural network architecture.

$\endgroup$
1
  • $\begingroup$ Hi ixeption, when posting on DataScience SE, please add at least as much information that your answer is still helpful when the link is broken someday. Cheers! $\endgroup$
    – georg.dev
    Commented Aug 7, 2019 at 16:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.