The on-wiki version of this newsletter can be found here:
https://www.wikifunctions.org/wiki/Wikifunctions:Status_updates/2024-05-15
--

Call for Functions: Spell out the number!

Natural numbers, like most things, have different words for them in different languages. A number such as 7 is called ‘seven’ in English, ‘sedam’ in Croatian, ‘ayɔpɔin’ in Dagbani, ‘asaa’ in Igbo, and so on. In many languages, names of larger numbers are often composed according to rules from smaller numbers.

The number 1000 in Babylonian cuneiform.

For many numbers, Wikidata offers names. Either through lexemes such as L347774, or on labels on the respective items, such as on Q23350.

In Wikifunctions, we already have a function to create names for the English cardinal numbers. It is presented below as the Function of the Week.

For other languages, we don’t have that function yet. This is a call to the community to create such functions for the languages that you speak!

In order to help with kicking those off, we drafted a PAWS Notebook to create a first draft of the function implementation in JavaScript, using the lexemes and labels in Wikidata for a given language. Feel free to ask Denny to run the function for your language.

Instead, you may also want to use one of the implementations of the English function below as a template and adapt it to your language.

One interesting source of inspiration for this might be Grammatical Framework’s solution for creating number names, or any of the many libraries doing the same thing.

Looking forward to seeing how this challenge develops! Let’s spell out the number!

Recent Changes in the software

One of our big pieces of work this Quarter is supporting identity Types, like singular/plural or passive/active (T363390). This week, we landed middle-ware and front-end support for identity keys in Types (T363405 and T363497); expect further movement on this soon!

The "About" dialog, where you can add and edit labels, short descriptions, and aliases, now updates the 'count' of available languages consistently with the publish state (T346031). The information in the pop-up meta-data dialog is now rounded to 4 significant figures, rather than letting floating-point noise obscure the main information in e.g. how long a function call took to run.

We also landed some more minor fixes, including consolidating our front-end code to have only one method to determine if you're creating a new Object (T358596), and improving our browser tests to be more reliable and focussed on testing the main expected behaviour (T349836). We added some logging when language look-up unexpectedly fails in the server-side code (T357702), though we think this should now be fixed due to database content updates that landed last week.

We also updated our code-documentation generation to use the latest template, and tweaked our JavaScript code to align with Wikimedia-wide coding style updates, using defineComponent() for making Vue components clearer to linters, and avoiding the unnecessary jQuery's $.extend() in favour of Object.assign().

Function of the Week: English cardinals

English cardinals (Z13587 ) is a function that, given a natural number, provides the name of the number in English. Looking at the tests, we can find the following examples:

The last should throw a proper error, not just a string that says error. We need to work on this.

There are two implementations for this function, one in Python and one in JavaScript, both having a few dozen lines of code and quite a bit more complex than most of the Functions of the Week we have looked at so far. They may be used as templates for implementations for other natural languages, supporting the Call for Functions going out this week!