Code feasibility question

Jump to navigation Jump to search

Code feasibility question

Hello, I have a code feasibility question. Let's say you have words (like those in the category "French verbs") each with a certain set of properties (in the form of categories, like 1st group, 2nd group, transitive, reflexive,...). Would there be an easy way to auto-generate a table of words×properties with a check when the combination is applicable?

Word Property1 Property2 Property3
word1 x x
word2 x
word3 x x

This would basically require to iterate though the content of a category ("French verbs") and for each entry, iterate through the categories it belongs to ("1st group", "transitive"...). Thanks a lot for your help!

Julien Daux (talk)00:58, 4 October 2016

It's certainly possible, but not purely with anything the wiki software has. You'd need an external program written in a language such as Python (with the pywikibot module) that does the work for you.

CodeCat01:07, 4 October 2016

To be clear, you could either use one of the dump files ([1]- I'm not sure which one specifically has category membership information) or the API. There's not really any way to do it live- you would have to run a bot periodically.

DTLHS (talk)01:14, 4 October 2016
 

I see... If I understand correctly, the python bot would run from my machine.. I'm quite surprised to see that Lua or other module running server-side don't provide primitives for iterating through the content of a category or through the categories a page belongs to? Will look into that pywikibot, then. Thank you!

Julien Daux (talk)01:37, 4 October 2016

I think it may be because it adds the possibility of nondeterminism to modules. What if a module checks if the current page is in a category, and if it's not in the category, it adds the category, but if it's already in the category it doesn't add the category?

CodeCat12:49, 4 October 2016