Skip to content

feat: find symbols by searching the gloss, and enter symbols using svg builder strings#44

Open
klown wants to merge 112 commits intoinclusive-design:mainfrom
klown:feat/find-by-gloss-CLONE
Open

feat: find symbols by searching the gloss, and enter symbols using svg builder strings#44
klown wants to merge 112 commits intoinclusive-design:mainfrom
klown:feat/find-by-gloss-CLONE

Conversation

@klown
Copy link
Contributor

@klown klown commented Jan 18, 2026

  • This pull request has been tested by running npm test without errors
  • This pull request has been built by running npm run dev without errors
  • This isn't a duplicate of an existing pull request

Description

This pull request adds two dialogs to the adaptive-palette:

  1. SVG Entry:
  • Expand/collapse the dialog by clicking the triangle.
  • Enter an SVG builder string in the "Builder string:" text entry field,
  • Enter a label in the "Label:" text entry field,
  • Activate the "Add Symbol" button to render the symbol and label in the symbol input area.
  • Note: if the SVG builder string is invalid, no symbol is rendered in the input area, but any label text is rendered.
  1. Search gloss:
  • Enter either a word or a single BCI AV ID to search for bliss symbols in the BCI authorized vocabulary.
  • Some of the glosses in the BCI are words separated by an underscore ("_"). Include the underscore as part of the search text, e.g., "clothing_shop", not "clothing shop".
  • Activate the "Search" button. All matches found are displayed in a "matches palette".
  • Activate the "Clear" button to clear any matches palette and the search string..

In addition, a palette of matches found is produced for each successful search:

  • Each cell in this palette is live and pressing it will add the symbol and its gloss to the symbol input area.
  • The top of a cell shows the matching Bliss-word,
  • The text immediately below shows the Bliss-word's BCI AV ID and the text used to search for that symbol. For BCI AV ID searches, all Bliss-words that contain that ID are shown,
  • The text entry field on each cell allows users to change the label of the symbol that is added to the symbol input field,
  • The full decomposition of the Bliss-word is shown just below the text entry field as an SVG builder string.

Steps to test

See the "Description" above for how to use the dialogs.

klown added 30 commits March 28, 2025 11:06
Also, add `stream` (`true` or `false`) parameter to `queryChat()`
function.
- `CommandTeletgraphicCompletions` is component that calls ollama with
  a "bag of words" and a prompt to provide sentence completions
- Introduced `sentenceCompletionsSignal` that will eventually handle
  changes to the completions.
