write_megam_file(train_toks,
encoding,
stream,
bernoulli=True,
explicit=True)
| source code
|
Generate an input file for megam based on the given
corpus of classified tokens.
- Parameters:
train_toks (list of tuples of (dict ,
str )) - Training data, represented as a list of pairs, the first member
of which is a feature dictionary, and the second of which is a
classification label.
encoding (MaxentFeatureEncodingI) - A feature encoding, used to convert featuresets into feature
vectors.
stream (stream ) - The stream to which the megam input file should be written.
bernoulli - If true, then use the 'bernoulli' format. I.e., all joint
features have binary values, and are listed iff they are true.
Otherwise, list feature values explicitly. If
bernoulli=False , then you must call
megam with the -fvals option.
explicit - If true, then use the 'explicit' format. I.e., list the features
that would fire for any of the possible labels, for each token.
If explicit=True , then you must call
megam with the -explicit option.
|