User:MewBot

From Wiktionary, the free dictionary
Jump to navigation Jump to search
Wiktionary:Babel
?-0 This user is a cat and does not understand anything. It does however respond well to food.

Hi! I am not a real person, but a bot run by Rua. However, if you have any questions or comments about the way I work, ask on my user talk page.

Requests[edit]

To give this kitty something to do, add cheezburgers entries to User:MewBot/feedme.

Tasks[edit]

Catalan verbs[edit]

The bot creates entries for Catalan verbs that use one of the various templates in Category:Catalan verb inflection-table templates. Only the templates that invoke Module:ca-verb are supported, as the bot uses the machine-readable output of that module. Reflexive verbs are not supported and will automatically be skipped; add a conjugation table to the non-reflexive base entry instead.

Esperanto verbs[edit]

The bot creates entries for Esperanto verbs that use {{eo-conj}}.

Finnish verbs[edit]

The bot creates entries for Finnish verbs. This feature is not yet complete, and not all conjugation-table templates are supported yet.

Dutch adjectives[edit]

The bot creates entries for Dutch adjectives that use {{nl-decl-adj}}. The bot uses the machine-readable output of Module:nl-adjective.

Dutch verb form entries[edit]

The bot creates entries for Dutch verbs that use {{nl-conj-wk}}, {{nl-conj-wk-cht}}, {{nl-conj-st}} or {{nl-conj-irr}}. The bot uses the machine-readable output of Module:nl-verb.

Documentation[edit]

Command line options[edit]

The bot is normally provided with a list of one or more entry names. If these are not provided, MewBot will look on its feedme page for entries.

-t type — type
The part of speech type of entry the bot will work on. Possibilities for type are:
  • cav - Catalan verbs
  • eov - Esperanto verbs
  • fiv - Finnish verbs
  • nla - Dutch adjectives
  • nlv - Dutch verbs
The default is all types, which means the bot will process the page once for each type.
-s — simulation
The bot will only fetch pages but not make any edits; instead it will show you which edits it would have made.
-v — verbose
The bot will print a complete listing of the new content being saved to Wiktionary (or simulated). This is printed to stdout, while all other messages are printed to stderr, so you can redirect it to a file easily for further study.
-f — force
The bot will force an update, where it would otherwise skip the edit. Note that this means you WILL need to check any pages it force-updates, as most likely there will be duplicated content! Any such edits automatically add [[Category:Requests for cleanup (MewBot)]] to the page, so that they can be immediately fixed after the bot finishes its work.

Inner workings[edit]

How the bot adds new form entries depends on the existing pages. Several cases can be distinguished:

The target page does not exist.
Create a new page.
The target page exists, but has no section for the specific language.
Append a new language section to the page. Use {{rfc-auto}} to get AutoFormat to automatically move the section to the right place.
The target page exists, and has more than one section for that language.
Skip the page and do nothing (unless forced). While unusual, this situation can occur when the bot tries to edit a page that it had added content to earlier, but before that page had been cleaned up by AutoFormat. This leaves the page with two language sections of the same name.
The target page exists, and has a section for the language already.
That language section contains the content to be added, verbatim.
Skip the page and do nothing, even if forced. This allows the bot to be run on entries that may have been processed by the bot before, without the risk of duplicating content even with the -f option.
That language section has a <POS> or <POS> form section.
Skip the page and do nothing (unless forced). The bot can't do anything here because it does not know whether the existing section refers to the entry currently being processed.
That language section has multiple numbered Etymology sections.
Skip the page and do nothing (unless forced). The bot can't know which Etymology section to add the entry to, or whether to create another.
Otherwise
Append a new language section to the page. Use {{rfc-auto}} to get AutoFormat to automatically move the section to the right place, and merge it with the existing language section for that language.

Using the AutoFormat bot, the bot doesn't have to concern itself with the entry layout, which simplifies the bot and makes it less prone to messing up existing entries.

Source code[edit]

User:MewBot/formbot.py
A generic interface to all bot functions that aren't language or part-of-speech specific. If you want to develop your own form bot, you should download this file and create your own derived class of GenericFormBot. Then provide a constructor and override the generateEntries method so that it does something specific to your bot.
User:MewBot/caverbformbot.py
A class derived from FormBot, which conjugates Catalan verbs. Probably not useful unless you need ideas.
User:MewBot/eoverbformbot.py
A class derived from FormBot, which conjugates Esperanto verbs. Probably not useful unless you need ideas.
User:MewBot/fiverbformbot.py
A class derived from FormBot, which conjugates Finnish verbs. Probably not useful unless you need ideas.
User:MewBot/nladjformbot.py
A class derived from FormBot, which declines Dutch adjectives. Probably not useful unless you need ideas.
User:MewBot/nlverbformbot.py
A class derived from FormBot, which conjugates Dutch verbs. Probably not useful unless you need ideas.
User:MewBot/mewbot.py
The front-end to the bot. You might find this useful as example code to start off with, though it would need some adjustments in the run method to work for your own bot.