首页 > 解决方案 > 如何在 JSON 中存储令牌信息的自定义属性并用于训练

问题描述

使用gold.docs_to_json,我无法在 JSON 中存储自定义令牌属性

{
    "id": 0,
    "paragraphs": [
        {
            "raw": "Complete the nlp task",
            "sentences": [
                {
                    "tokens": [
                        {
                            "id": 0,
                            "orth": "Complete",
                            "tag": "VB",
                            "head": 0,
                            "dep": "ROOT",
                            "ner": "O"
                        },
                        {
                            "id": 1,
                            "orth": "the",
                            "tag": "DT",
                            "head": 2,
                            "dep": "det",
                            "ner": "O"
                        },
                        {
                            "id": 2,
                            "orth": "nlp",
                            "tag": "NN",
                            "head": 1,
                            "dep": "compound",
                            "ner": "O"
                        },
                        {
                            "id": 3,
                            "orth": "task",
                            "tag": "NN",
                            "head": -3,
                            "dep": "dobj",
                            "ner": "O"
                        }
                    ],
                    "brackets": []
                }
            ]
        }
    ]
}

我如何也可以存储自定义属性?我也可以用它来训练自定义属性spacy train


不相关的细节: 我知道可以制作一个自定义的 doc_to_json 来存储自定义属性,但是如果我无法训练模型来标记自定义属性,那么它就没有用了。

标签: nlpspacy

解决方案


推荐阅读