Module:gender and number/documentation

This module shows gender/number annotations, such as (masculine),  (neuter plural) or  (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
A 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:

The source of truth for the current set of recognized codes is Module:gender and number/data.

The following table gives:
 * 1) the currently recognized codes;
 * 2) the type category they belong to (in a given spec, only one code in a given type category can be present);
 * 3) how the codes display (hover over the display form to see an explanation of what the code means);
 * 4) 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   is replaced by the pluralized part of speech of the term).

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:

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:

Noun classes
Specifications 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:

Usage
The module can be used from another module by importing it and calling the exported  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:

WARNING: The list passed in will be overwritten.

It can also be invoked from a template. The function  is used for this. It works the same way as the  function, but the specifications are passed as parameters to the module invocation, like so:





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 "" and not "":