Algorithm to find related words in a text

前端 未结 5 509
后悔当初
后悔当初 2021-02-03 13:35

I would like to have a word (e.g. \"Apple) and process a text (or maybe more). I\'d like to come up with related terms. For example: process a document for Apple and find that i

5条回答
  •  北恋
    北恋 (楼主)
    2021-02-03 14:04

    What I would do is get all the words in a text and make a frequency list (how often each word appears). Maybe also add to it a heuristic factor on how far the word is from "Apple". Then read multiple documents, and cross out words that are not common in all the documents. Then prioritize based on the frequency and distance from the keyword. Of course, you will get a lot of garbage and possibly miss some relevant words, but by adjusting the heuristics you should get at least some decent matches.

提交回复
热议问题