Skip to content

More compact API for fetching matching templates for a lexeme #221

@nikkiwd

Description

@nikkiwd

The Lexeme Forms gadget (https://www.wikidata.org/wiki/MediaWiki:Gadget-lexeme-forms.js) does a request to Lexeme Forms for every lexeme the user loads, e.g. on https://www.wikidata.org/wiki/Lexeme:L7, it will request https://lexeme-forms.toolforge.org/api/v1/match_template_to_lexeme/www/L7

The response from Lexeme Forms includes every template and whether or not it matches. The gadget ignores anything where the language or lexical category don't match, leaving just one template for L7.

Currently the response is around 68 kB, which compresses to about 4 kB. A JSON object with only the matching template would be around 134 bytes, uncompressed. 99% of the response is just thrown away, so including it every time is a waste of resources. The responses will also only get bigger over time, as more templates are added.

It would be better to have an API which only returns templates where the language and lexical category match (or at least where the language matches). The number of templates for a language will be limited, whereas Lexeme Forms is still a long way from covering all the languages Wikidata has lexemes for (and Wikidata is still a long way from covering all the languages with entries in a Wiktionary).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions