The QuickStart guide contains this example:
Linear-chain Conditional Random Field for part-of-speech tagging
http://factorie.cs.umass.edu/usersguide/UsersGuide200QuickStart.htmlobject ExampleLinearChainCRF extends App {
class Label(val str:String, val token:Token) extends LabeledCategoricalVariable(str){...}
class LabelSeq extends scala.collection.mutable.ArrayBuffer[Label]
val labelSequences: List[LabelSeq] = ...
val trainer = new BatchTrainer(model.parameters, new ConjugateGradient)
trainer.trainFromExamples(labelSequences.map(labels => new LikelihoodExample(labels, model, InferByBPChain)))
// infer
labelSequences.foreach(labels => BP.inferChainMax(labels, model))
labelSequences.foreach(_.foreach(l => println(s"Token: ${l.token.value} Label: ${l.value}")))
}
so, there is a training part and an inference part.
The inference part should taken as input a list of token, and return a list of tagged tokens (token and label).
However, in this example, the BP.inferChainMax takes as input the list of already tagged tokens.
It does not make sense to me.
Can you please explain this example?
Once we have the trained model, how we give it an input of tokens to get a list of tagged tokens?