Module m_grammar
Documentation for the modules-m_grammar module in /std/modules/m_grammar.c.
Module Information
The grammar module contains a number of functions for producing high quality english output.
Functions
-
string pluralize(string str)
Convert a noun to it’s plural form. Oddly enough, it’s also quite good at converting verbs to their singular form, since going from plural to singular often entails adding an ‘s’. Eg, they run, he runs.
-
string number_of(int num, string what)
Handles the common operation: “0 bogs”, “1 bog”, “2 bogs”, …
-
string punctuate(string str)
Adds a period to a sentence if needed. Also not after URLs (http/https/ftp). Original by Rust in M_GRAMMAR.
-
string number_word(int num)
num == 1 returns “one”, etc. If num > 9, the number is returned as a string (num == 10 returns “10”, for example), which is consistent with most English style guidelines
File generated by Lima 1.1a4 reStructured Text daemon.