将naf格式的文件转换为conll格式的脚本
naf2conll的Python项目详细描述
氟化钠
用于将naf格式的coreference数据转换为CoNLL format的脚本。
啊!!注意!!目前,此脚本仅支持以下列:
- 1:文档ID
- 3:字数
- 4:单词本身
- 12:共指
naf支持以下conll列,但此脚本尚未(正确)处理这些列:
- 5:POS标签
- 6:选区树
- …?
- 11:命名实体
有关conll格式的详细说明,请参见CoNLL-specification.md。
用法
naf2conll.py
要自动查找包含NAF文件的所有(子)文件夹并转换这些文件夹中的所有数据,请运行:
naf2conll.py path/to/output_dir -d path/to/some/folder [-d path/to/another/folder ...]
要只转换一个文件,请运行:
naf2conll.py path/to/output.conll path/to/input.naf
conll输出列
默认情况下,仅输出列1、3、4和12。
如果选择输出更多列,则使用以下值和占位符。
Column | Description | Value | Conform CoNLL specification? |
---|---|---|---|
1 | Document ID | file path without extension | Yes |
2 | Part number | ^{ | Yes |
3 | Word number | generated | Yes |
4 | Word itself | extracted from text layer of NAF | Yes |
5 | POS | ^{ | No |
6 | Parse bit | ^{ | No |
7 | Predicate lemma | ^{ | Yes |
8 | Predicate Frameset ID | ^{ | Yes |
9 | Word sense | ^{ | Yes |
10 | Speaker/Author | ^{ | ??? |
11 | Named Entities | ^{ | Yes |
- | Predicate Arguments | None: column(s) left out entirely | Yes, conform example in CoNLL 2012 |
12 | Coreference | extracted from coreference layer of NAF (ISSUE! [1]) | Yes |
[1]:
如果引用跨距以同一个单词结尾,则它们不会以正确的顺序闭合。以下是naf2conll.py
的输出示例:
(10
-
(52|(55
52)
-
10)|55)|(133)
学究式的正确答案是:
(10
-
(55|(52
52)
-
(133)|55)|10)
问题
- []“on_missing”配置键在使用前未验证
- []当
extract_coref_sets
中没有coref层时引发错误