# Which machine learning algorithm is suitable for detecting text w.r.t set of words

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

< 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.

• 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? – Oliver Mason May 18 '18 at 9:14
• 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 – Nɪsʜᴀɴᴛʜ ॐ May 18 '18 at 9:55
• "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 – Fadi Bakoura May 18 '18 at 12:20