How can I covert data from CoNLL format to spacy format?
I’ve executed current code following similar Q&A on stackoverflow: How to convert from CoNLL format to spacy format.
CoNLL
I O was O born O in O 1981 B-DateTime . O
spacyformat
[('I was born in 1981.', {'entities': [(14, 17, 'date')]}), ... ]
However, I cannot fix the error.
Code
$ python3 -m spacy convert input.conllu -c conllu -o ./output/
Error Message
I’ve read the document, spacy convert, but have no idea how to fix the error.
Usage: python -m spacy convert [OPTIONS] INPUT_PATH [OUTPUT_DIR] Try 'python -m spacy convert --help' for help. Error: no such option: -o
Environment
Python 3.9.1
spaCy version 3.1.1
Advertisement
Answer
Well your first problem is exactly what the error says, there is no -o
option. The output is just the argument after the input. (I see that in my other answer I put an -o
, but that was a mistake.)
Your second problems is that conll
and conllu
format are not the same thing. The two-column format you have is referred to as conll (or just ner
) in spaCy.
If you fix those issues the conversion should just work.
I am not sure what your spacyFormat
line is referring to.