hidden-ngram - tag hidden events between words
hidden-ngram [ -help ] option ...
tags a stream of word tokens with hidden events occurring between words.
For example, an unsegmented text could be tagged for sentence boundaries
(the hidden events in this case being `boundary' and `no-boundary').
The most likely hidden tag sequence consistent with the given word
sequence is found according to an N-gram language model over both
words and hidden tags.
is a generalization of
Each filename argument can be an ASCII file, or a
compressed file (name ending in .Z or .gz), or ``-'' to indicate
Print option summary.
Print version information.
- -text file
Specifies the file containing the word sequences to be tagged
(one sentence per line).
Start- and end-of-sentence tags are
added by the program, but should be included in the input if the
language model uses them.
- -escape string
Set an ``escape string.''
Input lines starting with
are not processed and passed unchanged to stdout instead.
This allows associated information to be passed to scoring scripts etc.
- -text-map file
Read the input words from a map file contain both the words and
additional likelihoods of events following each word.
Each line contains one input word, plus optional hidden-event/likelihood
pairs in the format
w e1 [p1] e2 [p2] ...
If a p value is omitted a likelihood of 1 is assumed.
All events not explicitly listed are given likelihood 0, and are
hence excluded for that word.
In particular, the label
must be listed to allow absence of a hidden event.
Input word strings are assembled from multiple lines of
input until either an end-of-sentence token </s> is found, or an escaped
Interpret numeric values in the
file as log probabilities, rather
- -lm file
Specifies the word/tag language model as a standard ARPA N-gram backoff model
- -use-server S
Use a network LM server (typically implemented by
option) as the main model.
The server specification
can be an unsigned integer port number (referring to a server port running on
the local host),
a hostname (referring to default port 2525 on the named host),
or a string of the form
is a portnumber and
is either a hostname ("dukas.speech.sri.com")
or IP number in dotted-quad format ("22.214.171.124").
For server-based LMs, the
option limits the context length of N-grams queried by the client
(with 0 denoting unlimited length).
Hence, the effective LM order is the mimimum of the client-specified value
and any limit implemented in the server.
is specified, the arguments to the options
etc. are also interpreted as network LM server specifications provided
they contain a '@' character and do not contain a '/' character.
This allows the creation of mixtures of several file- and/or
Enables client-side caching of N-gram probabilities to eliminated duplicate
network queries, in conjunction with
This can results in a substantial speedup
but requires memory in the client that may grow linearly with the
amount of data processed.
- -order n
Set the effective N-gram order used by the language model to
Default is 3 (use a trigram model).
- -classes file
Interpret the LM as an N-gram over word classes.
The expansions of the classes are given in
Tokens in the LM that are not defined as classes in
are assumed to be plain words, so that the LM can contain mixed N-grams over
both words and word classes.
Assume a "simple" class model: each word is member of at most one word class,
and class expansions are exactly one word long.
- -mix-lm file
Read a second N-gram model for interpolation purposes.
The second and any additional interpolated models can also be class N-grams
(using the same
Interpret the files specified by
etc. as factored N-gram model specifications.
for more details.
- -lambda weight
Set the weight of the main model when interpolating with
Default value is 0.5.
- -mix-lm2 file
- -mix-lm3 file
- -mix-lm4 file
- -mix-lm5 file
- -mix-lm6 file
- -mix-lm7 file
- -mix-lm8 file
- -mix-lm9 file
Up to 9 more N-gram models can be specified for interpolation.
- -mix-lambda2 weight
- -mix-lambda3 weight
- -mix-lambda4 weight
- -mix-lambda5 weight
- -mix-lambda6 weight
- -mix-lambda7 weight
- -mix-lambda8 weight
- -mix-lambda9 weight
These are the weights for the additional mixture components, corresponding
The weight for the
model is 1 minus the sum of
- -context-priors file
Read context-dependent mixture weight priors from
Each line in
should contain a context N-gram (most recent word first) followed by a vector
of mixture weights whose length matches the number of LMs being interpolated.
- -bayes length
Interpolate models using posterior probabilities
based on the likelihoods of local N-gram contexts of length
values are used as prior mixture weights in this case.
This option can also be combined with
in which case the
parameter also controls how many words of context are maximally used to look up
is used without
the context length used is set by the
option and Bayesian interpolation is disabled, as when
(see next) is zero.
- -bayes-scale scale
Set the exponential scale factor on the context likelihood in conjunction
Default value is 1.0.
- -lmw W
Scales the language model probabilities by a factor
Default language model weight is 1.
- -mapw W
Scales the likelihood map probability by a factor
Default map weight is 1.
Map vocabulary to lowercase, removing case distinctions.
- -vocab file
Initialize the vocabulary for the LM from
This is useful in conjunction with
- -vocab-aliases file
Reads vocabulary alias definitions from
consisting of lines of the form
This causes all tokens
to be mapped to
- -hidden-vocab file
Read the list of hidden tags from
Note: This is a subset of the vocabulary contained in the language model.
Discard LM parameters on reading that do not pertain to the words
specified in the vocabulary, either by
The default is that words used in the LM are automatically added to the
This option can be used to reduce the memory requirements for large LMs
that are going to be evaluated only on a small vocabulary subset.
Forces a non-default event after every word.
This is useful for language models that represent the default event
explicitly with a tag, rather than implicitly by the absence of a tag
between words (which is the default).
Do not map unknown input words to the <unk> token.
Instead, output the input word unchanged.
Also, with this option the LM is assumed to be open-vocabulary
(the default is close-vocabulary).
Perform forward-backward decoding of the input token sequence.
Outputs the tags that have the highest posterior probability,
for each position.
The default is to use Viterbi decoding, i.e., the output is the
tag sequence with the highest joint posterior probability.
but uses only the forward probabilities for computing posteriors.
This may be used to simulate on-line prediction of tags, without the
benefit of future context.
Process all words in the input as one sequence of words, irrespective of
Normally each line is processed separately as a sentence.
Input tokens are output one-per-line, followed by event tokens.
Output the table of posterior probabilities for each
is also specified the posterior probabilities will be computed using
forward-backward probabilities; otherwise an approximation will be used
that is based on the probability of the most likely path containing
a given tag at given position.
Output the total string probability for each input sentence.
is also specified this probability is obtained by summing over all
hidden event sequences; otherwise it is calculated (i.e., underestimated)
using the most probably hidden event sequence.
- -nbest N
best hypotheses instead of just the first best when
doing Viterbi search.
then each hypothesis is prefixed by the tag
is the rank of the hypothesis in the N-best list and
its score, the negative log of the combined probability of transitions
and observations of the corresponding HMM path.
- -write-counts file
Write the posterior weighted counts of n-grams, including those
with hidden tags, summed over the entire input data, to
The posterior probabilities should normally be computed with the
forward-backward algorithm (instead of Viterbi), so the
option is usually also specified.
Only n-grams whose contexts occur in the language model are output.
- -unk-prob L
Specifies that unknown words and other words having zero probability in
the language model be assigned a log probability of
This is -100 by default but might be set to 0, e.g., to compute
perplexities excluding unknown words.
Sets debugging output level.
Each filename argument can be an ASCII file, or a compressed
file (name ending in .Z or .gz), or ``-'' to indicate
options effectively disable
i.e., unknown input words are always mapped to <unk>.
doesn't preserve the positions of escaped input lines relative to
The dynamic programming for event decoding is not efficiently interleaved
with that required to evaluate class N-gram models;
therefore, the state space generated
in decoding with
quickly becomes infeasibly large unless
is also specified.
The file given by
is read multiple times if
is in effect or if a mixture of LMs is specified.
This will lead to incorrect behavior if the argument of
is stdin (``-'').
ngram(1), ngram-count(1), disambig(1), segment(1),
A. Stolcke et al., ``Automatic Detection of Sentence Boundaries and
Disfluencies based on Recognized Words,''
Proc. ICSLP, 2247-2250, Sydney.
Andreas Stolcke <email@example.com>,
Anand Venkataraman <firstname.lastname@example.org>.
Copyright 1998-2006 SRI International