Definition from Wiktionary, the free dictionary
Jump to navigation Jump to search
Edit-copy green.svg Documentation for MediaWiki:Gadget-AcceleratedFormCreation.js. [edit]
This page contains usage information, categories, interwiki links and other content describing the template.
To edit the rules for generating new form-of entries, go to User:Conrad.Irwin/creationrules.js.

This gadget allows you to automatically generate entries for inflected forms of words.

Enabling accelerated links

To enable the gadget, enable it in the Gadgets tab of your preferences: item "Add accelerated creation links for common inflections of some words.". If you do not have an account, you can enable it in your per-browser preferences instead.

Creating new entries

Many existing pages and templates already support the acceleration gadget. If a link allows you to generate a new entry automatically, it will appear bright green. To start creating an entry, simply click the link, which will take you to edit it. The edit window will automatically have the new entry added to it. You can then save the page like you would any other page.

If multiple inflections share the same form, then the entries for these forms are automatically combined if everything but the definitions is the same. Moreover, if the definitions use {{inflection of}}, then the inflection tags will be combined into a single {{inflection of}} definition line, separated by a semicolon ;. The order in which the definitions appear is determined by the order in which they appear in the lemma entry, but can be modified; see below under #Inflection tables organised by column.

It is important that you check the new entry to make sure that everything is correct! Although editors should take great care to make sure that the gadget does not generate bad entries, it is your own responsibility to make sure you don't inadvertently add incorrect or badly formatted content to Wiktionary. If the gadget is generating wrong entries, you should report this to the Grease pit.

Making a template use the script

Adjusting a template or module to use the script is relatively easy. Whenever your template/module shows a link to an inflected form, you need to provide it with some extra information. This extra information consists of "tags" that tell the script how to process your link, so that the right entry is generated.

Acceleration tags

The following is a list of tags that you can add. Italics indicate something you need to fill in yourself. When you need to include multiple tags, separate them with a space. If the values have spaces in them, replace the spaces with an underscore (_).

Which particular form the link is for. It can be just about anything, and is often language-specific. It is generally used to generate the definition line of the new entry. This is the only tag that is mandatory.
The gender code that should be added to the headword line, using the same format that {{head}} uses. This should only be needed in rare occasions. If the definition already mentions the gender, like "feminine form of" for example, then this is redundant and you should not add it.
The transliteration that should appear on the headword line. For many languages, the headword-line template can generates its own transliterations, so you only need to provide this tag when this is not possible, or when the automatically-generated translation would be wrong.
The lemma, the term that the new entry should be considered an inflected form of. The definition will contain a link that links back to this page. The script will automatically figure this out based on the page the link is in, so it's not usually needed. However, if the link should show a different term, for example with additional diacritics that are not present in the page name, then you should provide this tag.
The transliteration of the lemma, which is shown in the definition line after the link to the lemma. Again, the definition-line template can usually generate its own transliterations, so you only need to provide it when it can't or if the automatically-generated transliteration would be wrong.
Normally, the forms on a page are processed in reading order (left to right, top to bottom), and the entries/definitions will be added to the page in that order. This tag is used when the same form appears multiple times in a page/inflection table, and causes a particular link to be ignored for the ordering. This is useful when an inflection table shows some forms in its collapsed state, like for example {{se-infl-adj-even}} or {{nl-conj-wk}}. By placing this tag on the links that appear in the collapsed state, their forms will not be shown before the forms in the rest of the table.

Adding the tags to a template

There are various ways to add accelerated creation to links, both in templates/wikicode and in modules/Lua. Acceleration tags should not be added directly to entries, there should always be a template that wraps around it.

Links that are created with the standard linking templates {{l}}, {{l-self}} and such have an accel= parameter. You can provide the acceleration tags with this parameter, e.g.


If you are working in a module using the full_link function of Module:links, the accel= parameter can be provided as one of the values in the first parameter, e.g.

