ValueError:基数为10的int()的无效文字:'_'

时间:2017-02-07 15:42:18

标签: python nlp stanford-nlp

我正在使用cort,一个共同解决工具包。我用安装了cort:

pip install cort

使用python版本2.7

但是,在运行文档中提到的命令时:

kenden@kenden-Lenovo-G500:~/deeshacodes$ cort-predict-conll -in test.conll \
           -model model.obj \
           -out output.conll \
           -extractor cort.coreference.approaches.mention_ranking.extract_substructures \
           -perceptron cort.coreference.approaches.mention_ranking.RankingPerceptron \
           -clusterer cort.coreference.clusterer.all_ante \

我收到了以下错误:

 File "/home/kenden/deeshacodes/deeshaenv/bin/cort-predict-conll", line 185, in <module>
    codecs.open(args.input_filename, "r", "utf-8"))
  File "/home/kenden/deeshacodes/deeshaenv/local/lib/python2.7/site-packages/cort/core/corpora.py", line 79, in from_file
    document_as_strings]))
  File "/home/kenden/deeshacodes/deeshaenv/local/lib/python2.7/site-packages/cort/core/corpora.py", line 14, in from_string
    return documents.CoNLLDocument(string)
  File "/home/kenden/deeshacodes/deeshaenv/local/lib/python2.7/site-packages/cort/core/documents.py", line 380, in __init__
    in_sentence_ids = [int(i) for i in self.__extract_from_column(2)]
ValueError: invalid literal for int() with base 10: '_'

如何在包中解决此错误?

这是github repo cort

的链接

这是我的conll文件格式: test.conll

1       Scores        _       NNS     NNS     _       4       nsubj        _       _
2       of            _       IN      IN      _       0       erased       _       _
3       properties    _       NNS     NNS     _       1       prep_of      _       _
4       are           _       VBP     VBP     _       0       root         _       _
5       under         _       IN      IN      _       0       erased       _       _
6       extreme       _       JJ      JJ      _       8       amod         _       _
7       fire          _       NN      NN      _       8       nn           _       _
8       threat        _       NN      NN      _       4       prep_under   _       _
9       as            _       IN      IN      _      13       mark         _       _
10      a             _       DT      DT      _      12       det          _       _
11      huge          _       JJ      JJ      _      12       amod         _       _
12      blaze         _       NN      NN      _      15       xsubj        _       _
13      continues     _       VBZ     VBZ     _       4       advcl        _       _
14      to            _       TO      TO      _      15       aux          _       _
15      advance       _       VB      VB      _      13       xcomp        _       _
16      through       _       IN      IN      _       0       erased       _       _
17      Sydney        _       NNP     NNP     _      20       poss         _       _
18      's            _       POS     POS     _       0       erased       _       _
19      north-western _       JJ      JJ      _      20       amod         _       _
20      suburbs       _       NNS     NNS     _      15       prep_through _       _
21      .             _       .       .       _       4       punct        _       _

0 个答案:

没有答案