Extension:Svetovid

Svetovid (Polish: Świętowit, a Slavic deity of war, fertility and abundance) is an extension that provides grammar-aware link creation assistance.

This extension was developed with the Polish language in mind, but it could potentially be used with other declensed languages. Slavic languages should be relatively easy to implement, as they have similar grammar structure, other languages may require more changes. If you are interested in using Svetovid with a different language, please contact this extension's creator.

Installation
Now, this is a crazy extension and installing it is all but easy. Venture further on your own mental health risk.

Configuration

 * $wgSvetovidMorfeuszURL: The URL to the Morfoapi morphological service. Default is  (the default port Morfoapi will listen on).
 * $wgSvetovidSearchCacheExpiry: How long search results will be cached in seconds (i.e. how long a user can use retrieved results to edit pages). Default is 3600 (one hour).
 * $wgSvetovidSearchBlacklist: Titles that should not be returned in search results, you can for example add there your Main Page. Default is an empty array.
 * $wgSvetovidDefaultNamespaces: Default namespaces that should be searched, depending on the namespace of the page the user wants to link to. For example, if you want to search only the main namespace (ID 0) for main namespace queries and the help (ID 12) and main namespace for help namespace queries, you would use something like this:
 * By default this configuration variable is empty. If you don't specify default namespaces for some namespace, Svetovid will use the list from.
 * By default this configuration variable is empty. If you don't specify default namespaces for some namespace, Svetovid will use the list from.


 * $wgSvetovidMaxSearchResults: The maximum number of search results returned by the search module. Setting this to a high value can impact performance negatively, as all pages are processed ahead of time, during the search operation (this is necessary to remove false-positives). Default is 15.

Usage
See below for screenshots of every step described here.

Let's say you decide the article about Abraham Lincoln does not have enough backlinks. To fix that, visit the special page Special:LinkCreator, or just click the Link creator link in your toolbox if you enabled this option in your preferences. After selecting the page you want to work with (i.e. link to), the creator will try to interpret the text you entered in terms of grammar. This is neccessary, as in Polish grammar is not always unequivocal. In this case, Lincoln can mean a surname and a brand of a car. They declense differently (they have a different grammatical grammatical gender), so we have to choose the right interpretation. This interpretation could be also extracted automatically from the context by using a syntax analyzer. This is not implemented yet, but may be added in the future.

After selecting interpretations for all words in the query text (which in this case is the same as the page title, but that can be changed), the creator automatically declenses the text in all cases and both numbers. You can then correct this (there is usually no need to, these are taken from a high quality dictionary) and specify other search options, such as omitting pages that already link to the page you are working with. Only direct links count, though, so no navboxes will affect that. What's a direct link? You can read about that on the AdvancedBacklinks extension page.

The only thing left to do is hit the search button. Then you will be presented with a list of pages that can link to the page you are working with, together with incoming and outgoing direct link count. When you click the edit button, a new browser tab will open with the standard wikitext editor. The links are added automatically, but you can always review the changes before saving. That's it!

How it works
For grammar things (analysis and generation) Svetovid uses the Morfeusz 2 library provided by the Polish Academy of Sciences. This tool uses a compiled dictionary in the form of finite state automata to perform very efficient morphological analysis and generation. The library is operated by a separate program, Morfoapi, which exposes some Morfeusz functionality over a REST API and does some additional processing on the queries. It is very fast thanks to being written in C++ and the amount of communication between it and MediaWiki is minimized to a single request per search to keep overhead as small as possible.

For searching CirrusSearch is used, as it provides scalable and feature-rich searching on a wiki. Using a simpler, built-in search engine may also be possible, but it wasn't investigated yet.

AdvancedBacklinks provides additional information on direct backlinks, so one can avoid having duplicate links.

Why was this created and the why is this on mediawiki.org?
This, along with the AdvancedBacklinks extension, was created specifically for Nonsensopedia. After examining statistics about direct links on the wiki it turned out a lot of content was hard to reach, as there were no or very few links to these pages. We also do not consider navboxes being a serious remedy for that – they are huge, ugly and just don't make any kind of sense on mobile skins. The result of that discussion are these two extensions that hope to provide ultra-powerful tools for solving these problems. Based on our initial evaluation, this tool does deliver that. We think other wikis may have similar problems to us, even Wikipedia. Ask editors, do some statistics.

As for why this extension was put up here – partially because we want to invite others to join the effort of creating MediaWiki powertools and partially for bragging. We wanted to show how much can be done by a single developer of a small community, if the needs of the community are listened to and the devs actually do what the project needs instead of focusing on useless things (I'm looking at you, WMF). The project is far from perfect, but we will surely keep improving it. Do get in touch if you are interested :)