mirror of https://github.com/doccano/doccano.git
pythondatasetsactive-learningtext-annotationdatasetnatural-language-processingdata-labelingmachine-learningannotation-tool
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
808 B
40 lines
808 B
from .catalog import (
|
|
CSV,
|
|
JSON,
|
|
JSONL,
|
|
AudioFile,
|
|
CoNLL,
|
|
Excel,
|
|
FastText,
|
|
Format,
|
|
ImageFile,
|
|
TextFile,
|
|
TextLine,
|
|
)
|
|
from .parsers import (
|
|
CoNLLParser,
|
|
CSVParser,
|
|
ExcelParser,
|
|
FastTextParser,
|
|
JSONLParser,
|
|
JSONParser,
|
|
LineParser,
|
|
PlainParser,
|
|
TextFileParser,
|
|
)
|
|
|
|
|
|
def create_parser(file_format: Format, **kwargs):
|
|
mapping = {
|
|
TextFile.name: TextFileParser,
|
|
TextLine.name: LineParser,
|
|
CSV.name: CSVParser,
|
|
JSONL.name: JSONLParser,
|
|
JSON.name: JSONParser,
|
|
FastText.name: FastTextParser,
|
|
Excel.name: ExcelParser,
|
|
CoNLL.name: CoNLLParser,
|
|
ImageFile.name: PlainParser,
|
|
AudioFile.name: PlainParser,
|
|
}
|
|
return mapping[file_format.name](**kwargs)
|