Algorithm 跨大型数据集的短语/多词和计数匹配

Algorithm 跨大型数据集的短语/多词和计数匹配,algorithm,python-2.7,Algorithm,Python 2.7,我有大量的数字和字母数字集合,我希望通过python 2.7在其中找到常见的单词/短语 示例数据,与我的真实数据没有任何相似之处,但这很好地表示了它 'this is a test of the hosting', 'test is a test', 'we have more tests to run before we can trust it', 'if it true, can trust it', 'tom is on time for ounce', 'what do you me

我有大量的数字和字母数字集合,我希望通过python 2.7在其中找到常见的单词/短语

示例数据,与我的真实数据没有任何相似之处,但这很好地表示了它

'this is a test of the hosting',
'test is a test',
'we have more tests to run before we can trust it',
'if it true,  can trust it',
'tom is on time for ounce',
'what do you mean tom is out sick again'
以下类型的匹配我正在寻找

'is' x 5
'test' x 3
'is a test' x 2
'is a' x2
'we' x2
'trust it' x 2
'tom' x 2
..etc..

有一个通用的库吗?还是我需要写一个?我可以用蛮力做到这一点,但在我的一些较大的文件上,这可能需要几年时间。我“假设”这是一个常见问题,一些智能cookie已经找到了解决方案。希望这不是一个旅行推销员。

我想你是在寻找单字符、双字符、三字符计数。您可以使用Python中的NLTK库来做您想做的事情


还有,看看这个

你在找单格、双格、三格等计数吗?我必须承认,我不知道你对单格、双格、三格的意思。。。但是,快速查找会让我想到单词级的二元图/三元图/等等。。匹配。任何一个匹配集,我认为4字匹配将是我想要处理的最大的匹配集。当我看到你的unigram、bigram、trigram并搜索“python unigram bigram trigram”时,我发现了很多关于它的信息。谢谢大家!@JustBreak:随时:)通常情况下,只要一个小小的提示就可以得到你想要的!