Page MenuHomePhabricator

Phonos should be able to look for files in Wikibase
Closed, ResolvedPublic5 Estimated Story Points

Description

Phonos should have the ability to look for pronunciation and/or audio in Wikibase, as specified by the pronunciation audio (P443) and IPA transcription (P898) properties.

Acceptance criteria

  • The <phonos> parser tag should accept a wikibase= parameter that accepts a Wikibase item ID. If P443 exists for the given item, it should render its audio instead of using an Engine.
  • If a Lexeme is given, such as L7993, it should return the audio for that lexeme that matches the given language. The text= parameter is also required to make this work, and it must match the spelling of the given language variant for that lexeme.
  • If |audio= is also provided (T314068), that should have precedence over the Wikibase lookup. If no Wikibase item is found or the property is missing, it should use the configured Engine to render the audio.
  • There should be configuration settings for the properties to use (which would default to the Wikibase ones), since this won't be the same for other Wikibase installations (such as on the Beta Cluster).

Event Timeline

HMonroy renamed this task from Phonos handle Wikidata file to Phonos should be able to look for Wikidata files.Jul 28 2022, 4:10 PM

a |wikidata= parameter that accepts a page title.

I think this parameter should take a Wikidata ID (like other similarly-named parameters in many templates and modules). If we need to pass a pagename then it should be in a param named pagename or something. But I think you're right, and it's probably okay to fall back to the current sitelink.

I think this parameter should take a Wikidata ID (like other similarly-named parameters in many templates and modules). If we need to pass a pagename then it should be in a param named pagename or something. But I think you're right, and it's probably okay to fall back to the current sitelink.

Good point! Having wikidata= accept the Wikidata ID is probably sufficient, since those who know about Wikidata probably know which item they want.

Change 822694 had a related patch set uploaded (by HMonroy; author: HMonroy):

[mediawiki/extensions/Phonos@master] Allow Phonos to look for Wikidata files

https://gerrit.wikimedia.org/r/822694

HMonroy set the point value for this task to 5.Aug 17 2022, 5:06 PM
HMonroy renamed this task from Phonos should be able to look for Wikidata files to Phonos should be able to look for files in Wikibase.Sep 13 2022, 9:40 PM
HMonroy updated the task description. (Show Details)

Change 822694 merged by jenkins-bot:

[mediawiki/extensions/Phonos@master] Allow Phonos to look for audio files in Wikibase

https://gerrit.wikimedia.org/r/822694

QA notes: refer to https://www.mediawiki.org/wiki/Help:Extension:Phonos on usage. Specifically, note that when linking to a lexeme (such as L7993), you must also provide a value for the text= parameter, and it must exactly match the text for that language on Wikidata. This is to help ensure we use the correct one (since there are variations such as en-AU vs en-GB).

Here's the examples I used for testing:

  • <phonos wikibase="Q2" lang="it">Terra</phonos> – says "Earth" in Italian (terra)
  • <phonos wikibase="L7993" text="tomato" lang="en-au">Tomato</phonos> – "tomato" in Australian English

Change 832542 had a related patch set uploaded (by HMonroy; author: HMonroy):

[mediawiki/extensions/Phonos@master] Update $text check logic

https://gerrit.wikimedia.org/r/832542

@HMonroy Please review screenshot errors if they are as expected. Thanks!

Language change- Error when played, "No audio found for Wikibase item: L7993
Text change- Error when played, "No audio found for Wikibase item: L7993
Lexeme change- See screenshot (F35535574)

Config Changes on wgPhonosWikibaseProperties
wikibasePronunciationAudioProp: See screenshot- (F35535578)
wikibaseLangNameProp: See screenshot- (F35535580)
wikibaseIETFLangTagProp: Nothing changes

Lexeme Change.png (722×1 px, 182 KB)

AudioProp Change in LS.png (867×2 px, 237 KB)

NameProp Change in LS.png (1×3 px, 494 KB)

@GMikesell-WMF for the Language change and Text change the errors look as expected. We can change them to be more specific if needed, but for the Lexeme change (which I'm assuming is a Lexeme that doesn't exist). I tried L725323 it should not be that error. I will also look in to the config changes. I will need to submit another patch to fix those errors.

Would it be easier for you to create a new ticket or keep this ticket and move it to development?

Thank you!

NameProp Change in LS.png (1×3 px, 494 KB)

I think another way to reproduce this error (without having to change the configuration on the server) is with wikitext like:

<phonos ipa=be text=be wikibase=L1883 lang=en />

(Thanks to @SDunlap for finding the above lexeme which causes this.)

