NGRAMCOUNT(1)
π NGRAMCOUNT π
okay bestie, gather round, because this is ngramcount β the manual page for ngramcount version 1.3.17. she counts n-grams. that's the whole thing. she's an icon, she's efficient, she's literally just vibing and tallying up n-grams from an input file. no cap.
β¨ DESCRIPTION β¨
Count n-grams from input file. yes ma'am, that's the job. that's what we do here. π
the usage, verbatim, because you will be typing this:
Usage: ngramcount [--options] [in.far [out.fst]]
so you hand her an optional in.far, and optionally an out.fst, and you get counts. gorgeous.
π PROGRAM FLAGS π
these are the main character flags, the ones specific to ngramcount herself. every single one, no skipping, i promised:
--add_to_symbol_unigram_countβ type =double, default =0. adds this amount to the unigram count of every single word in the symbol table. little boost for everybody, we love to see it.--alphaβ type =double, default =1. the weight for the first FST.--backoff_labelβ type =int64_t, default =0. the backoff label. simple as that.--betaβ type =double, default =1. weight for the second (and subsequent) FST(s). so if you've got a whole lineup of FSTs, alpha takes the first, beta takes the rest of the squad.--check_consistencyβ type =bool, default =false. checks model consistency. she's doing a vibe check on your model.--context_patternβ type =std::string, default ="". pattern of contexts to count.--epsilon_as_backoffβ type =bool, default =false. treats epsilon in the input Fsts as backoff. (capital-F "Fsts" β that's how the manpage says it, i'm not gonna lie to you π )--methodβ type =std::string, default ="counts". one of:"counts","histograms","count_of_counts","count_of_histograms". pick your fighter.--norm_epsβ type =double, default =0.001. the normalization check epsilon.--normalizeβ type =bool, default =false. normalizes the resulting model. glow-up for your output.--orderβ type =int64_t, default =3. sets the maximal order of ngrams to be counted. default three, because trigrams are that girl.--output_fstβ type =bool, default =true. outputs counts as fst β otherwise strings. so if you turn this off you're getting strings, bestie, fair warning.--require_symbolsβ type =bool, default =true. require symbol tables? (default: yes) β the manpage literally answers its own question here, obsessed.--round_to_intβ type =bool, default =false. rounds all counts to integers. no more decimals, no more crumbs.
π¦ LIBRARY FLAGS π¦
these are the shared ones, grouped by which file they came from. keeping them all in their little friend groups because that's how the original does it and we respect the source material. periodt.
flags from: compile-strings.cc
--far_field_separatorβ type =std::string, default:
"
"
(set of characters used as a separator between printed fields β and yes, that default really is a literal newline chillin' inside the quotes. she contains multitudes. π)
flags from: flags.cc
--helpβ type =bool, default =false. show usage information.--helpshortβ type =bool, default =false. show brief usage information. the tl;dr version, for when you're in a rush.--tmpdirβ type =std::string, default ="/tmp". temporary directory.--vβ type =int32_t, default =0. verbosity level. crank it up if you want her to talk more.
flags from: fst.cc
--fst_alignβ type =bool, default =false. write FST data aligned where appropriate.--fst_default_cache_gcβ type =bool, default =true. enable garbage collection of cache.--fst_default_cache_gc_limitβ type =int64_t, default =1048576. the cache byte size that triggers garbage collection. that's1048576bytes exactly, don't @ me.--fst_read_modeβ type =std::string, default ="read". default file reading mode for mappable files.--fst_verify_propertiesβ type =bool, default =false. verify FST properties queried byTestProperties.--save_relabel_ipairsβ type =std::string, default ="". save input relabel pairs to file.--save_relabel_opairsβ type =std::string, default ="". save output relabel pairs to file.
flags from: ngram-output.cc
--end_symbolβ type =std::string, default ="</s>". class label for sentence end.--start_symbolβ type =std::string, default ="<s>". class label for sentence start.
flags from: symbol-table.cc
--fst_compat_symbolsβ type =bool, default =true. require symbol tables to match when appropriate.--fst_field_separatorβ type =std::string, default =" ". set of characters used as a separator between printed fields.
flags from: util.cc
--fst_error_fatalβ type =bool, default =true. FST errors are fatal; o.w. return objects flagged as bad: e.g., FSTs:kErrorproperty set, FST weights: not aMember().--ngram_error_fatalβ type =bool, default =true. NGram errors are fatal if true; otherwise returns objects flagged as bad: e.g.,NGramModel::Error()is true.
flags from: weight.cc
--fst_weight_parenthesesβ type =std::string, default ="". characters enclosing the first weight of a printed composite weight (e.g., pair weight, tuple weight and derived classes) to ensure proper I/O of nested composite weights; must have size0(none) or2(open and close parenthesis). so it's nothing or it's a matched pair, no in-between, she does not do half measures. π--fst_weight_separatorβ type =std::string, default =",". character separator between printed composite weights; must be a single character. one character, bestie. one. that's the rule.
π real talk:--fst_error_fataland--ngram_error_fatalboth default totrue, which means errors are fatal unless you flip them. so if things go boom, that's not a bug, that's the default configuration doing exactly what it promised. adjust accordingly.
and that's the whole page, start to finish, nothing skipped. π«Ά
sign-off time: this is ngramcount version 1.3.17, dated February 2022. she's out here being a User Command and she ate, fr fr. go count some n-grams, bestie. πβ¨ππ¦
π¦ where this page comes from
- fedora 44: opengrm-ngram-tools 1.3.17-2.fc44 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms