Wikifunctions:Project chat/Archive/2024/02

From Wikifunctions


Wikifunctions & Abstract Wikipedia Newsletter #141 is out: The Igbo Imperative!

There is a new update for Abstract Wikipedia and Wikifunctions. Please, come and read it!

In this issue, we focus on language functions in Igbo, a language spoken by more than 44 million people in South-Eastern Nigeria. Also, we take a look at the latest software developments.

Starting from this issue, the status updates will be hosted on Wikifunctions, instead of Meta. One more step towards maturation of the project!

Want to catch up with the previous updates? Check our archive (on Meta)!

Also, we remind you that if you have questions or ideas to discuss, the next Volunteers' Corner will be held on February 5, at 18:30 UTC (link to the meeting).

Enjoy the reading! -- User:Sannita (WMF) (talk) 09:14, 2 February 2024 (UTC)

This section was archived on a request by: Sannita (WMF) (talk) 11:39, 13 February 2024 (UTC)

Wikifunctions & Abstract Wikipedia Newsletter #142 is out: Quarterly planning. Thank you, Nick! Function of the Week: is permutation

There is a new update for Abstract Wikipedia and Wikifunctions. Please, come and read it!

In this issue, we discuss about the results of our last internal planning meeting, whose objective was to define what we will work on in this quarter. Also, we take a look at the latest changes in the team and the latest software developments.

Want to catch up with the previous updates? Check our archive on Wikifunctions and also on Meta.

Enjoy the reading! -- User:Sannita (WMF) (talk) 16:22, 8 February 2024 (UTC)

This section was archived on a request by: Sannita (WMF) (talk) 12:27, 3 March 2024 (UTC)

Wikifunctions & Abstract Wikipedia Newsletter #143 is out: Fix-it week

There is a new update for Abstract Wikipedia and Wikifunctions. Please, come and read it!

In this issue, we take a look at the latest software developments, after our monthly "fix-it week", where we work on technical debt and other issues that pile up in our daily work.

Want to catch up with the previous updates? Check our archive on Wikifunctions and also on Meta.

Enjoy the reading! -- User:Sannita (WMF) (talk) 18:19, 16 February 2024 (UTC)

This section was archived on a request by: Sannita (WMF) (talk) 12:27, 3 March 2024 (UTC)

Wikifunctions & Abstract Wikipedia Newsletter #144 is out: Updating the function model

There is a new update for Abstract Wikipedia and Wikifunctions. Please, come and read it!

In this issue, we present the new documentation about our function model and we take a look at the latest software developments.

Want to catch up with the previous updates? Check our archive!

Enjoy the reading! -- User:Sannita (WMF) (talk) 09:55, 23 February 2024 (UTC)

This section was archived on a request by: Sannita (WMF) (talk) 12:27, 3 March 2024 (UTC)

Stuffs that annoys me

After a bit of trying to code little stuffs in Wikifunctions, I want to leave a note about something that annoys me with the UI.

When you want to input something in the UI, when creating a function by composition for example, you first have to select an object type, then select some thing of that kind. In the process it happens that you are unsure about which kind of object you want to use, you try to select something, by entering some text, but if you change your mind and want to explore another kind of object you lose that input and have to start over if you go back to the initial object kind.

This is subpar with editing code in textual format for example. In C code if you realized that you had an int pointer and instead it should have been an integer, or vice versa, you could just remove the "*" character for example. It’s a small thing but I know this can get annoying. (I think it’s akin to the Wikidata UI, if you have the value right but realize the property is wrong you have to input the value again) TomT0m (talk) 10:43, 7 February 2024 (UTC)

@TomT0m Thanks for your feedback. I already reported it to the team, and we'll see if we can act upon it. I'll let you know about it, but feel free to ping me if I don't come back to you. Sannita (WMF) (talk) 15:53, 8 February 2024 (UTC)

Template for connection requests on Talk Page

Hi everyone! I'm proposing the creation of a template for our function's talk page that users can utilize to request connections. This template will categorize the page into specific categories, facilitating our Functioneers in reviewing all submitted connection requests efficiently. Additionally, it could specify whether the connection is for a test page, implementation, or both. If there's already a similar special page in existence, that would be great too. Regards, Asked42 (talk) 16:32, 6 February 2024 (UTC)

