Failed to convert iob to spaCy binary format(无法将IOB转换为SPACY二进制格式)
本文介绍了无法将IOB转换为SPACY二进制格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试将IOB(每行令牌NER)文件(训练/测试)转换为Spacy 3二进制格式。
输入格式示例(带分隔符";";,无空格,编码utf-8):
Département B-LOCATION
des I-LOCATION
Bouches-du-Rhône I-LOCATION
. O
Port B-INSTALLATION
de I-INSTALLATION
la I-INSTALLATION
Ciotat I-INSTALLATION
. O
Avant-projet O
du O
môle B-INSTALLATION
Bérouard I-INSTALLATION
au O
port B-INSTALLATION
de I-INSTALLATION
La I-INSTALLATION
Ciotat I-INSTALLATION
. O
当我运行时:
!python -m spacy convert -c iob -s -n 10 -b fr_core_news_sm /content/ner4archives_v0_train.iob .
!python -m spacy convert -c iob -s -n 10 -b fr_core_news_sm /content/ner4archives_v0_test.iob .
我有此错误:
ValueError: [E903] The token-per-line NER file is not formatted correctly. Try checking whitespace and delimiters. See https://spacy.io/api/cli#convert
我看到了包含示例数据的git目录:https://github.com/explosion/spaCy/tree/master/extra/example_data/ner_example_data;但我找不到我的数据和示例之间的区别。
我尝试使用不同类型的分隔符(";";、";";、";|";)重新格式化我的文件,但总是出现相同的错误。此外,我还测试了是否有空的令牌或标签。有线索的人吗?提前谢谢。
推荐答案
我认为您使用的是3.X
以外的版本,我可以使用您的输入创建.spacy
二进制文件,下载后没有任何问题。fr_core_news_sm
。
命令:
python -m spacy convert -c iob -s -n 10 -b fr_core_news_sm C:/git/sof/test.iob .
输出:
[i] Auto-detected token-per-line NER format
[i] Grouping every 10 sentences into a document.
[i] Segmenting sentences with parser from model 'fr_core_news_sm'.
[+] Generated output file (1 documents): test.spacy
拼写版本:3.1.3
这篇关于无法将IOB转换为SPACY二进制格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
沃梦达教程
本文标题为:无法将IOB转换为SPACY二进制格式


基础教程推荐
猜你喜欢
- PANDA VALUE_COUNTS包含GROUP BY之前的所有值 2022-01-01
- PermissionError: pip 从 8.1.1 升级到 8.1.2 2022-01-01
- 在Python中从Azure BLOB存储中读取文件 2022-01-01
- 在同一图形上绘制Bokeh的烛台和音量条 2022-01-01
- 包装空间模型 2022-01-01
- 求两个直方图的卷积 2022-01-01
- 无法导入 Pytorch [WinError 126] 找不到指定的模块 2022-01-01
- Plotly:如何设置绘图图形的样式,使其不显示缺失日期的间隙? 2022-01-01
- 使用大型矩阵时禁止 Pycharm 输出中的自动换行符 2022-01-01
- 修改列表中的数据帧不起作用 2022-01-01