public class SimpleTagger extends Object
SimpleTagger.SimpleTaggerSentence2FeatureVectorSequence. A variety of
command line options control the operation of the main program, as
described in the comments for main.| Modifier and Type | Class and Description |
|---|---|
static class |
SimpleTagger.SimpleTaggerSentence2FeatureVectorSequence
Converts an external encoding of a sequence of elements with binary
features to a
FeatureVectorSequence. |
| Modifier and Type | Method and Description |
|---|---|
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 void |
main(String[] args)
Command-line wrapper to train, test, or run a generic CRF-based tagger.
|
static void |
test(Transducer model,
TransducerEvaluator eval,
InstanceList testing)
Test a transducer on the given test data, evaluating accuracy
with the given evaluator
|
static CRF4 |
train(InstanceList training,
InstanceList testing,
TransducerEvaluator eval,
int[] orders,
String defaultLabel,
String forbidden,
String allowed,
boolean connected,
int iterations,
double var,
CRF4 crf)
Create and train a CRF model from the given training data,
optionally testing it on the given test data.
|
public static CRF4 train(InstanceList training, InstanceList testing, TransducerEvaluator eval, int[] orders, String defaultLabel, String forbidden, String allowed, boolean connected, int iterations, double var, CRF4 crf)
training - training datatesting - test data (possibly null)eval - accuracy evaluator (possibly null)orders - label Markov orders (main and backoff)defaultLabel - default labelforbidden - regular expression specifying impossible label
transitions current,next
(null indicates no forbidden transitions)allowed - regular expression specifying allowed label transitions
(null indicates everything is allowed that is not forbidden)connected - whether to include even transitions not
occurring in the training data.iterations - number of traning iterationsvar - Gaussian prior variancepublic static void test(Transducer model, TransducerEvaluator eval, InstanceList testing)
model - a Transducereval - accuracy evaluatortesting - test datapublic static Sequence[] apply(Transducer model, Sequence input, int k)
model - the Transducerinput - the input sequencek - the number of answers to returnpublic static void main(String[] args) throws 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.--n-best positive-integer--include-input booleanfalse.Exception - if an error occursCopyright © 2019 JULIE Lab, Germany. All rights reserved.