That sounds like a great idea - I don't know if there is already a special, but it would be great to know what things already exist but are not connected --DannyS712 (talk) 00:17, 13 February 2024 (UTC)

Template using LangSwitch

Hi all! Just wanted to report this old discussion about template having embedded translations. Maybe someone can help me take care of this? Sannita (WMF) (talk) 15:52, 8 February 2024 (UTC)

@Sannita (WMF) Hello, I want to help you, but I don't have the translation-admin right :( I should be well aware of the use of the translate tag (e.g. on Meta), but I don't have this right on any wiki. So I just offer my comment (sorry if you know this): it would be easier if you duplicate the page elsewhere, replace LangSwitch with only English sentences, and mark the page for translation to finish. If there is anything else I can do to help, I will gladly help. --Tmv (talk) 06:05, 12 February 2024 (UTC)

A newbie is came and needs help...

Hello, i'm a newbie in there. I have a medium amount of technical info but the structure of this wiki is very confusing. I'm tried to create a JS function but i could not do that. How can i attach JS to Untitled (Z13077)? (I wanted to create it as multilangual but i could not create it in languages other than Turkish...) RuzDD (talk) 23:20, 8 February 2024 (UTC)

@99of9 Looks like you're one of a few users who are active... RuzDD (talk) 23:28, 8 February 2024 (UTC)
Also, why codes are in public domain instead of CC BY-SA or GFDL? RuzDD (talk) 23:34, 8 February 2024 (UTC)
The licenses you mention are best suited to documentation and other types of prose. Code usually has a code-specific license. Arlo Barnes (talk) 20:32, 10 February 2024 (UTC)
@Arlo Barnes Thanks. By the way, what i can do without being a functioneer? RuzDD (talk) 20:53, 10 February 2024 (UTC)
@RuzDD: In the "Implementations" box, click the plus sign. Then on the Create a New Implementation page, switch the "Implementation" radiobutton to "code", then choose javascript in the "select programming language" dropdown. Then fill in the prestructured function, and press publish. --99of9 (talk) 23:50, 8 February 2024 (UTC)
@99of9 Where is the "Implementations" box? RuzDD (talk) 23:52, 8 February 2024 (UTC)
@RuzDD: in the right column of Untitled (Z13077), about halfway down. See the attached image for a similar more complete function. --99of9 (talk) 00:27, 9 February 2024 (UTC)
function page
function page
Thanks, there's some language problems (not a technical problem, a problem with texts on pages). In my device it reads "Uygulamalar" and it failed me, it must write "Uygulamalar (Implementations)" (both my language and English) to make the newbies, includiing me, understand more rapidly. RuzDD (talk) 01:26, 9 February 2024 (UTC)
@99of9 There's a problem: i cannot connect the function and implementation. It says i don't have enough permissions. How can i get these permissions? RuzDD (talk) 02:25, 9 February 2024 (UTC)
@TomT0m As i understand i must be a functioner to attach functions and imlementations, right? If yes, what can i do to be trusted in there? RuzDD (talk) 02:26, 10 February 2024 (UTC)
Yes, that is the permission required. I have trouble understanding the purpose of the function you've written. Can you include some test cases before we connect it? It seems like it may be related to handling Flash embedded in web pages. We don't currently have object types like that. Maybe try playing with some existing/simpler functions first. --99of9 (talk) 22:54, 11 February 2024 (UTC)
@99of9 Wikifunctions currently does not permit test cases with HTML bases as i understand, but i can explain the planned usage case. You can create an HTML page with the body content <div class="wiki-swflash-container" id="filename.swf" style="width:768px;height:576px;"></div> and it must play the filename.swf if you include that script and run the function. trustedStart=0 means all movies can be played, =1 means movies from untrusted locations will be played if the user permits, =2 means movies from untrustec locations will not play.
This code will detect if you have Flash Player installed and won't activate emulator in this case, but if you don't have a Flash Player it will activate Ruffle. Ruffle may not work if you try this at local but it will work on the server side.
I'm trying to prepare the codes before proposing enabling Shockwave Flash playing and uploading on wikis, so concerns about the technical side will not be too much. RuzDD (talk) 03:47, 12 February 2024 (UTC)
I've connected it for you, but it didn't seem to work when I pasted that body content in as the string parameter. --99of9 (talk) 04:09, 12 February 2024 (UTC)
@99of9 No, the body content is not for string parameter :) But, seems like the problem is on Wikifunctions itself because it worked when i'm tried it on local. If you add this string (body content) to somewhere of the page (of course change filename.swf with an existing file path for example https://old.homestarrunner.com/sbemail50.swf) using developer tools and then run this function with the trustedStart value of 0 or 1, it must play the movie in somewhere on the screen but it does not do that. In fact, it does not give this function to me at all (when i wrote SWF-RIW(1); to my console, it says "SWF_RIW" is undefined). How we can solve this problem? RuzDD (talk) 04:23, 12 February 2024 (UTC)
I even cannot get a function named Z13077 or Z13080 on my console... 07:54, 14 February 2024 (UTC) RuzDD (talk) 07:54, 14 February 2024 (UTC)
I'm afraid that you seem to be expecting features and data-types that are not yet available on Wikifunctions. I'm not completely sure if they ever will be, but what you're hoping for is well beyond the bounds of what Wikifunctions currently does. If you can't write it as a testable deterministic function of the string parameter (without access to other pages on the internet), then I don't think this function is suitable for wikifunctions yet. --99of9 (talk) 04:47, 15 February 2024 (UTC)
@99of9 As i understand, these code pieces are currently running at server side. This is the only thing that prevents this function from running as expected. I think client-side code running feature can come in soon or semi-soon, and this function will be running when it came. In fact, this function is expected to return void and it does that. When client-side running and access from other wikis features came, this function will be able to usage with full freedom. RuzDD (talk) 05:32, 15 February 2024 (UTC)
@RuzDD: For other languages, in the "About" box on the left of the function page, at the bottom it currently says "1 language". If you click that box, it will give you a place to add more languages. --99of9 (talk) 23:51, 8 February 2024 (UTC)
Can i make my function language-independent, so it'll work in all languages while i made only one function? RuzDD (talk) 01:28, 9 February 2024 (UTC)