- removed all `console.debug()` statements
The palette of found symbols is a collection of cells that permit:
- ediingt a label for each symbol
- adding the symbol and its label to the input area
@klown klown requested a review from cindyli January 19, 2026 15:33
@@ -1,5 +1,5 @@
/*
* Copyright 2024 Inclusive Design Research Centre, OCAD University
* Copyright 2024-2025 Inclusive Design Research Centre, OCAD University
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copyright can use 2026 now. :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:-) This is updated in PR #42. If I update it here too, what happens? I guess there is no diff so it shouldn't matter?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On closer review, the version of ollama.js here is wrong. It is the same version as in the feat/integrate-ollama-api-with-palette from PR #42 where the UI and the ollama API were factored into separate files (ollama.js and ollamaApi.ts). I have restored the correct version for this branch.

options: BlissSymbolInfoType & LayoutInfoType
};

export function ActionGlossSearchCell (props: ActionGlossSearchCellPropsType): VNode {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just noticed this component doesn't seem to be used anywhere except in its test. Can you double check? Thanks.

Copy link
Contributor Author

@klown klown Jan 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's used in GlossSearchPalette -- that's what the cells are in that palette. They are created by the makeMatchesPalette() in that file.

*/
function indexOfIndicatorSuffix (gloss: string): number {
let index = -1;
for (let i = 0; i < INDICATOR_SUFFIXES.length; i++) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regex might be more efficient than a loop:

const suffix_regex = new RegExp(`(${INDICATOR_SUFFIXES.join('|')})$`, 'i');
const match = gloss.match(suffix_regex);
return match ? match.index : -1;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The use of compromise() and NLP for adjusting the gloss is not part of this PR. I have removed the compromise package and all related code. I will create a separate issue for NLP processing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issues is #50.


return html`
<form onSubmit=${searchGloss} class="actionSearchGloss">
<label for=${GLOSS_ENTRY_FIELD_ID} style="color: white;">Search gloss: </label>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The inline style should go into .scss. Moreover, setting color explicitly may affect the auto-adaptation on various browser color theme settings.

Copy link
Contributor Author

@klown klown Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and other styles have been either removed or moved to an appropriate .sccs file. Regarding being responsive to browser or system-wide colour themes: the palette has never had this capacity. It is showing up here because the new dialogs are using standard web controls. As a stop-gap, @jobara provided a patch that disables dark-mode, and the problem of vanishing text when switching to dark-mode not long occurs. That is not satisfactory in the long run since it means that if a user prefers dark-mode, it will not be available.

What should happen is that the entire palette, not just the new dialogs, adapt to changes in colour themes. That is a complex enough problem that it deserves its own issue and PR. I have created an issue for that work.


.actionSvgEntryField {
width: 25rem;
background: white
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, setting background color explicitly may affect the adaptation to browser color theme settings.

else {
// If removing a verb indicator, try turning the word back into a "noun"
// (gerund), e.g. "walk" -> "walking".
result = doc.verbs().toGerund().text();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does removing a verb indicator turning the word back to a noun? Shouldn't "to walk" be "walk" now rather than "walking"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does removing a verb indicator turning the word back to a noun?

In Bliss, to make a verb, add the action indicator to a symbol that is typically a noun. The removal of the indicator will turn the word back into a noun, in most cases.

Shouldn't "to walk" be "walk" now rather than "walking"?

Yes, it should be. (Note that "walk" is a noun, in this case), But I could find no way using compromise to do that. The closest was to use toGerund() which worked sometimes.

All of this shows that the NLP used for the ISAAC demo was barely good enough for that demo, but only for that demo. As noted above, all of the NLP has been removed from this PR.


// Update rows, columns, etc.
colIndex++;
if (colIndex > numCols) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If numCols is 4, this allows colIndex to be 0, 1, 2, 3, 4. Probably use if (colIndex >= numCols - 1).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, thank you, thank you! This little fix improves the layout immensely. I have also changed the maximum number of columns, numCols to 5 with this new check and that works.

columnSpan: 1
}
};
jsonPalette.cells[`${match.label}-${uuidv4()}`] = cell;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If makeMatchesPalette is called during a re-render, every cell will get a brand new ID with the use of uuidv4(). Every re-render will recreate the cell palette from scratch. What do you think about using bciAvId instead of calling uuidv4() so every cell palette will have a fixed key.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good idea. I was concerned mainly with having a unique ID here. BCI AV IDs are unique and thus are sufficient. And, they have the added benefit of supporting a DOM query.

return html``;
}
else if (matches.length === 0) {
return html`<p style="color: white;">No matches found</p>`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move the inline style into scss. Add a aria-live="polite" and an aria status to announce "No matches found."

Copy link
Contributor Author

@klown klown Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now, I have removed the inline style since I don't think it's necessary to begin with. Regarding the use of aria, I'm not against it, but in this case it will only matter if someone is using an AT like a screen reader. It won't cause the adaptive-palette to change its behaviour.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having thought about it a bit more, adding role="status" here is a good idea. There is another case in the SVG entry dialog where it reports an "Invalid builder string". In both cases, I have added the status role to the markkup. FYI, adding aria-live=polite is unnecessary since the status role is automatically polite, (and atomic).

* Create a JsonPaletteType from an array of matches based on a gloss search.
*
* @param {Array} glossMatches - Array of Bliss symbol information objects whose
* glass matches the search term.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: "glass" -> "gloss".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have eagle eyes. Thanks.

@cindyli
Copy link
Contributor

cindyli commented Jan 23, 2026

The same issue with the color contrast issue in the browser dark theme as mentioned in the pull request #42.

@cindyli
Copy link
Contributor

cindyli commented Jan 23, 2026

One concern is about pushing the binary navigate.mp3 into the repository which will remain in the repo from now on even when it's removed in the future. Is it confirmed that we need this sound for navigation? I also feel there should be a better place to access binary files from the code repo.

klown added 5 commits February 6, 2026 10:47
The `compromise` library was used in the ISAAC demo to adjust the
gloss of symbols when indicators were added or removed to better
reflect the grammatical change.  But, it was superficial and the
issue needs a deeper investigation and implementation to properly
make these kinds of transformations.
The version of `ollama.js` in this branch was mistakenly copied from
the `feat/integrate-ollama-api-with-palette` branch.  It should be
the version just before factoring it into ui vs. ollama api calls.
For the latter see `.../src/client/ollamaApi.ts` in the ollama
integration branch.
@klown
Copy link
Contributor Author

klown commented Feb 6, 2026

One concern is about pushing the binary navigate.mp3 into the repository which will remain in the repo from now on even when it's removed in the future. Is it confirmed that we need this sound for navigation? I also feel there should be a better place to access binary files from the code repo.

Yes, this was experimental based on a recommendation at one of the language development meetings. I'm reverting back to speaking the label of the button.

@klown
Copy link
Contributor Author

klown commented Mar 2, 2026

I have addressed all of your review comments, @cindyli. Ready for more reviews. By the way, I believe this PR should be merged first, before the ollama-api integration, PR #42.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants