2017-10-11 98 views
0

当我试图重新训练spacy英文模式,正如我在示例中发现,它失败:再培训Spacy依赖模型失败

Python 3.6.2 (v3.6.2:5fd33b5926, Jul 16 2017, 20:11:06) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin 
Type "help", "copyright", "credits" or "license" for more information. 
>>> import spacy 
>>> from spacy.tokens import Doc 
>>> from spacy.gold import GoldParse 
>>> 
>>> nlp = spacy.load('en') 
>>> doc = Doc(nlp.vocab, words=['Who', 'is', 'Shaka', 'Khan', '?']) 
>>> gold = GoldParse(doc, [(1, 'nsubj'), (1, 'ROOT'), (3, 'compound'), (1, 'dobj'), (1, 'punct')]) 
>>> nlp.parser(doc) 
>>> gold 
<spacy.gold.GoldParse object at 0x114008a58> 
>>> nlp.parser.update(doc, gold) 
Traceback (most recent call last): 
    File "<stdin>", line 1, in <module> 
    File "spacy/syntax/parser.pyx", line 320, in spacy.syntax.parser.Parser.update (spacy/syntax/parser.cpp:10286) 
    File "spacy/syntax/arc_eager.pyx", line 357, in spacy.syntax.arc_eager.ArcEager.preprocess_gold (spacy/syntax/arc_eager.cpp:7888) 
AttributeError: 'NoneType' object has no attribute 'upper' 

什么我错在这里做什么?任何帮助表示赞赏。

回答