Handling capitalisation in language functions

How should we handle capitalisation in morphemes? Do we need functions to do their own tests on the input capitalisation, or should we concentrate on getting the lowercase versions right then either sanitising the input or wrapping the function with a case checker. WALK: handle capitalisation? (Z13217) is a simple example. --99of9 (talk) 07:26, 16 February 2024 (UTC)

Basically, I think morphological functions should be case-insensitive. As I see it, the problem is that their inputs are typically “strings”, but in our functions we need to distinguish between “lemmas” and “forms”. The -ed form of the lemma “walk” is “walked”. The string “WALK” is (I would argue) a reference to the lemma “walk”, so the -ed form is also “walked”. If I input a form that differs from the lemma (“walks”, for example), I will get a result that is not valid (“walksed”); the function assumes its argument is a lemma. Ideally(?), this assumption would be explicit in the type of the input, but types of strings appear not to be a priority. As it stands, the input could also be a phrase (like “I walk to work.”) and this will also give odd results (“I walk to work.ed”). I wouldn’t want to say we should disallow phrases (because “walk out”, for example, is a perfectly reasonable lemma, with the form “walked out”) but we should have a way to make it clear that, in fact, the function can only handle a phrase with the verb at the end. What we do about trailing spaces and punctuation is another question, but I note that an iPhone (with an English keyboard) tends to default to an initial capital and a trailing space, so I would be inclined to treat that as one of the formats that morphological functions should expect (which I haven’t done, so far). GrounderUK (talk) 10:14, 16 February 2024 (UTC)

Optional / default parameters

Question for the future, but … I accidentaly recreated a prototype for the (left) "fold" function, before realizing there was already one (and that we can’t implement it due to the fact the current "apply" function trick does not work for binary functions)

But it does not seem to be a duplicate because my function signature is different : right fold (Z12753) vs. fold left (Z13076)