@HMonroy Do we want to support the case where a Lexeme has the same pronunciation audio for multiple languages (e.g. like https://wikidata.beta.wmflabs.org/wiki/Lexeme:L45594)?

In the above example, the same audio is used for English and Canadian English:

tomato_english_canadian.png (276×889 px, 20 KB)

However, if I point my local to beta with:

$wgPhonosWikibaseUrl = "https://wikidata.beta.wmflabs.org/wiki/";
$wgPhonosWikibaseProperties = [
	"wikibasePronunciationAudioProp" => "P253139",
	"wikibaseLangNameProp" => "P253094",
	"wikibaseIETFLangTagProp" => "P253140"
];

and try a phonos tag like:

<phonos ipa=ˌæpəˈlætʃə text=tomato wikibase=L45594 lang=en-CA />

It will return an error ("No audio found for Wikibase item: L45594"). Setting lang=en does work.

I don't know if this will actually occur in production, but it is theoretically possible.

@HMonroy If a Lexeme has two forms which are spelt the same way, is there a way to specify which form you want?

For example, I created https://wikidata.beta.wmflabs.org/wiki/Lexeme:L45636 with a singular form of "sheep" and a plural form of "sheep".

At the moment, <phonos ipa=sheep text=sheep wikibase=L45636 lang=en /> just returns the audio for the singular form.

It is a bit of a contrived example. I don't know in reality if there are words with two different forms spelt the same way but pronounced differently.

@GMikesell-WMF for the Language change and Text change the errors look as expected. We can change them to be more specific if needed, but for the Lexeme change (which I'm assuming is a Lexeme that doesn't exist). I tried L725323 it should not be that error. I will also look in to the config changes. I will need to submit another patch to fix those errors.

Would it be easier for you to create a new ticket or keep this ticket and move it to development?

Thank you!

We will move it to Development. Thanks!

@HMonroy If a Lexeme has two forms which are spelt the same way, is there a way to specify which form you want?

For example, I created https://wikidata.beta.wmflabs.org/wiki/Lexeme:L45636 with a singular form of "sheep" and a plural form of "sheep".

At the moment, <phonos ipa=sheep text=sheep wikibase=L45636 lang=en /> just returns the audio for the singular form.

It is a bit of a contrived example. I don't know in reality if there are words with two different forms spelt the same way but pronounced differently.

Great question!! How do you find these cases?!?!? @Samwilson should we use Grammatical features param to check for these cases? Otherwise, like @dom_walden pointed out, it would return the first find. Although for this sheep situation, it sounds like one file should be UK English and the other US English.

Change 838064 had a related patch set uploaded (by Samwilson; author: Samwilson):

[mediawiki/extensions/Phonos@master] Allow only 'wikibase' attribute

https://gerrit.wikimedia.org/r/838064

Change 838273 had a related patch set uploaded (by HMonroy; author: HMonroy):

[mediawiki/extensions/Phonos@master] Check if `wikibaseLangNameProp` exists

https://gerrit.wikimedia.org/r/838273

@HMonroy Please review screenshot errors if they are as expected. Thanks!

Language change- Error when played, "No audio found for Wikibase item: L7993
Text change- Error when played, "No audio found for Wikibase item: L7993
Lexeme change- See screenshot (F35535574)

This looks as expected. The server may return Not Found (https://www.wikidata.org/wiki/Special:EntityData/L799333.json) or Bad Request (https://www.wikidata.org/wiki/Special:EntityData/L79933333333333.json) depending on the value of the entity.

Config Changes on wgPhonosWikibaseProperties
wikibasePronunciationAudioProp: See screenshot- (F35535578)

I think you were testing this before we merged this patch. You should not see those errors anymore... crossing fingers

wikibaseLangNameProp: See screenshot- (F35535580)

Good find, I just submitted: https://gerrit.wikimedia.org/r/838273 to fix this issue

wikibaseIETFLangTagProp: Nothing changes

We should see the error`No audio found for this..`

Lexeme Change.png (722×1 px, 182 KB)

AudioProp Change in LS.png (867×2 px, 237 KB)

NameProp Change in LS.png (1×3 px, 494 KB)

Change 838064 merged by jenkins-bot:

[mediawiki/extensions/Phonos@master] Allow only 'wikibase' attribute

https://gerrit.wikimedia.org/r/838064

@HMonroy

Config Changes on wgPhonosWikibaseProperties
wikibasePronunciationAudioProp: See screenshot- (F35535578)
I think you were testing this before we merged this patch. You should not see those errors anymore... crossing fingers

This looks to be resolved since I do not see this issue anymore as seen in screenshot (F35550693)

Phonos_AudioPop_PASS.png (712×1 px, 234 KB)

wikibaseLangNameProp: See screenshot- (F35535580)
Good find, I just submitted: https://gerrit.wikimedia.org/r/838273 to fix this issue

Sounds good, just keep us posted when we can test it out again. Thanks!

wikibaseIETFLangTagProp: Nothing changes
We should see the error`No audio found for this..`

Ok the error does show up as seen in (F35550689) which is as expected

Phonos_LangTagProp_Edit.png (668×1 px, 239 KB)

My Notes:
Link tested: http://localhost:8080/wiki/Phonos
Edit and Save first before testing the Phonos property changes

Change 838273 merged by jenkins-bot:

[mediawiki/extensions/Phonos@master] Update logic that check if `PhonosWikibaseProperties` exist

https://gerrit.wikimedia.org/r/838273

@HMonroy

wikibaseLangNameProp: See screenshot- (F35535580)
Good find, I just submitted: https://gerrit.wikimedia.org/r/838273 to fix this issue
Sounds good, just keep us posted when we can test it out again. Thanks!

The error does not occur anymore as seen in the screenshot. The task will now be moved to product sign-off. Thanks!

Phonos_LangNameProp_PASS.png (748×2 px, 230 KB)

Just a note for @NRodriguez. There are at least two outstanding questions for which we might want to make follow up tasks: T314067#8272871 and T314067#8272938.

Let me know if you would like me to create tasks for either/both of those.

Also see https://miro.com/app/board/uXjVPRtFwHI=/

For the issue of multiple languages on a file, I've got a fix (as part of T319270).

@dom_walden yes, let's make new tasks for those and going to resolve this one! Sounds like Sam was a partial fix for one of them.

@dom_walden mind making those and I will drag them into sprint 36-37 we can triage in planning?