【发布时间】:2011-07-12 23:28:37
【问题描述】:
我正在使用一些基于规则和统计的词性标注器来用词性 (POS) 标注一个语料库(大约 5000 个句子)。以下是我的测试语料库的 sn-p,其中每个单词都由其各自的 POS 标签用“/”分隔。
No/RB ,/, it/PRP was/VBD n't/RB Black/NNP Monday/NNP ./.
But/CC while/IN the/DT New/NNP York/NNP Stock/NNP Exchange/NNP did/VBD n't/RB fall/VB apart/RB Friday/NNP as/IN the/DT Dow/NNP Jones/NNP Industrial/NNP Average/NNP plunged/VBD 190.58/CD points/NNS --/: most/JJS of/IN it/PRP in/IN the/DT final/JJ hour/NN --/: it/PRP barely/RB managed/VBD *-2/-NONE- to/TO stay/VB this/DT side/NN of/IN chaos/NN ./.
Some/DT ``/`` circuit/NN breakers/NNS ''/'' installed/VBN */-NONE- after/IN the/DT October/NNP 1987/CD crash/NN failed/VBD their/PRP$ first/JJ test/NN ,/, traders/NNS say/VBP 0/-NONE- *T*-1/-NONE- ,/, *-2/-NONE- unable/JJ *-3/-NONE- to/TO cool/VB the/DT selling/NN panic/NN in/IN both/DT stocks/NNS and/CC futures/NNS ./.
标注语料后是这样的:
No/DT ,/, it/PRP was/VBD n't/RB Black/NNP Monday/NNP ./.
But/CC while/IN the/DT New/NNP York/NNP Stock/NNP Exchange/NNP did/VBD n't/RB fall/VB apart/RB Friday/VB as/IN the/DT Dow/NNP Jones/NNP Industrial/NNP Average/JJ plunged/VBN 190.58/CD points/NNS --/: most/RBS of/IN it/PRP in/IN the/DT final/JJ hour/NN --/: it/PRP barely/RB managed/VBD *-2/-NONE- to/TO stay/VB this/DT side/NN of/IN chaos/NNS ./.
Some/DT ``/`` circuit/NN breakers/NNS ''/'' installed/VBN */-NONE- after/IN the/DT October/NNP 1987/CD crash/NN failed/VBD their/PRP$ first/JJ test/NN ,/, traders/NNS say/VB 0/-NONE- *T*-1/-NONE- ,/, *-2/-NONE- unable/JJ *-3/-NONE- to/TO cool/VB the/DT selling/VBG panic/NN in/IN both/DT stocks/NNS and/CC futures/NNS ./.
我需要计算标注准确度(Tag wise-Recall & Precision),因此需要在每个词-标签对的标注中找出错误(如果有的话)。
我正在考虑的方法是遍历这两个文本文件并将它们存储在一个列表中,然后逐个元素地比较“两个”列表。
这种方法对我来说似乎很粗糙,所以希望你们对上述问题提出一些更好的解决方案。
来自wikipedia 页面:
在分类任务中, 一个类的 precision 是 真阳性(即 正确标记为属于的物品 到正类)除以 标记为的元素总数 属于正类(即 真阳性和假阳性的总和 正面,这是不正确的项目 标记为属于该类)。 Recall 在这种情况下被定义为 真阳性数除以 由元素的总数 实际上属于正类 (即真阳性和 假阴性,这是哪些项目 未被标记为属于 正类,但应该是)。
【问题讨论】:
标签: python shell nlp machine-learning text-processing