The initial signature created by @99of9 does not include a parameter for the initial value of the accumulator variable, assuming there is a default value for the type that will initiate the fold, whereas in functional programming languages like Haskell or Caml, there is an initial value like "0" to initialize the computation (and the accumulator parameter helps with tail recursion implementation)

In languages like Javascript the parameter is provided as an optional value.

I don’t know what to do about these information, as anyway it seems impossible to implement it but the question of handling optional parameters and default values seems relevant, so maybe a discussion about it is possible. Are there plans ?

The question is also, should we delete functions and chose between right fold (Z12753) vs. fold left (Z13076) in such a case (a delete does not seem harmful if there is no implementation). TomT0m (talk) 18:21, 8 February 2024 (UTC)

I also made a shell for left fold (Z12781). I don't have any substantive answer to your question. If it's useful, I don't mind adding a parameter that gets left blank when unused. --99of9 (talk) 22:53, 8 February 2024 (UTC)
It’s true that a function signature can change in Wikidata, I believe this could be a problem as the signature is kind of part of the identity of the function, and changing its signature could break code that depends on it.
Watching the implementations written in python like Right fold, python (Z12915): no description in imperative style, it seems they does not use an accumulator as a parameter and instead use on end of the list for that, using list mutation. I guess that could work if you tolerate the mutation of the list, and that does not affects the initial list in the case of Wikidata as the function call are isolated.
To elaborate on the parameter in functional programming, if you write fold in imperative style, you’ll end up with something like
:: acc = initial_value
:: for elem in list:
::    acc = operation(acc, elem)
::
in functional style the analog could be
::fold(operation, acc, list)
:: if is_empty(list):
::     return acc
:: else:
::     return fold(operation, operation(acc, first(list)), rest(list))
::
That’s something I would try if we were to implement this in functional style, I think, but maybe the approach of using and end of the list to store could be also used. At the cost of building new lists, but maybe this is necessary anyway in the wikifunction case.
and a compiler could rewrite the one in functional style, in that case, exactly as a loop, this in an important optimization in functional programming as mutating the list can imply many copies and then can be costly.
But maybe this is useless to bother about this kind of optimization in WikiFunctions as the optimisations are supposed to be handled by the compilers / interpreters for the best implementation and not by the the "composition" engine ? But in a case like this when a call to a wikifunction is handled by an implementation would it matter because maybe that would confuse the interpreter / compiler and there would be many context switch between different execution engine ? TomT0m (talk) 09:58, 9 February 2024 (UTC)
FYI The inbuilt Reduce Function (Z876), does have an initial object. --99of9 (talk) 00:25, 20 February 2024 (UTC)

Public API for Wikifunctions

I read the latest status update for Wikifunctions. This update offers an overview about the plans for the next months. One point in this status update was establishing an public API. I think external Websites escpecially commercial ones should use their own mechanisms to calculate things. I support a public API for editing Wikifunctions. Making it possible to use a public API could lead to an development of a commercial offer from Wikimedia Enterprise for using Wikifunctions as an external service to calculate some things. Wikifunction functions call should not be commerzialized from my point of view. If people want to use functions they can copy the function and reuse it offline or build their own service. In the last weeks I experimented with parsing the Wikifuncions dump and extracting functions out of if it and creating one file per function. Additional with a script to embed a function into a HTML-page with java script included in it. The scripts to do it are not ready yet and it is important that people check the functions before using it offline. I am interested in extending support to reuse functions offline. Hogü-456 (talk) 17:23, 11 February 2024 (UTC)

@Hogü-456 For now, the plan is to just create the API for the community to use it, probably with some stricter rules than the ones that WMF usually applies to its free APIs (because calling a function will be more expensive than fetching a page). As for its commercial reuse, we currently have no plans about it - and probably it's too soon to worry about it, since we still need to build an API first. Sannita (WMF) (talk) 15:01, 12 February 2024 (UTC)
@Hogü-456: You inspired me to do a little analysis myself: #Maintenance. --Azertus (talk) 18:03, 28 February 2024 (UTC)

lexeme template?

on wikidata I could do {{lexeme|1337}} to link a lexeme with autolabel (see for example the source of d:WD:HUMOUR#Surprise L lexemes). this seems useful for planning abstractwiki, so perhaps it should be imported. Arlo Barnes (talk) 09:24, 28 February 2024 (UTC)

Maybe if {{Label}} could be enhanced to work for lexemes (and Wikifunctions objects)? By the way, @DVrandecic (WMF) do you think we should exclude Q, P and L from the capital letters of the Latin alphabet that indicate a Z9/Reference (per Wikifunctions:Function model#Canonical form)? Or is it your cunning plan to have special handling for Wikidata IDs? GrounderUK (talk) 09:51, 1 March 2024 (UTC)
That set the cogs turning, so I sort of answered my own question in Wikifunctions:Type proposals/Typed string. GrounderUK (talk) 21:22, 1 March 2024 (UTC)

Maintenance

I started a basic page at Wikifunctions:WikiProject Maintenance. I took a look at the latest dump and found that there's currently 693 functions. Of those, 178 had no (connected) tests and 515 had at least one test. Does the magnitude of those numbers look correct? I created a sorted list, so we can easily focus on functions lacking tests. If there's interest, I could probably update that page by bot. I also might try adding the number of unconnected tests, which seems to be a little more involved. --Azertus (talk) 17:59, 28 February 2024 (UTC)

@Azertus: Thank you for starting this work! Thought numbers sound plausible. In the medium-term, we should build some first-party tools to help find some of those.
You should probably exclude the core functions (ZID < 10000), as that's more on the development team than the wider Wikifunctions community, or at least split them out? Jdforrester (WMF) (talk) 18:05, 28 February 2024 (UTC)
Thanks! I've split out the core functions and added the total number of tests. Azertus (talk) 21:14, 29 February 2024 (UTC)
@Azertus: Thank you. :-) For others wondering, note this shows the problem Azertus reported with tests connected to the wrong function in some cases, e.g. "-5" approved tests on German noun, -(e)n/-innen declension (Z11722); hopefully we'll get it fixed soon. Jdforrester (WMF) (talk) 14:25, 1 March 2024 (UTC)
This will be very useful. Next update, do you mind removing the "uk" language specification in the links? --99of9 (talk) 02:12, 1 March 2024 (UTC)
Sure, but it's not there (the links are bare ZIDs wrapped in brackets)! Yesterday, after I followed a link to a different language Wikimedia project (this could be a red herring), the links suddenly changed for me (pointed to "uk"), including in a private session. I never expected that others would experience the same! After a while, however, they seemed to have "reverted" again (to the, for me, correct English targets). I have no idea which mechanism might be responsible for this... --Azertus (talk) 19:28, 1 March 2024 (UTC)
Whoah, spooky! --99of9 (talk) 23:58, 1 March 2024 (UTC)
Great enhancement, thank you! I wonder if it would be useful if we could tell the difference between functions that are in Wikifunctions:Catalogue and those that are not?
I derived the list at Wikifunctions talk:Catalogue from Special:ListObjectsByType/Z8, but I’m thinking I might base the next update on your report, for ease and consistency. If you could extend your report to include this difference, we could simply refer to your report in future. I would hope that Catalogued functions tend to have more tests, but it is not easy to see whether this is so when the lists are separate.
It would also be useful to see which functions have no connected implementations (or how many are connected and how many unconnected) but maybe we risk having too many columns and losing focus on tests? GrounderUK (talk) 09:21, 1 March 2024 (UTC)
I was thinking the same about implementations, so I might take a stab at including those. I might experiment with just putting them in a different table. First, I'm planning to set up an automated process to keep the table up-to-date.
I'm not 100% sure which modification you'd like to see with regards to the catalogue. Would you like a table with only those functions missing from (or present on?) the Catalogue page, or a column indicating whether the function is present on the Catalogue, or ... ? --Azertus (talk) 19:34, 1 March 2024 (UTC)
Thank you for considering this. I think a narrow extra column would be best, because not everyone will care whether the function is catalogued. You might like to consider supporting sort by ID, since that will give us a view of how older functions compare with newer ones. That probably means an extra column, though… 🙏 GrounderUK (talk) 21:15, 1 March 2024 (UTC)