【问题标题】:Spacy: Should I train the model on single sentence or I can pass two sentence combined?Spacy:我应该用一个句子训练模型还是可以通过两个句子的组合?
【发布时间】:2020-01-23 11:05:38
【问题描述】:

我的数据库中有多个类似下面的句子:

KP Snacks Ltd 召回了 McCoy 的 4 种变体的某些日期代码 多袋薯片。 KP Snacks Ltd 已进行预防性召回 下面列出的产品中这些袋子的数量非常少 薯片可能含有小块塑料。

我应该先拆分句子还是只将整个数据(2 个句子)放到模型中?

TRAIN_DATA_1 = [
    ("KP Snacks Ltd recalls certain date codes of 4 variants of McCoy’s multi bag crisps. KP Snacks Ltd has undertaken a precautionary recall of the products listed below as a very small number of these bags of crisps may contain small pieces of plastic.", {"entities": []}),
    ("I like London and Berlin.", {"entities": []}),
]

TRAIN_DATA_2 = [
    ("KP Snacks Ltd recalls certain date codes of 4 variants of McCoy’s multi bag crisps.", {"entities": []}),
("KP Snacks Ltd has undertaken a precautionary recall of the products listed below as a very small number of these bags of crisps may contain small pieces of plastic.", {"entities": []}),
    ("I like London and Berlin.", {"entities": []}),
]

简而言之,TRAIN_DATA_1 与 TRAIN_DATA_2 哪个正确,为什么?

【问题讨论】:

    标签: nlp feature-extraction


    【解决方案1】:

    我应该先拆分句子还是只将整个数据(2 个句子)放到模型中?

    这取决于。一切都与你的目的有关。

    您似乎正在训练 NER。在这种情况下,多个较短的短语会更好,因为 NER 依赖于用于实体预测的周围单词 - 因此,如果您提供过大的文本,其中的一部分将被解析器忽略(取决于工具)或会影响您的结果(消极地)。

    简而言之,TRAIN_DATA_1 与 TRAIN_DATA_2 哪个正确,为什么?

    没有“正确”的答案。如前所述,这取决于工具和目的。 我建议拆分,因为您将能够生成更多数据样本以进行更好的训练。

    共指解析的情况例外,因为第二个拆分短语的部分可能引用第一个。但我认为这是一种罕见的情况。

    这也可能是情绪分析和其他最终任务的情况,在这些任务中,您有多个时间段与已分类的单个语句相关,并且在没有信息/意义丢失的情况下无法破解。

    【讨论】:

      猜你喜欢
      • 2017-04-26
      • 2019-01-14
      • 1970-01-01
      • 1970-01-01
      • 2010-10-14
      • 1970-01-01
      • 2021-08-04
      • 1970-01-01
      • 2019-09-18
      相关资源
      最近更新 更多