给定一组文本(可能是书籍,文章,文档等),您如何为每个文本找到相关的关键字?常识表明:
问题是:这是一个很好的公式吗?
我开发了一个.
对于每个单词计算此比率:
(frequency of word in this text) * (total number of words in all texts)
-----------------------------------------------------------------------
(number of words in this text) * (frequency of word in all texts)
Run Code Online (Sandbox Code Playgroud)
关键词是那些比例最高的20%(对于这个数字).
Ankerl还提出了他自己的公式:
tanh(curVal/curWords*200) - 5*tanh((allVal-curVal)/(allWords-curWords)*200)
Run Code Online (Sandbox Code Playgroud)
哪里:
两种算法都运行良好,结果经常重合.你知道更好的方法吗?