Wikipédia abstraite/Mises à jour/2021-09-03

This page is a translated version of the page Abstract Wikipedia/Updates/2021-09-03 and the translation is 49% complete.
Actualités de la Wikipédia abstraite Translate

liste de diffusion de la Wikipédia abstraite Wikipédia abstraite sur IRC Wikifonctions sur Telegram Wikifonctions sur Mastodon Wikifonctions sur Twitter Wikifonctions sur Facebook Wikifonctions sur Youtube site web de Wikifonctions Translate

Génération de texte, avec Ninai et Udiron.

Le bulletin de cette semaine a été écrit par Mahir Morshed. Mahir a été depuis longtemps un contributeur de Wikidata et particulièrement également pour les données lexicographiques sur Wikidata. Il a développé un prototype qui, depuis une représentation sous forme de contenu abstrait, génère du texte en langue naturelle en bengali et en suédois, un prototype ayant pour objectif que ceci pourrait être mis en œuvre dans Wikifonctions. Dans ce bulletin d’actualité, Mahir décrit le prototype.


La discussion sur les capacités de la Wikipédia abstraite pour la génération de texte en langue naturelle a tourné autour de la présence des constructeurs abstraits et des rendus concrets par langue, tout en notant également l’utilisation des éléments et lexèmes de Wikidata comme base pour faire correspondre les concepts à la langue. Afin de rendre cette connexion un peu plus claire à imaginer, j’ai commencé à construire un système de génération de texte. Celui-ci utilise les éléments, les lexèmes, ainsi que des emballages autour d’eux, en tant que briques de construction et ces briques sont assemblées en arbres syntaxiques, basés sur le schéma d’annotation syntaxique d’Universal Dependencies.

(Si ceci semble être une approche différente de ce qui était discuté dans un bulletin d’actualité il y a deux mois, c’est parce que ça l’est. Soyez libre de me laisser un message si vous souhaitez en discuter.)

Le système est composé de trois parties, dont la dernière est probablement quelque chose que nous pourrions sauter dans un portage vers Wikifonctions :

  • Ninai (from the Classical Tamil for "to think") holds all constructors, logic at a sufficiently high level for renderers, and a resolution system from items (each wrapped in a "Concept" object) to sense IDs for a given language. Decisions and actions in Ninai are meant to be agnostic to the methods for text formation underneath, which are supplied by...
  • Udiron (from the Bengali pronunciation of the Sanskrit for "communicating, saying, speaking"), which holds lower-level text manipulation functions for specific languages. These functions operate on syntactic trees of lexemes (each lexeme wrapped in a "Clause" object). These lexemes are imported via...
  • tfsl (from "twofivesixlex"), a lexeme manipulation tool, which is intended to be akin to pywikibot but with a specific focus on the handling of Wikibase objects. Both of the above components depend on this one, although if 'native' item and lexeme access and manipulation becomes possible with Wikifunctions built-ins then tfsl could possibly be omitted.

Some design choices in this system worth noting are as follows:

  • Constructors, while being language-agnostic and falling within some portion of a class hierarchy, are purely containers for their arguments, carrying no other logic within. This means, for example, that an instance of a constructor Existence(subject), to indicate that the subject in question exists, only holds that subject within that instance, and does nothing else until a renderer encounters that constructor.
  • Every constructor allows, in addition to any required inputs, a list of extra modifiers in any order (the 'scope' of the idea represented by that constructor). This means, for example, that a constructor Benefaction(benefactor, beneficiary) might be invoked with extra arguments for the time, place, mode, and other specifiers after the beneficiary.
  • When one 'renders' a composition of constructors, a Clause object (representing the root of a syntactic tree) is returned; turning it into a string of text is done with Python's str() built-in applied to that object.

At the moment, there are just enough constructors to represent Sentence 1.1 from the Jupiter examples, as well as renderers in Bengali and Swedish for those constructors (thanks to Bodhisattwa, Jan, and Dennis for feedback on those). Building up to the Jupiter sentence should demonstrate how these work:

Construction étape par étape de la phrase sur Jupiter
Texte du constructeur Résultat en bengali Résultat en suédois Glose (pas un résultat du rendu !) Notes
Identification(
  Concept(Q(319)),
  Concept(Q(634)))
