|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object cc.mallet.fst.semi_supervised.tui.SimpleTaggerWithConstraints
public class SimpleTaggerWithConstraints
Version of SimpleTagger that trains CRFs with expectation constraints rather than labeled data. This class's main method trains, tests, or runs a generic CRF-based sequence tagger.
Training and test files consist of blocks of lines, one block for each instance,
separated by blank lines. Each block of lines should have the first form
specified for the input of SimpleTagger.SimpleTaggerSentence2FeatureVectorSequence
.
A variety of command line options control the operation of the main program, as
described in the comments for main
.
Method Summary | |
---|---|
static Sequence[] |
apply(Transducer model,
Sequence input,
int k)
Apply a transducer to an input sequence to produce the k highest-scoring output sequences. |
static CRF |
getCRF(InstanceList training,
int[] orders,
java.lang.String defaultLabel,
java.lang.String forbidden,
java.lang.String allowed,
boolean connected)
|
static void |
main(java.lang.String[] args)
Command-line wrapper to train, test, or run a generic CRF-based tagger. |
static void |
test(TransducerTrainer tt,
TransducerEvaluator eval,
InstanceList testing)
Test a transducer on the given test data, evaluating accuracy with the given evaluator |
static CRF |
trainGE(InstanceList training,
InstanceList testing,
java.util.ArrayList<GEConstraint> constraints,
CRF crf,
TransducerEvaluator eval,
int iterations,
double var,
int resets)
Create and train a CRF model from the given training data, optionally testing it on the given test data. |
static CRF |
trainPR(InstanceList training,
InstanceList testing,
java.util.ArrayList<PRConstraint> constraints,
CRF crf,
TransducerEvaluator eval,
int iterations,
double var)
Create and train a CRF model from the given training data, optionally testing it on the given test data. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static CRF trainGE(InstanceList training, InstanceList testing, java.util.ArrayList<GEConstraint> constraints, CRF crf, TransducerEvaluator eval, int iterations, double var, int resets)
training
- training datatesting
- test data (possibly null
)constraints
- constraintscrf
- modeleval
- accuracy evaluator (possibly null
)iterations
- number of training iterationsvar
- Gaussian prior varianceresets
- Number of resets.
public static CRF trainPR(InstanceList training, InstanceList testing, java.util.ArrayList<PRConstraint> constraints, CRF crf, TransducerEvaluator eval, int iterations, double var)
training
- training datatesting
- test data (possibly null
)constraints
- constraintscrf
- modeleval
- accuracy evaluator (possibly null
)iterations
- number of training iterationsvar
- Gaussian prior variance
public static CRF getCRF(InstanceList training, int[] orders, java.lang.String defaultLabel, java.lang.String forbidden, java.lang.String allowed, boolean connected)
public static void test(TransducerTrainer tt, TransducerEvaluator eval, InstanceList testing)
model
- a Transducer
eval
- accuracy evaluatortesting
- test datapublic static Sequence[] apply(Transducer model, Sequence input, int k)
model
- the Transducer
input
- the input sequencek
- the number of answers to return
public static void main(java.lang.String[] args) throws java.lang.Exception
args
- the command line arguments. Options (shell and Java quoting should be added as needed):
--help
booleantrue
for longer documentation. Default is false
.--prefix-code
Java-code--gaussian-variance
positive-number--train
booleanfalse
.--iterations
positive-integer--test
lab
or seg=
start-1.
continue-1,
...,
start-n.
continue-n--training-proportion
number-between-0-and-1--model-file
filename--random-seed
integer--orders
comma-separated-integers--forbidden
regular-expression,
label-2 matches the expression, the corresponding transition is forbidden. Default is \\s
(nothing forbidden).--allowed
regular-expression,
label-2 does not match the expression, the corresponding expression is forbidden. Default is .*
(everything allowed).--default-label
stringO
.--viterbi-output
booleanfalse
.--fully-connected
booleantrue
.--weights
sparse|some-dense|densesome-dense
.--n-best
positive-integer--include-input
booleanfalse
.--threads
positive-integerjava.lang.Exception
- if an error occurs
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |