在给定文本中发现“模板”?

如果我有大量的文本,并且试图发现其中最常出现的模板,我考虑使用N-Gram方法来解决这个问题,实际上在这个问题中也有人建议使用这种方法,但我的需求略有不同。为了澄清,我有一些这样的文本:

I wake up every day morning and read the newspaper and then go to workI wake up every day morning and eat my breakfast and then go to workI am not sure that this is the solution but I will tryI am not sure that this is the answer but I will tryI am not feeling well today but I will get the work done and deliver it tomorrowI was not feeling well yesterday but I will get the work done and let you know by tomorrow

我试图提取这样的“模板”:

I wake up every day morning and ... and then go to workI am not sure that this is the ... but I will tryI ... not feeling well ... but I will get the work done and ... tomorrow

我正在寻找一种可以处理数百万行文本的方法,所以我想知道我是否可以调整相同的N-gram方法来解决这个问题,或者是否有其他替代方案?


回答:

数百万行文本并不是一个非常大的数字 🙂

你寻找的东西至少与搭配发现相似。你可以尝试计算n-gram的点对点互信息。请参阅Manning & Schütze (1999)了解这个问题和其他方法的解决方案。

Related Posts

L1-L2正则化的不同系数

我想对网络的权重同时应用L1和L2正则化。然而,我找不…

使用scikit-learn的无监督方法将列表分类成不同组别,有没有办法?

我有一系列实例,每个实例都有一份列表,代表它所遵循的不…

f1_score metric in lightgbm

我想使用自定义指标f1_score来训练一个lgb模型…

通过相关系数矩阵进行特征选择

我在测试不同的算法时,如逻辑回归、高斯朴素贝叶斯、随机…

可以将机器学习库用于流式输入和输出吗?

已关闭。此问题需要更加聚焦。目前不接受回答。 想要改进…

在TensorFlow中,queue.dequeue_up_to()方法的用途是什么?

我对这个方法感到非常困惑,特别是当我发现这个令人费解的…

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注