Extension:Cognate/en

Cognate creates a central store where the page titles for a group of sites are stored. The extension can then generate interwiki links across wiki projects in cases where the titles are the same. It was developed to solve the "Centralize interwiki language links for Wiktionary" task.

"Cognate" is a linguistic concept, meaning same words in different languages developed from the same origin. Since this extension has a similar translation mechanism, it makes for a nice short extension name, even when the actual concept is different.

Assumptions & Restrictions

 * Pages must be in one of the standard MediaWiki namespaces.
 * Page titles are the same across languages (with some simple normalization applied).
 * Sites should have the same interwiki structure for language links.
 * Unexpected hash conflicts are unlikely but could occur, and would result in unexpected language links.

Title Normalization
Very simple title normalization occurs within the extension. This can be seen in the StringNormalizer class.

Initially the amount of normalization is very small. Requests can be made to expand this and will be added on a case by case basis.

Title Hashing
Titles are hashed using sha256. This can be seen in the StringHasher class.

Part of the hash is then stored in the database in a BIG_INT field for efficient lookups.

There are roughly 18,446,744,073,709,551,615 possible values.

Matching Hashes
As titles that require links are assumed to be the same post normalization, they will result in the same hash and thus the same Int stored in the database.

Some sample data might look as follows when loading the "Foo..." page on enwiktionary.

Testing environments


A testing environment has been created for the extension on Wikimedia Labs made of the following sites:


 * https://enwiktionary-cognate.wmflabs.org
 * https://dewiktionary-cognate.wmflabs.org
 * https://frwiktionary-cognate.wmflabs.org

These sites are linked together using the Cognate extension with added interwiki sorting provided by the InterwikiSorting extension. The Main Page of the enwiktionary test wiki provides examples for testing.

Installation
php ./maintenance/populateCognateSites.php --site-group=wiktionary php ./maintenance/populateCognatePages.php
 * Populate the sites table by running the populateCognateSites.php maintenance script. Sites must already exist in the MediaWiki sites table with the correct groupings.
 * Populate the page and title tables by running the populateCognatePages.php maintenance script.