ngrams(3pm)
π ngrams π
okay bestie, welcome to the ngrams(3pm) page β it's one of the user-contributed Perl docs, and it's giving "small script, big brain" energy fr fr. Let's get into it β¨
πΈ NAME πΈ
ngrams β Compute the ngram frequencies and produce tables to the stdout. yes, stdout, that's the whole vibe π
π SYNOPIS π
(bestie the heading typo is canon, we don't fix it, we respect it π)
ngram [--version] [--help] [--n=3] [--normalize] [--type=TYPE]
[--orderby=ORD] [--onlyfirst=N] [input files]
π DESCRIPTION π
This script produces n-grams tables of the input files to the standard output. that's it, that's the job, and it does it iconically π
π Options:
--normalizeβ Prints normalized n-gram frequencies; i.e., the n-gram counts divided by the total number of n-grams of the same size. so instead of raw counts you get the β¨proportionsβ¨--onlyfirst=NUMBERβ Prints only the first NUMBER n-grams for each n. See Text::Ngrams module. when you want a lil taste, not the whole meal π½οΈ--limit=NUMBERβ Limit the total number of distinct n-grams (for efficiency reasons, the counts may not be correct at the end). heads up bestie β efficiency mode means the numbers might be lowkey off at the finish line, that's a documented thing, not a bug you found π--versionβ Prints version. short king behavior, love that--helpβ Prints help. the classic, the legend π«Ά--n=NUMBERβ N-gram size, produces 3-grams by default. 3 is the default, so if you say nothing you're getting trigrams, no cap--orderby=frequency|ngramβ The n-gram order. See Text::Ngrams module. pick your sorting slay:frequencyorngram--type=character|byte|word|utf8β Type of n-grams produces. See Text::Ngrams module. your options arecharacter,byte,word, orutf8β pick your fighter π
π¦ PREREQUISITES π¦
Text::NgramsGetopt::Long
gotta have both, bestie, no shortcuts π
π SCRIPT CATEGORIES π
Text::Statistics
that's the category it lives under, cute right β¨
π README π
N-gram analysis for various kinds of n-grams (character, words, bytes, utf8, and user-defined). Based on Text::Ngrams module. user-defined?? obsessed. the range. the versatility. π
π₯ SEE ALSO π₯
Text::Ngrams module.
go read it, it's where all the real details live iykyk π
π COPYRIGHT π
Copyright 2003-2017 Vlado Keselj http://web.cs.dal.ca/~vlado
This module is provided "as is" without expressed or implied warranty. This is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The latest version can be found at http://web.cs.dal.ca/~vlado/srcperl/.
real talk though: "as is", no warranty, expressed or implied β that's the actual legal vibe, don't come for anybody if it goes sideways π
and that's the whole page bestie!! this one's brought to you by perl v5.34.0, dated 2022-06-28 β shoutout to the version and the date, they ate π
β¨ mwah, go compute some n-grams π¦π
π¦ where this page comes from
- debian bookworm: libtext-ngrams-perl 2.006-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libtext-ngrams-perl 2.006-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libtext-ngrams-perl 2.006-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libtext-ngrams-perl 2.006-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libtext-ngrams-perl 2.006-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms