Skip to main content
Open In ColabOpen on GitHub

CoNLL-U

CoNLL-U 是 CoNLL-X 格式的修订版本。注释以纯文本文件进行编码(UTF-8,归一化为 NFC,使用 LF 字符作为行结束符,并在文件末尾包含一个 LF 字符),其中包含三种类型的行:

  • 单词行包含一个词/标记在10个字段中的注释,这些字段由单个制表符分隔;具体如下。
  • 空白行标记句子边界。
  • #.

这展示了如何加载CoNLL-U格式的文件。整个文件被视为一个文档。示例数据(conllu.conllu)基于UD/CoNLL-U标准的一个例子。

from langchain_community.document_loaders import CoNLLULoader
API 参考: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'})]