NGRAMSHRINK(1)
β¨ NGRAMSHRINK β¨
okay bestie, gather round, because this is the manual page for ngramshrink β a User Commands legend, version 1.3.17, and it is lowkey doing the most for your language models π
π NAME π
ngramshrink β the manual page for ngramshrink 1.3.17, no cap.
π¦ DESCRIPTION π¦
She shrinks your n-gram model. You hand her an input model file, she hands you back a smaller one. That's the whole vibe. Iconic, honestly.
Here's how you call her:
Usage: ngramshrink [--options] [in.fst [out.fst]]
So like: some options, then optionally in.fst, then optionally out.fst. Simple as. πΈ
π PROGRAM FLAGS π
These are the flags that are hers, the main character ones:
--backoff_labelβ type =int64_t, default =0. The backoff label. That's it, that's the whole description, she said what she said.--check_consistencyβ type =bool, default =false. Checks whether the model is consistent. Vibe check for your model, fr fr.--context_patternβ type =std::string, default ="". The pattern of contexts to prune.--count_patternβ type =std::string, default ="". The pattern of counts to prune.--list_fileβ type =std::string, default ="". A file holding the list of n-grams to prune. It's giving "I made a hit list and I'm sticking to it" π--methodβ type =std::string, default ="seymore". Pick your fighter β one of:"context_prune","count_prune","relative_entropy","seymore","list_prune". Default is"seymore"because she's that girl.--min_order_to_pruneβ type =int32_t, default =2. The minimum n-gram order that's allowed to get pruned. Don't come for the little ones, bestie.--norm_epsβ type =double, default =0.001. The epsilon used for the normalization check. Tiny little tolerance, so precise β¨--retry_downcaseβ type =bool, default =false. If a pruned symbol isn't found in the FST, she automatically tries the lower-cased variant of that symbol. β οΈ Heads up: this is only useful inlist_prunemode. Don't be out here using it elsewhere and expecting magic.--shrink_optβ type =int32_t, default =0. Optimization level, and it's a range:0(fastest) all the way to2(most accurate). Pick your speed/accuracy tradeoff, queen.--target_number_of_ngramsβ type =int64_t, default =-1. The maximum number of ngrams you want left in the model after pruning. And listen: a value less than zero means there's no target number at all β she just usestheta. π―--thetaβ type =double, default =0. The pruning threshold theta. The sacred number.--total_unigram_countβ type =double, default =-1. The total unigram count.
π§ LIBRARY FLAGS π§
Now the library side of the family. These come in little friend groups (by source file), and I'm presenting them exactly as they come, no skips.
π Flags from: flags.cc
--helpβ type =bool, default =false. Shows usage information. Your bestie when you're lost π--helpshortβ type =bool, default =false. Shows brief usage information. The tl;dr version.--tmpdirβ type =std::string, default ="/tmp". The 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. Writes FST data aligned where appropriate. Alignment matters, periodt.--fst_default_cache_gcβ type =bool, default =true. Enables garbage collection of the cache. Taking out the trash ποΈβ¨--fst_default_cache_gc_limitβ type =int64_t, default =1048576. The cache byte size that triggers garbage collection. Hit that number and GC wakes up.--fst_read_modeβ type =std::string, default ="read". The default file reading mode for mappable files.--fst_verify_propertiesβ type =bool, default =false. Verifies FST properties queried byTestProperties.--save_relabel_ipairsβ type =std::string, default ="". Saves the input relabel pairs to a file.--save_relabel_opairsβ type =std::string, default ="". Saves the output relabel pairs to a file.
π Flags from: ngram-output.cc
--end_symbolβ type =std::string, default ="</s>". The class label for sentence end.--start_symbolβ type =std::string, default ="<s>". The class label for sentence start. Matching set, we love symmetry π«Ά
π Flags from: symbol-table.cc
--fst_compat_symbolsβ type =bool, default =true. Requires symbol tables to match when appropriate. No mismatched tables on her watch.--fst_field_separatorβ type =std::string, default =" ". The set of characters used as a separator between printed fields. (Yes bestie, that default is a whole run of spaces. It's literally just spaces. Iconic.)
π Flags from: util.cc
--fst_error_fatalβ type =bool, default =true. FST errors are fatal; otherwise she returns objects flagged as bad: e.g., FSTs get thekErrorproperty set, and FST weights are not aMember().--ngram_error_fatalβ type =bool, default =true. NGram errors are fatal if true; otherwise she 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), so that nested composite weights do proper I/O. β οΈ It must have size0(meaning none) or2(meaning open and close parenthesis). No in-between, she's strict about it.--fst_weight_separatorβ type =std::string, default =",". The character separator between printed composite weights. β οΈ And it must be a single character. One. Not two.
π«Ά Reminder bestie: this page is literally just the manual forngramshrink1.3.17from the User Commands section. Everything above is the whole tea. No more, no less, no invented lore. π
and that's a wrap!! π this little masterpiece shipped as ngramshrink 1.3.17 back in February 2022, living in the NGRAMSHRINK(1) section of the manual β go shrink some n-grams, you absolute legend πβ¨
π¦ 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