Module:accel/documentation

This module supports the accelerated entry creation gadget, WT:ACCEL. It automatically creates entries according to a set of language-specific rules, located in submodules.

The module will automatically try to merge multiple generated entries into one, if everything but the definitions is the same. Moreover, if the definitions use, then the inflection tags will be combined into a single definition line, separated by a semicolon. In addition, the module will attempt to group multiple semicolon-separated tag sets in a single call that differ in only one dimension, using multipart tags. For example, the following initially-generated entries

Adjective


will first be grouped into one entry as follows:

Adjective


Then, the several inflection lines will be combined together into one:

Adjective


Finally, the several tag sets in the single call will be grouped into one tag set with multipart tags, like this:

Adjective


The use of multipart tags like this helps by indicating where syncretism occurs and reduces the amount of information that must be processed. The algorithm to do the grouping is quite smart; it will only group when it won't change the semantics of the inflections, and there are multiple possible groupings that yield the same number of tag sets, the one with the fewest number of multipart tags is preferred. As an example of the latter, an entry like this::

Adjective


will be converted to the following:

Adjective


It could equally well be converted to the following, which also contains two tag sets:

Adjective


However, this grouping is dispreferred because it results in two multipart tags, while the preferred grouping has only one.

Default rules
The module uses a set of default rules which generate entries that should be acceptable in most cases:
 * The headword is formatted using, using the part-of-speech of the lemma plus "form", e.g. noun &rarr; noun form, adjective &rarr; adjective form, etc.
 * For the tags  and , "comparative" and "superlative" are added to before the part of speech instead.
 * The definition is formatted using, and the  tag is used directly as the form tag of the template. Thus,   &rarr;.
 * For some tags, a special-purpose template is used in the definition instead:
 * &rarr;
 * &rarr;
 * &rarr;
 * &rarr;
 * &rarr;
 * &rarr;
 * &rarr;

These defaults may change in the future as Wiktionary's needs change. Don't rely on particular default values. If in doubt, assume that everything will use, and override anything you want to be different.

Requesting new rules
First, consider whether new rules are needed at all. The default rules suffice for many cases, especially if you make sure to provide a value for the  tag that can be directly inserted into. If you really need language-specific rules, and are not able to edit the module yourself, please file requests for new features at the Grease Pit. Specify:


 * 1) What you want to generate the links for. That includes at least a link to the template whose links you want to make green.
 * 2) What the generated entries should look like. In particular, which headword-line template it should use, and which form-of template, which parameters they should receive in which situations, and so on. A link to a word that has blue links to all the forms in the template would work best, as an example.
 * 3) Ideally, a link to a word that has red links to all the forms. This is useful for testing to see if the generated entries are correct.

Adding new rules
Generation rules are used to create the entry's contents. The general parts are defined in this module, while the language-specific rules are handled by submodules. Each submodule must return a table containing one function named. This function has two parameters,  and , and it does not return any value.

