空头训练数据中的脑袋是什么意思?

时间:2020-04-11 23:43:12

标签: python json nlp nltk spacy

我正在尝试根据自己的数据训练模型,并且正在使用Spacy库。

但是在代码示例中,我对“令牌头的#索引”感到困惑。

这里的正头是什么意思?

# training data: texts, heads and dependency labels
# for no relation, we simply chose an arbitrary dependency label, e.g. '-'
TRAIN_DATA = [
    (
        "find a cafe with great wifi",
        {
            "heads": [0, 2, 0, 5, 5, 2],  # index of token head
            "deps": ["ROOT", "-", "PLACE", "-", "QUALITY", "ATTRIBUTE"],
        },
    )

1 个答案:

答案 0 :(得分:0)

在您的示例中,任务是重建tree of syntactic dependencies。该树为每个单词显示其附加到的相应“头”单词以及附件的类型。描述此类树的一种特定格式称为CoNLL-U

在您的示例中,例如“ wifi”(单词5)附有“ great”(单词4,如果我们从0开始计数),“ great”是“ wifi”的 quality 。因此,heads的第4个条目等于5,deps的第4个条目等于“ QUALITY”。