The on-wiki version of this newsletter can be found here: https://meta.wikimedia.org/wiki/Abstract_Wikipedia/Updates/2023-10-04
As this newsletter contains plenty of images, it can be easily misformatted in Email. Please refer to the on-wiki version for easier reading in that case. -- Arguments made easier
As of today, referencing arguments has become considerably easier. https://meta.wikimedia.org/wiki/File:Wikifunctions_-_function_argument_interface_changes01.pngWhat does this mean? https://meta.wikimedia.org/wiki/File:Wikifunctions_-_function_argument_interface_changes02.pngFigure 2: expanded composition for generating the verb form for the German second person plural.
Every function has arguments.[1] https://meta.wikimedia.org/wiki/Abstract_Wikipedia/Updates/2023-10-04#cite_note-1 When creating a composition to implement a function, you need to be able to reference the arguments of the function. For example, let's look at the function that generates the regular German verb form for the second person plural https://www.wikifunctions.org/wiki/Z11272: it takes one argument, the infinitive form of the verb, e.g. *“denken”* (to think), reduces it to the stem of the word, e.g. *“denk”*, and adds the letter *“t”* to get e.g. *“denkt”* (as in *“ihr denkt”*, “you think”). So the composition looks as follows:
join strings https://www.wikifunctions.org/wiki/Z10000( stem German verb https://www.wikifunctions.org/wiki/Z11259( Argument reference( infinitive ) ), “t” )
… or see Figure 2 for the expanded view.
In this composition, there is one function call embedded in another. The inner function call, which returns the German stem, has an argument reference to the *infinitive*. This means that the argument with which the function is being called will be placed right in this place. Therefore, if you call the function with the argument *“denken”*, it turns into this function call:
join strings https://www.wikifunctions.org/wiki/Z10000( stem German verb https://www.wikifunctions.org/wiki/Z11259( “denken” ), “t” )
Then, by evaluating the inner function call, you get:
join strings https://www.wikifunctions.org/wiki/Z10000( “denk”, “t” )
And this finally evaluates to the result, *“denkt”*.
Figure 3 shows the status of the composition at the point where everything but the argument reference has been entered.
At this point, you have to expand the infinitive argument for the function call for stem German verb https://www.wikifunctions.org/wiki/Z11259. You do this by clicking the sideways-chevron (">") next to the label “infinitive”. This expands the fields, showing the type and mode and the (still empty) value (see Figure 4).
Now you switch the input mode from a literal String to an Argument reference (Figure 5). And this is where the previous workflow diverges from the new workflow. https://meta.wikimedia.org/wiki/File:Wikifunctions_-_function_argument_interface_changes03.png Figure 3: everything but the argument reference is in place. https://meta.wikimedia.org/wiki/File:Wikifunctions_-_function_argument_interface_changes04.png Figure 4: expanded *infinitive* field on the Function "stem German verb". https://meta.wikimedia.org/wiki/File:Wikifunctions_-_function_argument_interface_changes05.png Figure 5: selecting between the different modes for *infinitive* How did it work? https://meta.wikimedia.org/wiki/File:Wikifunctions_-_function_argument_interface_changes06.png Figure 6: how it was last week: Argument reference is chosen as the mode and we have now a textfield waiting for the key ID. https://meta.wikimedia.org/wiki/File:Wikifunctions_-_function_argument_interface_changes07.png Figure 7: the rather cryptic key ID filled out and ready to be published.
Figure 6 shows the previous status after selecting Argument reference. You were presented with an empty field labeled “key id”, and the field expected the editor to type in the key ID. What makes this worse is that the page did not show you the key ID anywhere (I usually copied it from the URL). The key ID is the ZID of the function you are implementing, plus a suffix for the position of the key you are looking for. In this case, since you were implementing Z11272 https://www.wikifunctions.org/wiki/Z11272 and there was only one key, the key ID was Z11272K1. You had to type that in, and were then able to publish the implementation (see Figure 7). How does it work now?
Last week we had our internal "Fix-It" week, where we focus on technical debt and smaller, but irritating, tasks. One of the projects that our colleague Genoveva https://meta.wikimedia.org/wiki/User:Geno_(WMF) tackled was to improve this workflow: once you have chosen “Argument reference”, instead of an empty text field for which you had to look up and write in a key reference, it now shows a dropdown field (see Figure 8).
Clicking on that dropdown field reveals the list of relevant arguments (see Figure 9). You select the argument (see Figure 10). Now you can even collapse the infinitive field into a single field, making the view even more compact (see Figure 11). https://meta.wikimedia.org/wiki/File:Wikifunctions_-_function_argument_interface_changes08.png Figure 8: how it is now: Argument reference is chosen as the mode and we have a dropdown field waiting for selection. https://meta.wikimedia.org/wiki/File:Wikifunctions_-_function_argument_interface_changes09.png Figure 9: by clicking on it, we see the available arguments. https://meta.wikimedia.org/wiki/File:Wikifunctions_-_function_argument_interface_changes10.png Figure 10: an argument was selected. https://meta.wikimedia.org/wiki/File:Wikifunctions_-_function_argument_interface_changes11.png Figure 11: collapsed view of the *infinitive* key with a selected argument reference. Why does it matter?
We want to make contributing functions, tests, and implementations as easy as possible. We believe that in order to achieve the goal of sharing a comprehensive library of natural language generation functions for hundreds of languages, we will need a lot of people to edit functions, tests, and implementations on Wikifunctions.
We followed a number of principles when improving this workflow: we reduced the cognitive workload necessary to complete the task, we hid identifiers from one more place in the user interface, and we made it considerably easier to complete the task on mobile devices. We hope that this will help with our goal of allowing more people to contribute to Wikifunctions effectively.
Congratulations to Genoveva for engineering, Amin for Design, and the team for working on and landing this improvement. Thank you all! Notes
1. ↑ https://meta.wikimedia.org/wiki/Abstract_Wikipedia/Updates/2023-10-04#cite_ref-1 It is possible to have functions with no arguments in Wikifunctions, e.g. nullary true https://www.wikifunctions.org/wiki/Z10210, but such functions are of limited practical use.
abstract-wikipedia@lists.wikimedia.org