Senna是一个使用神经网络构建的 NLP 工具,它能够:
- 词性标注
- NER标记
- 块标记
- 语义角色标签标记和
- 解析
从http://ml.nec-labs.com/senna/download.html下载预编译包后
我运行了--help
菜单,看看有哪些选项:
alvas@ubi:~/senna$ ./senna-linux64 --help
invalid argument: --help
SENNA Tagger (POS - CHK - NER - SRL)
(c) Ronan Collobert 2009
Usage: ./senna-linux64 [options]
Takes sentence (one line per sentence) on stdin
Outputs tags on stdout
Typical usage: ./senna-linux64 [options] < inputfile.txt > outputfile.txt
Display options:
-h Display this help
-verbose Display model informations on stderr
-notokentags Do not output tokens
-offsettags Output start/end offset of each token
-iobtags Output IOB tags instead of IOBES
-brackettags Output 'bracket' tags instead of IOBES
Data options:
-path <path> Path to the SENNA data/ and hash/ directories [default: ./]
Input options:
-usrtokens Use user's tokens (space separated) instead of SENNA tokenizer
SRL options:
-posvbs Use POS verbs instead of SRL style verbs for SRL task
-usrvbs <file> Use user's verbs (given in <file>) instead of SENNA verbs for SRL task
Tagging options:
-pos Output POS
-chk Output CHK
-ner Output NER
-srl Output SRL
-psg Output PSG
命令行界面很简单,POS 和 NER 标签的输出也很容易解释。
鉴于此输入:
alvas@ubi:~/senna$ cat test.in
Foo went to eat bar at the Foobar.
这是标准的 Penn Treebank 标签集:
alvas@ubi:~/senna$ ./senna-linux64 -pos < test.in
Foo NNP
went VBD
to TO
eat VB
bar NN
at IN
the DT
Foobar NNP
. .
这是BIO 标签集:
alvas@ubi:~/senna$ ./senna-linux64 -ner < test.in
Foo S-PER
went O
to O
eat O
bar O
at O
the O
Foobar S-LOC
. O
对于分块,它也是我们习惯的某种BIOE 标签集:
alvas@ubi:~/senna$ ./senna-linux64 -chk < test.in
Foo S-NP
went B-VP
to I-VP
eat E-VP
bar S-NP
at S-PP
the B-NP
Foobar E-NP
. O
但是S-
标签是什么意思?似乎它只附加到单个令牌块的令牌上,这是真的吗?
SRL 标签有点奇怪,它们是每个标记的多个注释:
alvas@ubi:~/senna$ ./senna-linux64 -srl < test.in
Foo - S-A1 S-A0
went went S-V O
to - B-AM-PNC O
eat eat I-AM-PNC S-V
bar - I-AM-PNC S-A1
at - I-AM-PNC B-AM-LOC
the - I-AM-PNC I-AM-LOC
Foobar - E-AM-PNC E-AM-LOC
. - O O
看起来像我们从语义框架中获得的“类似元组”的输出,但我不理解约定,例如什么是-AM-
?什么是-PNC
?
输出是什么意思,我们应该如何解释它?
对于解析器输出:
alvas@ubi:~/senna$ ./senna-linux64 -psg < test.in
Foo (S1(S(NP*)
went (VP*
to (S(VP*
eat (VP*
bar (ADVP*)
at (PP*
the (NP*
Foobar *))))))
. *))
它看起来像我们在解析中看到的括号中的解析输出,但这是什么*
意思?