Considering the scenario where supervised training data-set in the form of sentence will be given to train the machine

The Bomb which had been planted by Terrorist on this morning was defused by the Counter Terrorist on joining hands with the Intelligence Force

Input strings in the sentence containing each words are broken into tokenised arrays of single words with stop words removed.

Each word in the given sentence gets assigned a label w1, w2 and so on i.e,
w2 = Bomb
w6 = planted
w13 = defused

Calculating the scores for individual word combinations, the result should yield something like:
w2.w6 = Scores should be Positive (or > some threshold value)
w2.w13 = Scores should be Negative (or < some threshold value)

In case of words with polarity changers
Eg.: Bomb wasn't/haven't/didn't got defused.
The resulting scores should be positive

To accomplish this task I had implemented Sentiment Analysis with the threshold = 2.5 and ended up with the following scores

Actual Output:

< 2.5 : Low
= 2.5 : Neutral
> 2.5 : High

Expected Output:

Case 1: score = negative, since that bomb was defused or removed in the given sentence
Case 2: score = positive, vice versa of "Case 1"
Case 3: Otherwise score = 0, in case it can't predict either of the above two cases, it should be neutral

I am facing a severe problem every time I need to update the vocabulary list with upcoming new words that were not in the dictionary list, which is turning out to be Semi-supervised learning.

Referring to the above sentence to calculate the w(n-(1/2/3/...n) and wn word with reference to word = Bomb. The final resulting score should yield as negative.

So which machine learning algorithm would be appropriate that fits to yield a better solution and based on the given data set how will I train the machine to learn the above things?

Finally should I try to implement by keeping the model persistence. So that it doesn’t have to be trained on each run.

  • $\begingroup$ It looks like you are trying to compute some kind of word relationships. Can you be a bit more explicit about the purpose of the scores, and what they should reflect? $\endgroup$ Commented May 18, 2018 at 9:14
  • $\begingroup$ After scanning set of words in the given document file, the scores should reflect whether the bomb planted was defused or not at the end of the story @OliverMason $\endgroup$ Commented May 18, 2018 at 9:55
  • 1
    $\begingroup$ "whether the bomb planted was defused or not" Do you mean there is only one simple answer (defused/not defused)? why you don't try RNN with character level to overcome unknown words $\endgroup$ Commented May 18, 2018 at 12:20

1 Answer 1


If your main issue is dealing with new vocabulary, you could try using a parts-of-speech tagger as a pre-processing step. You would then effectively discover relationships between "noun" and "verb", which does not change with new words. Taggers usually can handle unknown words by using contextual information.

So you'd tag the words with their word class labels, and use those for training.

In 'application mode' you use p-o-s tags again, calculate the scores, and then map them back onto your original word tokens.

This does of course loose you some information, as you're only dealing with N-V, rather than bomb-plant or bomb-defuse. To solve this I'd use a hybrid approach: for your known vocabulary you use the word tokens, whereas for unknown words you fall back on tags. If you train two classifiers, one with tokens, one with tags, you have the tags one as a 'safety net' to handle out-of-vocab words.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .