Abstract Wikipedia/Updates/2023-10-04

Abstract Wikipedia Updates Translate

Abstract Wikipedia via mailing list Abstract Wikipedia on IRC Wikifunctions on Telegram Wikifunctions on Mastodon Wikifunctions on Twitter Wikifunctions on Facebook Wikifunctions on YouTube Wikifunctions website Translate

Arguments made easier edit

As of today, referencing arguments has become considerably easier.

 

What does this mean? edit

 
Figure 2: expanded composition for generating the verb form for the German second person plural.

Every function has arguments.[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: 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( stem German verb( 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( stem German verb( “denken” ), “t” )

Then, by evaluating the inner function call, you get:

join strings( “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. 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.

Figure 3: everything but the argument reference is in place.
Figure 4: expanded infinitive field on the Function "stem German verb".
Figure 5: selecting between the different modes for infinitive

How did it work? edit

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.
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 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? edit

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 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).

Figure 8: how it is now: Argument reference is chosen as the mode and we have a dropdown field waiting for selection.
Figure 9: by clicking on it, we see the available arguments.
Figure 10: an argument was selected.
Figure 11: collapsed view of the infinitive key with a selected argument reference.

Why does it matter? edit

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 edit

  1. It is possible to have functions with no arguments in Wikifunctions, e.g. nullary true, but such functions are of limited practical use.