Params
The  parameter is a table that contains the information about the lemma, the form-of entry to be created, and the acceleration tags. It contains the following values:


 * The language code of the language in question.
 * The language code of the language in question.


 * The part of speech that the new entry is created for, e.g. lua or lua. This is taken from whatever part-of-speech header preceded the template in the lemma entry. The default rule for creating the headword adds lua onto this, resulting in e.g..
 * The part of speech that the new entry is created for, e.g. lua or lua. This is taken from whatever part-of-speech header preceded the template in the lemma entry. The default rule for creating the headword adds lua onto this, resulting in e.g..


 * The non-lemma form that the new entry is created for. This is taken automatically from the display form (alt) in the template's link to the form. It is used to give the  parameter of the headword, if necessary (i.e. if different from  ). This is the same as   in most cases, but can be different if the display form contains additional diacritics, as in languages such as Russian or Ukrainian (where the target will contain an acute accent marking the stress, if the word is more than one syllable) and Latin or Old English (where the target will contain macrons marking long vowels).
 * The non-lemma form that the new entry is created for. This is taken automatically from the display form (alt) in the template's link to the form. It is used to give the  parameter of the headword, if necessary (i.e. if different from  ). This is the same as   in most cases, but can be different if the display form contains additional diacritics, as in languages such as Russian or Ukrainian (where the target will contain an acute accent marking the stress, if the word is more than one syllable) and Latin or Old English (where the target will contain macrons marking long vowels).


 * The page name of the entry to be created.
 * The page name of the entry to be created.


 * The name of the form. Normally this is an inflection code with the individual tags separated by pipe symbols, e.g. lua. Occasionally it may be something else like lua. This comes from the lua field in a module invocation; the accel-form parameter in a call to, or similar; or the fNaccel-form parameter in a call to . See WT:ACCEL for more information.
 * The name of the form. Normally this is an inflection code with the individual tags separated by pipe symbols, e.g. lua. Occasionally it may be something else like lua. This comes from the lua field in a module invocation; the accel-form parameter in a call to, or similar; or the fNaccel-form parameter in a call to . See WT:ACCEL for more information.


 * The gender, or  if no gender was explicitly given. This comes from the lua field in a module invocation; the accel-gender parameter in a call to,  or similar; or the fNaccel-gender parameter in a call to . See WT:ACCEL for more information.
 * The gender, or  if no gender was explicitly given. This comes from the lua field in a module invocation; the accel-gender parameter in a call to,  or similar; or the fNaccel-gender parameter in a call to . See WT:ACCEL for more information.


 * The transliteration of the non-lemma form, or  if no gender was explicitly given. This comes from the lua field in a module invocation; the accel-translit parameter in a call to,  or similar; or the fNaccel-translit parameter in a call to . See WT:ACCEL for more information. Note that this will only be specified for languages that use a non-Latin script, and only when the auto-generated transliteration is insufficient, incorrect or nonexistent.
 * The transliteration of the non-lemma form, or  if no gender was explicitly given. This comes from the lua field in a module invocation; the accel-translit parameter in a call to,  or similar; or the fNaccel-translit parameter in a call to . See WT:ACCEL for more information. Note that this will only be specified for languages that use a non-Latin script, and only when the auto-generated transliteration is insufficient, incorrect or nonexistent.


 * The lemma that the new entry should link back to. This comes from the lua field in a module invocation; the accel-lemma parameter in a call to, or similar; or the fNaccel-lemma parameter in a call to . Under normal circumstances, none of these parameters are explicitly given, in which case the value of this field is the same as lua. (It will only differ from lua when the lemma contains additional diacritics that are stripped in order to generate the pagename, as in Latin, Russian, Ancient Greek or Old English. See WT:ACCEL for more information.
 * The lemma that the new entry should link back to. This comes from the lua field in a module invocation; the accel-lemma parameter in a call to, or similar; or the fNaccel-lemma parameter in a call to . Under normal circumstances, none of these parameters are explicitly given, in which case the value of this field is the same as lua. (It will only differ from lua when the lemma contains additional diacritics that are stripped in order to generate the pagename, as in Latin, Russian, Ancient Greek or Old English. See WT:ACCEL for more information.


 * The page name of the lemma to link back to.
 * The page name of the lemma to link back to.


 * The transliteration of the lemma to link back to, or . This comes from the lua field in a module invocation; the accel-lemma-translit parameter in a call to,  or similar; or the fNaccel-lemma-translit parameter in a call to . The same considerations apply here as for lua above. See WT:ACCEL for more information.
 * The transliteration of the lemma to link back to, or . This comes from the lua field in a module invocation; the accel-lemma-translit parameter in a call to,  or similar; or the fNaccel-lemma-translit parameter in a call to . The same considerations apply here as for lua above. See WT:ACCEL for more information.

Entry
The  parameter is essentially the return value of the function. It is a table that contains the different parts of the entry that is being created. Some of them will already have a default value when the language-specific function is run, while others are  by default. The purpose of the generation function for each language is to fill in these values, or override the defaults, so that the entry is generated according to what is needed for the language. The  table contains the following values:


 * The contents of the "Pronunciation" section, if any. Empty by default.
 * The contents of the "Pronunciation" section, if any. Empty by default.


 * The name of the level 3 part-of-speech header for the new entry. This does not usually need to be changed, as it automatically matches the part of speech of the main entry. But you can change it if, for example, you are generating a participle entry and you want to show "Participle" instead of "Verb".
 * The name of the level 3 part-of-speech header for the new entry. This does not usually need to be changed, as it automatically matches the part of speech of the main entry. But you can change it if, for example, you are generating a participle entry and you want to show "Participle" instead of "Verb".


 * The headword template code and all its parameters. By default, it uses, with  and   as necessary. You need to override this if you need something else.
 * The headword template code and all its parameters. By default, it uses, with  and   as necessary. You need to override this if you need something else.


 * The definition line, without the initial . By default, it uses, with   as necessary. You need to override this if you need something else.
 * The definition line, without the initial . By default, it uses, with   as necessary. You need to override this if you need something else.


 * The contents of the "Inflection", "Declension" and "Conjugation" sections respectively, if any. Empty by default. This can be used if the new entry is a sub-lemma with its own inflection, such as participles or comparative/superlative forms that inflect themselves.
 * The contents of the "Inflection", "Declension" and "Conjugation" sections respectively, if any. Empty by default. This can be used if the new entry is a sub-lemma with its own inflection, such as participles or comparative/superlative forms that inflect themselves.


 * The contents of the "Mutation" section. Empty by default. This appears at level 3 rather than level 4.
 * The contents of the "Mutation" section. Empty by default. This appears at level 3 rather than level 4.


 * The contents of the "Alternative forms" section. Empty by default. This appears after the definitions (rather than before, which is more common) and after the sections above (as per WT:EL).
 * The contents of the "Alternative forms" section. Empty by default. This appears after the definitions (rather than before, which is more common) and after the sections above (as per WT:EL).