Page MenuHomePhabricator

Design an Intuitive Lexeme Sense Selection UI
Closed, ResolvedPublic

Assigned To
Authored By
DSmit-WMF
Jul 7 2025, 9:09 AM
Referenced Files
F65686624: Screenshot 2025-07-28 at 12.59.46 PM.png
Jul 28 2025, 5:11 PM
F65672986: Screenshot 2025-07-25 at 5.26.33 PM.png
Jul 25 2025, 4:39 PM
F65667851: image.png
Jul 24 2025, 5:40 PM
F65667794: image.png
Jul 24 2025, 5:40 PM
F65667784: image.png
Jul 24 2025, 5:40 PM
F65667768: image.png
Jul 24 2025, 5:40 PM
F65667743: image.png
Jul 24 2025, 5:40 PM
F65667739: image.png
Jul 24 2025, 5:40 PM

Description

Wikifunctions increasingly uses Wikidata lexeme senses as inputs in community-contributed functions. However, there is currently no dedicated user interface for selecting lexeme senses, making it difficult and error-prone for users to enter them manually (e.g., L123-S2).

A dedicated UI component would provide significant improvements in usability, clarity, and consistency — similar to how lexeme form selection already works in Z6824.

Currently, direct API-based search for lexeme senses (the same way we do now for Lexeme forms) is limited or non-functional (e.g., wbsearchentities with type=sense returns no results, even though documented). This technical constraint affects what kind of interaction model is feasible.

Design Goal

Create a user-friendly component for selecting a Wikidata lexeme sense, suitable for use in the frontend.

The solution should:

  • Allow users to find and select a valid lexeme sense
  • Work within current Wikidata API limitations
  • Fit into the editing workflow for ZObjects
  • Degrade gracefully if sense (metadata) is missing or malformed
  • It might be relevant to check if the selection for Lexeme Forms also needs revisiting?

Design Considerations

  1. Edge cases
  2. lexeme does not have senses
  3. long or verbose sense texts
  4. Identical or Very Similar Sense Descriptions.
    • More examples
    • And even more examples (fully duplicate senses in the list for 1 lexeme)
    • suggestion show additional metadata:
      • Gloss language
      • Sense ID or Wikidata link
  5. Lexeme Has Many Senses (10/20+) (dont know if thats happening)

Two-step model (suggested, but not required)

A possible UX pattern is to have users:

  1. Search/select a lexeme first (via API wbsearchentities)
  2. Then choose a sense from the selected lexeme (via API wbgetentities)

This would bypass the need to directly search across all senses and aligns with current API support.

Example Flow:

Search LexemeSelected LexemeSelect Lexeme senseSelected Lexeme sense
Screenshot 2025-07-07 at 12.46.11.png (1,280×954 px, 100 KB)
Screenshot 2025-07-07 at 12.46.17.png (1,292×558 px, 45 KB)
Screenshot 2025-07-07 at 12.45.52.png (1,300×746 px, 67 KB)
Screenshot 2025-07-07 at 12.45.47.png (1,284×736 px, 55 KB)

Deliverables

  • One or more proposed UX flows for lexeme sense selection
  • Wireframes or Design of:
  • Design notes or rationale for the selected approach
  • Error/degraded states (e.g., no glosses/senses)

Technical Constraints (for reference)

  • wbsearchentities with type=sense does not return results, so a direct search for lexeme senses might/will not be possible.
  • Sense glosses are often missing or incomplete
  • Sense selection is based on lexeme sense IDs, e.g., L456-S1
  • Glosses are language-specific and may require language context in the UI

Examples

Lexeme Form

A form is a specific inflection or variation of the lexeme based on grammatical features such as tense, number, gender, etc.

Forms are stored under the lexeme and identified as F-number, like L279-F1.

Each form has:

  • A spelling
  • Grammatical features (like plural, past tense, etc.)

🔹 Example:

Lexeme: run (English, verb)

  • Form 1 (L279-F2): "runs" (third-person singular present)
  • Form 2 (L279-F3): "ran" (simple past)
  • Form 3 (L279-F4): "running" (present participle)

Lexeme Sense

A sense represents a meaning or definition of the lexeme. Lexemes can have multiple senses, each describing a different usage or interpretation.

Senses are identified as S-number, like L123-S1.

Each sense has:

  • A gloss (definition in natural language)
  • Optional links to Wikidata items (semantic equivalents)

🔹 Example:

