ValueError:在将IOB转换为SpaCy的JSONL时解码'true'时发现意外字符

问题描述 投票:0回答:1

我想将IOB格式的文本文件转换为具有每个令牌的开始和结束索引的SpaCy格式。

我运行此代码:

python -m spacy convert test_IOB.txt out --converter jsonl --lang English

我有错误:

ValueError: Unexpected character found when decoding 'true'

我的输入数据如下:

the O
r O
/ O
p O
( O
years O
) O
ratio O
of O
the O
sand O
is O
16 O
. O

chiaramonte O
, O
l. O
2008 O
, O
geomechanical O
characterization O
and O
reservoir O
simulation O
of O
a O
co O
sequestration O
project O
in O
a O
mature O
ofield O

谢谢!

python machine-learning nlp spacy named-entity-recognition
1个回答
1
投票

您正在调用--converter json选项,但您的输入文件不是json格式。

您应该使用--converter ner作为输入。

ner

NER,带有IOB / IOB2标签,每行一个令牌,各列之间用空格隔开。第一列是令牌,最后一列是IOB标签。句子用空白行分隔,文档用-DOCSTART- -X-O O行分隔。支持CoNLL 2003 NER格式。 See sample data

© www.soinside.com 2019 - 2024. All rights reserved.