CRF(一):CRF++的简单使用

来源:互联网 发布:博客源码哪个好 编辑:程序博客网 时间:2024/05/11 18:17

这个是基于YouTube上一篇视频介绍的CRF++使用的简洁总结:

To train a CRF model using CRF++, you need 2 things:

A Template file : ( where you define features to be considered for training )

A Training file : (where you have data in CoNLL format ) 


The command to train is :

crf_learn  template_file train_data_file  model

(template_file: https://gist.github.com/kindleton/8898d46eb5f9f1067843ef0be76d8ecf)

(train_data_file: http://www.cnts.ua.ac.be/conll2000/chunking/)


A binary model is produced. If you want the model in text format, you need to add a flag “-t” and a model.txt is also produced. In this text file, you can see the feature weights as well.


To Test this model, on a testing data , the command is as follows :

crf_test -m model test_file > output


You can write a simple script to calculate the accuracy. Just compare the last two words of every line , if it matches .


总体上来说,学一个知识点,

先从wiki+google开始,然后阅读专业书籍,最后论文。

先从工具使用开始,然后细纠其原理。


参考:https://www.youtube.com/watch?v=LDNYT9Ai2NU


0 0