বৃহস্পতি গ্রহ। Jupiter är klot. Jupiter est planète. Nous commençons par identifier simplement les deux concepts de Jupiter (Q319) et planète (Q634) comme étant égaux.
Identification(
  Concept(Q(319)),
  Instance(
    Concept(Q(634))))
বৃহস্পতি একটা গ্রহ। Jupiter är ett klot. Jupiter est une planète. Au lieu d’égaliser les concepts seuls, nous pourrions plutôt égaliser « Jupiter » avec une instance de « planète ».
Identification(
  Concept(Q(319)),
  Instance(
    Concept(Q(634)),
    Definite()))
বৃহস্পতি গ্রহটি। Jupiter är klotet. Jupiter est la planète. Nous pouvons raffiner cela davantage en clarifiant que « Jupiter » est une instance définie de « planète ».
Identification(
  Concept(Q(319)),
  Instance(
    Attribution(
      Concept(Q(634)),
      Concept(Q(59863338))),
    Definite()))
বৃহস্পতি বড় গ্রহটা। Jupiter är det stora klotet. Jupiter est la grande planète. Maintenant nous pouvons adjoindre un attribut à l’instance définie de la planète en question, cet attribut étant grand (Q59863338).
Identification(
  Concept(Q(319)),
  Instance(
    Attribution(
      Concept(Q(634)),
      Superlative(
        Concept(Q(59863338)))),
    Definite()))
বৃহস্পতি সবচেয়ে বড় গ্রহটি। Jupiter är det största klotet. Jupiter est la plus grande planète. Cet attribut étant superlatif pour Jupiter peut être marqué en modifiant l’attribut.
Identification(
  Concept(Q(319)),
  Instance(
    Attribution(
      Concept(Q(634)),
      Superlative(
        Concept(Q(59863338)),
        Locative(
          Concept(Q(544))))),
    Definite()))
বৃহস্পতি সৌরমণ্ডলে সবচেয়ে বড় গ্রহ। Jupiter är den största planeten i solsystemet. Jupiter est la plus grande planète dans le système solaire. Une fois que nous spécifions le lieu où s’applique que Jupiter est la plus grande (c’est-à-dire, dans le système solaire (Q544)), nous avons terminé !

Note that the sense resolution system does not have enough information to choose which of '-টা' or '-টি' (for Bengali) or of 'klot' or 'planet' (for Swedish) to use in some of these examples, so currently in the prototype one is chosen at random. This therefore means that re-rendering any examples which pull those in might use something different.

Besides this, there is clearly a lot more functionality to be added, and because Bengali and Swedish are both Indo-European languages (however distant), there are likely linguistic phenomena that won't be considered simply by developing renderers for those two languages alone. If there's something particular in your language that isn't present in those two languages, this may then raise the question: what can you do for your language?

I can think of at least four things, not in any particular order:

  • Create lexemes and add senses to them! What matters most to the system is that words have meanings (possibly in some context, and possibly with equivalents in other languages or to Wikidata items) so that those words can be properly retrieved based on those equivalences; that these words might have a second-person plural negative past conditional form is largely secondary!
  • Think about how you might perform some basic grammatical tasks in your language: how do you inflect adjectives? add objects to verbs? indicate in a sentence where something happened?
  • Think about how you might perform higher-level tasks involving meaning: what do you do to indicate that something exists? to indicate that something happened in the past but is no longer the case? to change a simple declarative sentence into a question?
  • If you have some ideas on how to render the Jupiter sentence in your language, and the lexemes you would need to build that sentence exist on Wikidata, and those lexemes have senses for the meanings those lexemes take in that sentence, let me know!

We'd love to hear your thoughts on this prototype, and what it might mean for realizing Abstract Wikipedia through Wikidata's lexicographic data and Wikifunctions's platform.


Thank you Mahir for the great update! If you too want to contribute to the weekly, get in touch. This is a project we all build together.

In addition, this week Slate published a great explaining article on the goals of Abstract Wikipedia and Wikifunctions: Wikipedia Is Trying to Transcend the Limits of Human Language