3

I'm very new in CRF and I want to use CRFsuite to tag words. I read CRFsuite's manual and understand the format of the training data, but if I want to add some features which have some tags of "near words", what's the training data file look like?

I have google around but I found nothing about this problem.

Franck Dernoncourt
  • 77,520
  • 72
  • 342
  • 501
D. Luffy
  • 51
  • 5
  • Can you give an example of what you mean by "near words"? – Mzzzzzz Mar 24 '14 at 23:25
  • For example, I want to pos-tagging the sentence "Bob drank coffee at Starbucks" and want to build some features which have parameter is previous word's tag. Ex: To tag the work "coffee", I can use information about previous word(drank) and it's tag (VERB). – D. Luffy Mar 27 '14 at 03:07

1 Answers1

2

The short answer is that you supply attributes of the word coffee (like w[-1]=drank to indicate the previous word) and its label (NOUN), and CRFsuite generates the actual indicator functions that compose the CRF model (including a feature that indicates that the label of the previous word is VERB). It knows to do this because it uses a "1st-order Markov CRF with dyad features," as described on the manual page you linked to.

One distinction that's important to make (and that the documentation could be more precise about) is the difference between "features" and "attributes" where features are links in the model that represent either (attribute, label) or (label, label) pairs.

So in your example, w[-1]=drank is an attribute that you supply. The combination of w[-1]=drank, NOUN is a state feature and the transition between labels VERB --> NOUN is a transition feature, both of which are generated by CRFsuite.

I recommend the tutorial, which discusses this in more detail.

Mzzzzzz
  • 4,770
  • 7
  • 30
  • 47
  • Do you mean that the number of parameters learned by CRFsuite is `(n_attributes * n_labels)` + `(n_labels * n_labels)`? In general can’t the edge features also depend on the observed `X` without violating the linear-chain CRF properties - is that what is meant by "Features conditioned with attributes and label bigrams are not supported"? – akxlr Sep 08 '15 at 01:05