Lexeme: bank (English, noun) (

  • Sense 1 (L3354-S1): A financial institution
  • Sense 2 (L3354-S2): Dry ground next to river

Proposed design

Default view1. Lexeme selection2. lexeme sense
You have 2 input fields. One for Lexeme selection and the second for lexeme sense selection which is disabled by default and it is enabled when a lexeme is selectedYou first select the lexemeSelect the lexeme sense
image.png (750×1,334 px, 59 KB)
image.png (750×1,334 px, 85 KB)
image.png (750×1,334 px, 55 KB)
image.png (750×1,334 px, 109 KB)
If a lexeme has no senses the dropdown remains disabled and a message is shown informing the use of this with a link to the lexeme as a CTA
image.png (750×1,334 px, 69 KB)

Edge cases

Lexeme Gloss language:
We show the lexeme senses gloss in the selected language of the page.
If a lexeme sense does not have a gloss in the page language we follow this fallback:

  1. Gloss in language of page
  2. Statement of the sense in language of the page (label: item description)
  3. Gloss in another available language

long or verbose sense texts:
Display it in full.
If a long sense is selected the dropdown is truncated to 1 line

image.png (750×2,166 px, 208 KB)
image.png (750×1,334 px, 56 KB)

Identical or Very Similar Sense Descriptions:We would show them

Lexeme Has Many Senses (10/20+) : We would show them

View mode

For view mode would display Lexeme senses like this:

Lemma: Sense gloss in the language of the page (following the same fallbacks as above)

Screenshot 2025-07-28 at 12.59.46 PM.png (1,248×478 px, 70 KB)

Event Timeline

DSmit-WMF updated the task description. (Show Details)
gonyeahialam changed the task status from Open to In Progress.Jul 7 2025, 1:44 PM
gonyeahialam claimed this task.

Lexeme Sense selection UI design exploration
I understand that Lexemes and sense are not exactly the same thing as words and definitions, permit me to use them interchangeably. When a word has multiple definitions and you want to find it, you will first of all think of the word then think of the definitions like in the dictionary. Also definitions/senses are phrases or sentences and not 1 word so it is going to be more difficult to search directly for them. As a result, a direct search for lexeme senses may not be the best experience.

A side note on Lexeme forms @DSmit-WMF : unlike senses, for forms one doesn't need to think of run before ran or running and since they are one word (instead of phrases) it can be searched for directly. So we can keep the currently Lexeme form implementation except there are specific use-cases that require a change.

Back to Lexeme senses. Searching for the lexeme before selecting a sense is a better approach. Here are the suggested design patterns to use for this (I created a live prototype using Codex components to try them out):

Idea 1 - Two-step selectionIdea 2 - Grouped Direct Selection
First select a lexeme, then choose from its available senses.Search for a lexeme, the lexeme and its available senses are shown then you select a sense.
Screen Recording 2025-07-08 at 6.18.52 PM.gif (740×1,850 px, 248 KB)
Screen Recording 2025-07-08 at 6.19.21 PM.gif (256×640 px, 593 KB)

Analysis
Idea 2 has the advantage of a single selection but when you search for a word, often there a multiple lexemes that match same word. For example when you search for bank lexeme in Wikifunction you would see about 13 results that match this (shown in the first image below). In idea 2, this would mean that all the 13 lexemes and their corresponding senses would be shown on the list ( shown in the 2nd image below or the gif above). This is a lot of information that would be shown to the user at once. In idea 1, when searching for a lexeme (e.g. "bank"), you see 13 lexemes only and when searching for the senses, you see only the senses for the Lexeme you chose earlier.

Searching in WikifunctionsSearching in Idea 2
Screen Recording 2025-07-08 at 6.35.42 PM.gif (740×1,478 px, 342 KB)
Screenshot 2025-07-08 at 6.33.01 PM.png (740×1,574 px, 170 KB)

Proposed solution - Idea 1
My proposal would be to go with Idea 1 as @DSmit-WMF suggested but make the lexeme sense dropdown always visible but disabled by default and enabled when the user selects a lexeme as shown in the first gif above. This is will enable the user understand the complete task scope upfront and know that they need to make two related selections.

Next step
Since most of you have already shown approval for idea one as Daphne proposed, I will go ahead with this. Next, I would explore some edge cases like how to deal with the languages of different senses.

Edge cases

lexeme does not have senses

Notify the user and still allow them to select it and if they do, show them the CTA to add to wikidata hyperlinked to the Lexeme page

image.png (750×1,334 px, 88 KB)
image.png (750×1,334 px, 69 KB)

@DSmit-WMF can we know before lexeme selection whether they have senses or not?

long or verbose sense texts

Normally we can truncate this but since they are not many senses that are very long and since it will be important to read the full sense description to make the right selection and if truncated the only way to do that would be to go to wikidata, I propose displaying it in full.
If a long sense is selected the dropdown is truncated to 1 line

image.png (750×2,166 px, 208 KB)
image.png (750×1,334 px, 56 KB)

Identical or Very Similar Sense Descriptions.

We would show them

suggestion show additional metadata:

  • Sense ID or Wikidata link - This would be some what useful but it would be good to show only the necessary info needed to keep the UI simple
  • Lexeme Has Many Senses (10/20+) - We would show them
  • can we know before lexeme selection whether they have senses or not?: no , because you havent selected a lexeme. a sense belongs to a lexeme so you need to select a lexeme first. but that shouldnt be a problem right, we show the message afterwards?
  • If a long sense is selected the dropdown is truncated to 1 line: have to see if thats possible in the codex component with css, otherwise we need to adjust codex

thank you!

Thanks a lot for the proposal @gonyeahialam

What would be your suggestion for Lexeme Sense component in view mode?

With lexemes, items, lexeme forms, and properties, because their label is one or a couple of words, the view is pretty simple, consisting on:

<wikidata icon> <label of the wikidata entity linked to its page>

Screenshot from 2025-07-23 17-44-10.png (250×111 px, 3 KB)

For lexeme senses, is this enough?

Proposed design

Default view1. Lexeme selection2. lexeme sense
You have 2 input fields. One for Lexeme selection and the second for lexeme sense selection which is disabled by default and it is enabled when a lexeme is selectedYou first select the lexemeSelect the lexeme sense
image.png (750×1,334 px, 59 KB)
image.png (750×1,334 px, 85 KB)
image.png (750×1,334 px, 55 KB)
image.png (750×1,334 px, 109 KB)
If a lexeme has no senses the dropdown remains disabled and a message is shown informing the use of this with a link to the lexeme as a CTA
image.png (750×1,334 px, 69 KB)

Edge cases

Lexeme Gloss language:
We show the lexeme senses gloss in the selected language of the page.
If a lexeme sense does not have a gloss in the page language we follow this fallback:

  1. Gloss in language of page
  2. Statement of the sense in language of the page (label: item description)
  3. Gloss in another available language

long or verbose sense texts:
Display it in full.
If a long sense is selected the dropdown is truncated to 1 line

image.png (750×2,166 px, 208 KB)
image.png (750×1,334 px, 56 KB)

Identical or Very Similar Sense Descriptions:We would show them

Lexeme Has Many Senses (10/20+) : We would show them

View mode

For view mode would display Lexeme senses like this:

Lemma: Sense gloss in the language of the page (following the same fallbacks as above)

Screenshot 2025-07-28 at 12.59.46 PM.png (1,248×478 px, 70 KB)

Out of scope

Lexeme ID and language
Many lexeme senses seem to have glosses only in a few languages and it is usually the first sense that has this, other senses hardly have glosses in a multiple languages and in some cases statements. With fallback 3, it is very likely that when you open a lexeme sense dropdown you will see senses in different languages. This situation makes it useful to have the language and lexeme sense number be specified to provide clarity.

image.png (750×1,508 px, 125 KB)

It will be better to have a consistent solution to this kind of situation with fallback languages across wikifunctions. So the above will be tackled when we do this. We would also learn from user feedback when lexeme sense selection ui is implemented.

Re Geno's question:

In view mode, I would take the lemma of the lexeme, followed by some delimiter (a long line -- or a :), followed by the gloss or the fallback (also when it's long).

This should happen quite rarely that we will see senses in view mode.

Re Geno's question:

In view mode, I would take the lemma of the lexeme, followed by some delimiter (a long line -- or a :), followed by the gloss or the fallback (also when it's long).

This should happen quite rarely that we will see senses in view mode.

@DVrandecic any particular reason why you propose this format for the lexeme senses

run: move forward quickly on foot by alternately making a short jump off each foot

when other data like forms just show the form without the lexeme lemma

Screenshot 2025-07-25 at 5.26.33 PM.png (620×460 px, 22 KB)

@gengh So For view mode would display Lexeme senses like this:

Lemma: Sense gloss in the language of the page (following the same fallbacks as above)

Screenshot 2025-07-28 at 12.59.46 PM.png (1,248×478 px, 70 KB)

Regarding the question why include the lemma: because the sense can be outside the context of a Lexeme, in which case it would be very difficult to figure out what the sense refers to.

DSantamaria changed the task status from In Progress to Open.Aug 22 2025, 2:16 PM
DSantamaria changed the task status from Open to In Progress.Sep 2 2025, 2:05 PM