我是CRF ++的新手.我正在教自己查看它的手册:http: //crfpp.googlecode.com/svn/trunk/doc/index.html?source = navbar#templ
我不明白这意味着什么:
这是一个描述unigram功能的模板.当你给一个
模板"U01:%x [0,1]",CRF ++自动生成一组功能
函数(func1 ... funcN)如:
func1 = if(output = B-NP and feature ="U01:DT")返回1否则返回0
func2 = if(output = I-NP and feature ="U01:DT")返回1否则返回0
func3 = if(output = O and feature ="U01:DT")返回1否则返回0
.... funcXX = if(output = B-NP and feature ="U01:NN")返回1否则返回0
funcXY = if(output = O and feature ="U01:NN")return 1 else return 0.模板生成的要素函数数量
等于(L*N),其中L是输出的数量
为什么Unigram功能有很多行,它们是什么意思?
小智 9
在查看文档足够长的时间后,我想我已经弄明白了.
以输入数据所在的文档为例:
He PRP B-NP
reckons VBZ B-VP
the DT B-NP
current JJ I-NP
account NN I-NP
Run Code Online (Sandbox Code Playgroud)
和问题的特征模板(格式%x[row, col],row相对于当前位置)%x[0,1]
当%x[0,1]膨胀时,根据当前令牌时,它可以扫描该组内的字符串中的一个[PRP, VBZ, DT, JJ, NN](即,从第1列,其中最左边的列是列0的唯一的字符串中的一个).对于这些字符串中的每一个,它都会创建一组表单的要素函数(查看第三行输入数据):
func1 = if (output = B-NP and feature="U01:DT") return 1 else return 0
func2 = if (output = I-NP and feature="U01:DT") return 1 else return 0
func3 = if (output = O and feature="U01:DT") return 1 else return 0
...
Run Code Online (Sandbox Code Playgroud)
将特定字符串(DT在上面的代码中)与每个输出类进行比较.
因此,如果输出类是[B-NP, I-NP, O]扩展为要素函数的要素模板,则如下所示:
# row 1 (He, PRP, B-NP)
func1 = if (output = B-NP and feature="U01:PRP") return 1 else return 0
func2 = if (output = I-NP and feature="U01:PRP") return 1 else return 0
func3 = if (output = O and feature="U01:PRP") return 1 else return 0
# row 2 (Reckons, VBZ, B-VP)
func4 = if (output = B-NP and feature="U01:VBZ") return 1 else return 0
func5 = if (output = I-NP and feature="U01:VBZ") return 1 else return 0
func6 = if (output = O and feature="U01:VBZ") return 1 else return 0
# Row 3 (the, DT, B-NP)
func7 = if (output = B-NP and feature="U01:DT") return 1 else return 0
func8 = if (output = I-NP and feature="U01:DT") return 1 else return 0
func9 = if (output = O and feature="U01:DT") return 1 else return 0
# Row 4 (current, JJ, I-NP)
func10 = if (output = B-NP and feature="U01:JJ") return 1 else return 0
func11 = if (output = I-NP and feature="U01:JJ") return 1 else return 0
func12 = if (output = O and feature="U01:JJ") return 1 else return 0
# Row 5 (account, NN, I-NP)
func13 = if (output = B-NP and feature="U01:NN") return 1 else return 0
func14 = if (output = I-NP and feature="U01:NN") return 1 else return 0
func15 = if (output = O and feature="U01:NN") return 1 else return 0
Run Code Online (Sandbox Code Playgroud)
关于文件提到的地方:
模板生成的要素函数的数量等于(L*N),其中L是输出类的数量,N是从给定模板扩展的唯一字符串的数量.
在这种情况下,L将是3,N将是5.
对于特定模板 %x[i,j],i 表示到当前位置的偏移量(行),j 表示要使用的特征(列)。\n给定数据:
\n\nHe PRP B-NP\n\nreckons VBZ B-VP\n\nthe DT B-NP\n\ncurrent JJ I-NP << CURRENT TOKEN\n\naccount NN I-NP\nRun Code Online (Sandbox Code Playgroud)\n\n%x[0,1] 指的是单词,当前单词的偏移量为0,其pos 标记为JJ,其输出标记为I-NP。
\n\n移动远字,%x[0, 1] -> pos 标记 = NN\xef\xbc\x8c 输出标记 = I-NP
\n\n每个特征函数指的是当前单词及其pos标签的一对可能值。
\n\n更新:
\n\n我认为如果你很好地理解 CRF 模型的话,上面的解释是相当简单的。
\n\n\n\nCRF++ 是Sha 和 Pereira (2003)的复制
\n