Board Thread:General Discussion/@comment--20140612141547/@comment-27080620-20140618124131

Hi again! After some consideration I've decided to go with a more complex but reliable solution.

I brought the Module:CharacterInfoboxCitizenship back and created Module:CharacterInfoboxRace and I've tweaked its structure. Race and Citizenship methods from Module:CharacterInfobx also accept multiple Citizenships separated with commas.

Now valid singular and plural forms are stored in a table called valid. It is the first place for the script to look at. If a supplied value is an existing key in this table - category links are returned instantly and it jumps to the next element (if there's any).

A subsitutes table has also been changed for better performance. The script takes the first letter of a supplied value and looks only in a scope of substitutions beginning with this character (unless, for some reason, this character is not included as a key. In this case it searches the whole table.). Good news here - you can also use [Lua Patterns] to match the substitutions which is far more powerful. Also, you don't have to include multiple keywords with the same core (e.g. amazon, amazonian, amazons). The core itself (amazon) will do the job.

If neither valid nor substitute table can handle a supplied value - there is fallback that uses the regular plural forms to create a link. It also adds categorizes a page in Category:Needs valid citizenship or Category:Needs valid race so you can monitor which pages may have a problem with a plural form.

I hope this will be a solution close to the ideal one. :)

Please, share an info if you find any bugs in it.

Regards,

Adam