full_link({lang = lang, term = "foos", accel = "plural-form-of"})

When working on a headword template, you'll typically be using {{head}}, and providing it with one or more inflected forms to show on the headword line. To provide acceleration tags for the inflected forms, you provide the fNaccel= parameter, followed by the tags you want, where N stands for the number of the form. For example:


In a module using the full_headword function of Module:headword, you provide the accel= parameter on the list of inflections of a particular label, e.g.

full_headword({lang = lang, inflections = { {label = "plural", accel = "plural-form-of", "foos"}, {label = "diminutive", accel = "diminutive-form-of", "bar"} }

When you're done, add {{isAccelerated}} to the documentation page of the template. This shows a notice that accelerated links are enabled for this template. It also adds the template to Category:Templates with acceleration.

Inflection tables organised by column

The order in which definitions appear in combined entries is determined by the order in which the links appear in the page/HTML code. This order is always in reading order: left to right, top to bottom. Many inflection tables are organised by column, and often you want the forms in one column to take priority over forms in another column. For example, it's generally desirable to have the definitions of singular forms appear before the definitions of plural forms. For this, there is the data-accel-col= attribute.

The data-accel-col= attribute is placed on the table cell which contains the accelerated inflection links, and is given a column number as a value. For example:

! Locative
| data-accel-col="1" | {{l-self|se|soddjilis|accel=loc_s-form-of}}
| data-accel-col="2" | {{l-self|se|soddjiliin|accel=loc_p-form-of}}
! Comitative
| data-accel-col="1" | {{l-self|se|soddjiliin|accel=com_s-form-of}}
| data-accel-col="2" | {{l-self|se|soddjiliiguin|accel=com_p-form-of}}

Columns with the same number are processed as a single unit, so all forms with column number 1 are processed before all forms with column number 2. Consequently, definitions for forms in column 1 will always appear in an entry before definitions for forms in column 2. If the inflection table contains another set of columns below the first set, the count continues, so that the columns are numbered 1, 2, 3, 4 and so on.

Column numbers are applied on a per-table basis. This means that if the same column number appears in multiple tables in the same language section, they will not interfere with each other; each new table "resets" the columns. Any table cell (but not a header cell with !) that does not have the data-accel-col= attribute will also cause a column reset. This means that you can have two different columns numbered 1, as long as there is a table cell without a column number in between them. Once a cell lacking a column number is encountered in the reading order, processing of the forms will continue in reading order as usual.

Requesting new rules

If you are not able to edit the script yourself, please file requests for new features on the script's talk page. 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 from within the script. They are defined in a separate file, User:Conrad.Irwin/creationrules.js. The creation_rules array contains an entry for each recognised language. This entry is a function that takes two arguments, params and entry.

The params parameter is an array 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 part of speech that the new entry is created for. This is taken from whatever part-of-speech header preceded the template in the lemma entry.
The name of the form. This is whatever was given in form-form-of as the form name.
The gender, or null. Whatever was given in gender-gender as the gender.
The transliteration, or null. Whatever was given in transliteration-translit as the transliteration.
The term that the new entry should link back to. If the origin-pagename tag was given, it will be that. Otherwise, it's the same as origin_pagename by default.
The page name of the lemma.
The origin_transliteration, or null. Whatever was given in origin_transliteration-translit.
The 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 head= parameter if necessary. This is the same as target_pagename in most cases, but can be different if the display form contains additional diacritics.
The page name of the entry to be created.

The entry parameter contains the different parts of the entry that is being created. Some of them have a default value, while others are null by default. The purpose of the generation function for each language is to provide these values so that the entry is generated according to what is needed for the language. The entry array contains the following values:

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 headword template code and all its parameters. By default, it uses {{head|(lang)|(pos) form}}, with head= and tr= as necessary. You need to override this if you need something else.
The definition line, without the initial # . You must override this, as there is no default and the script will fail.
inflection, declension, conjugation
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.