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

如果我有大量的文本,并且试图发现其中最常出现的模板,我考虑使用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

使用LSTM在Python中预测未来值

这段代码可以预测指定股票的当前日期之前的值,但不能预测…

如何在gensim的word2vec模型中查找双词组的相似性

我有一个word2vec模型,假设我使用的是googl…

dask_xgboost.predict 可以工作但无法显示 – 数据必须是一维的

我试图使用 XGBoost 创建模型。 看起来我成功地…

ML Tuning – Cross Validation in Spark

我在https://spark.apache.org/…

如何在React JS中使用fetch从REST API获取预测

我正在开发一个应用程序,其中Flask REST AP…

如何分析ML.NET中多类分类预测得分数组?

我在ML.NET中创建了一个多类分类项目。该项目可以对…

发表回复

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