CoNLL-U
CoNLL-U 是 CoNLL-X 格式的修订版本。注释以纯文本文件(UTF-8 编码,规范化为 NFC 格式,使用 LF 字符作为换行符,包括文件末尾的 LF 字符)的形式进行编码,包含三种类型的行:
- Word 行,包含以单个制表符分隔的 10 个字段的单词/标记的注释;详见下文。
- 空行,标记句子边界。
- 以井号 (#) 开头的注释行。
以下是如何加载 CoNLL-U 格式文件的示例。整个文件被视为一个文档。示例数据(conllu.conllu
)基于标准 UD/CoNLL-U 示例之一。
from langchain.document_loaders import CoNLLULoader
loader = CoNLLULoader("example_data/conllu.conllu")
document = loader.load()
document
[Document(page_content='They buy and sell books.', metadata={'source': 'example_data/conllu.conllu'})]