Module:gender and number/doc
This is the documentation page for Module:gender and number
This module shows gender/number annotations, such as m (masculine), n pl (neuter plural) or f anim du (feminine animate dual). "Gender" is something of a misnomer, as the available annotation categories include other similar lexical characteristics such as animacy and verb aspect (though the former is sometimes also considered a part of word gender). These annotations are attached to nouns, pronouns and other parts of speech that have such lexical categories, depending on the particular language. The annotations occur as parameters e.g. to headword templates such as {{head}}
, {{es-noun}}
(for Spanish nouns), {{fr-proper noun}}
(for French proper nouns) and {{ru-verb}}
(for Russian verbs); to translation templates such as {{t}}
, {{t+}}
and {{t-check}}
; to definition templates such as {{demonym-noun}}
; and to dedicated gender/number templates such as {{g}}
.
Gender/number specifications
jhyukA given annotation is described using a gender/number specification. Each such specification is a hyphen-separated list of gender/number codes, where a given code describes a single value of a particular category (e.g. m for "masculine", an for "animate", p for "plural"). Often, templates accept a list of gender/number specifications rather than just a single one, since some terms belong to multiple possible gender/number categories. Depending on the template in question, these specifications will be given using separate parameters or a single comma-separated parameter.
When displaying a specification, each code in the specification is converted into the appropriate display form. The different codes within the specification are then added together, separated by spaces.
Some examples:
List | Result |
---|---|
{"m"} | m |
{"m-p"} | m pl |
{"m-an-p"} | m anim pl |
{"mfbysense-p"} | m pl or f pl by sense |
{"?-p"} | ? pl |
{"?!-an-s"} | gender unattested anim sg |
{"f-d", "m-p"} | f du or m pl |
{"m-p", "f-p"} | m pl or f pl |
{"m", "f", "p"} | m or f or pl |
The source of truth for the current set of recognized codes is Module:gender and number/data.
The following table gives:
- the currently recognized codes;
- the type category they belong to (in a given spec, only one code in a given type category can be present);
- how the codes display (hover over the display form to see an explanation of what the code means);
- which category (if any) that the term will be assigned to if the code in question is in the term's headword gender/number spec (where
POS
is replaced by the pluralized part of speech of the term).
Script error: No such module "gender and number doc".
Certain gender/number codes are combination codes that are more or less equivalent to individually specifying two or more codes of a given type category in separate gender/number specs. Some combination codes categorize and display additionally. The following table gives these combination codes:
Script error: No such module "gender and number doc".
In certain type categories, if more than one code of that category is given (necessarily in different gender/number specifications), the term is added to a special category. The following table gives these multi-code categories:
Script error: No such module "gender and number doc".
Noun classes
jhyukSpecifications that begin with "c" (but not "c" itself) are treated specially. They are considered noun classes, and the part immediately after the "c" is simply treated as some kind of name for a noun class; usually this will be a number. Noun classes do not have sub-parts, so they will not contain hyphens. When more than one specification is given, they must all be noun classes, and they are displayed separated with a forward slash instead, and preceded by class.
Examples:
List | Result |
---|---|
{"c1"} | class 1 |
{"c1", "c2"} | class 1/2 |
{"c1a", "c2a"} | class 1a/2a |
Usage
jhyukThe module can be used from another module by importing it and calling the exported format_list
function. It requires one parameter, which must be a table of zero or more strings. It will then return a string containing the result. For example:
local gen = require("Module:gender and number")
local example1 = gen.format_list({"m"})
local example2 = gen.format_list({"m", "f"})
local example3 = gen.format_list({"m-p"})
WARNING: The list passed in will be overwritten.
It can also be invoked from a template. The function show_list
is used for this. It works the same way as the format_list
function, but the specifications are passed as parameters to the module invocation, like so:
*{{#invoke:gender and number|show_list|m}} *{{#invoke:gender and number|show_list|m|f}} *{{#invoke:gender and number|show_list|m-p}}
- m
- m or f
- m pl
There is no limit to the number of parameters that can be given this way. The module will process all of its parameters until it finds one that is empty. This means that the following will display only "m" and not "m or n":
{{#invoke:gender and number|show_list|m||n}}