跳到主要内容
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'})]