Explore Courses Blog Tutorials Interview Questions
0 votes
in AI and Deep Learning by (50.2k points)

I have a word, according to that i want to find out whether the text is related to that word or not using python and nltk is it possible?

For example, I have a word called "phosphorous". I would like to find out that the particular text file is related to this word or not?

I can’t use a bag of words in nltk as I have only one word and no training data.

Any Suggestions?

Thanks in Advance.

1 Answer

0 votes
by (108k points)

You cannot do it without a corpus.

Look at it this way: can you tell whether 'light' is related to 'I turned on the electricity when I entered the room' without asking someone or something that actually knows Japanese (assuming it was written in Japanese and you don't know Japanese; if you do, try with "light" and "When he entered the room, he lit the lamp"). If you can't, how do you expect a computer to do it?

Consider this experiment - can you provide me the algorithm by which you can teach a non-English-speaking person that "light" is related to "When he entered the room, he turned on the lamp"? Again, not possible.

You need training data unless you significantly limit the meaning of "related" (to "contains", for example).

If you wish to learn what is Natural Language Processing then visit this NLP Tutorial.

Browse Categories