Code Monkey home page Code Monkey logo

crfppftvec's Introduction

CRF++ Feature Vector Template Generator

What is this?

The crfppftvec module converts a simple feature vector notation to a CRF++ template file. This could be useful in case you want to dynamically configure and train a classifier using CRF++.

Simple notation:

word[0:3];pos[-2:3];bipos[-2:2];triword[-3:2];B

...where word[x,y] stands for token features from x to y, bipos[x,y] stands for bigram POS tag features between x and y, and triword[x,y] stands for trigram features between x and y. See here for more details on CRF++ feature templates.

Resulting CRF++ template:

U00:%x[0,0]
U01:%x[1,0]
U02:%x[2,0]
U03:%x[3,0]
U04:%x[-2,1]
U05:%x[-1,1]
U06:%x[0,1]
U07:%x[1,1]
U08:%x[2,1]
U09:%x[3,1]
U10:%x[-2,1]/%x[-1,1]
U11:%x[-1,1]/%x[0,1]
U12:%x[0,1]/%x[1,1]
U13:%x[1,1]/%x[2,1]
U14:%x[-3,0]/%x[-2,0]/%x[-1,0]
U15:%x[-2,0]/%x[-1,0]/%x[0,0]
U16:%x[-1,0]/%x[0,0]/%x[1,0]
U17:%x[0,0]/%x[1,0]/%x[2,0]
B

Usage

Use to_crfpp_template to convert simple notation to CRF++ template.

from crfppftvec import to_crfpp_template
ftvec = 'word[0:3];pos[-2:3];bipos[-2:2];triword[-3:2];B'
template = to_crfpp_template(ftvec)

Installation

Run installation script with:

$ python setup.py install

Using the template file

$ crf_learn <template_file> <train_file> <model_file>

crfppftvec's People

Contributors

savkov avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.