Skip to content

feat(bmj): add Ticuna (tca) lexical model - #358

Merged
jahorton merged 8 commits into
keymanapp:masterfrom
Brunomaia877:ticuna-kaingang-models
Nov 30, 2026
Merged

jahorton merged 8 commits into
keymanapp:masterfrom
Brunomaia877:ticuna-kaingang-models

Conversation

@Brunomaia877

@Brunomaia877 Brunomaia877 commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

New wordlist lexical model bmj.tca.ticuna for Ticuna (Tikuna, Magüta; tca) as written in Brazil. It is for the Ticuna keyboard in keymanapp/keyboards#4218.

The Kaingang model that was first submitted here is now in its own PR, #361.

  • 2,393 words: 2,343 with frequencies from the texts below, plus 50 author-supplied words and names (noted in the README).
  • Source: official Ticuna translations by Ticuna translators: the ECA / Youth Statute (MDHC, OEI and UnB/LALLI, 2025) and ILO 169, SDGs and the 1988 Constitution (AGU, Ministry of Indigenous Peoples, IDGlobal).
  • Normalization: PDF typing substitutes were normalized (ǖ → ü̃, ’ and › → '), and Portuguese words mixed into the text were filtered out.
  • Word breaker: the default breaker, with the apostrophe (U+0027, U+2019) mapped to ALetter. The glottal stop stays part of the word, including word-finally (naca'), and URLs, abbreviations and numbers stay whole.
  • Search key: searchTermToKey lowercases and strips diacritics (U+0300–U+036F after NFKD) and apostrophes, so typing nuu suggests nü'ü̃. languageUsesCasing: true.

Official acts are not protected by copyright in Brazil (Law 9,610/98, art. 8); the sources are listed in the README. Tested with KeymanWeb 18.0.255 together with the keyboard on simulated iPhone 13 and Pixel 7.

Modelo de palavras para o teclado Ticuna.

Word suggestions for the new Ticuna and Kaingang keyboards
(keymanapp/keyboards#4218 and #4219). Word lists with frequencies come from
official Brazilian translations by Indigenous translators (ECA/Youth Statute,
ILO 169, SDGs and the 1988 Constitution; AGU legal glossary for Kaingang).
The apostrophe (glottal stop) is part of the word; search ignores
diacritics and apostrophes.
@keyman-server

Copy link
Copy Markdown

Thank you for your pull request. You'll see a "build failed" message until the Keyman team has reviewed the pull request and manually initiated the build process.

Every change committed to this branch will become part of this pull request. When you have finished submitting files and are ready for the Keyman team to review this pull request, please post a "Ready for review" comment.

@Brunomaia877

Copy link
Copy Markdown
Contributor Author

Ready for review

@darcywong00

Copy link
Copy Markdown
Contributor

Thank you for your submission!
For future reference, we generally prefer model submissions on separate PRs.
Our small team will try to get to the review this week

@Brunomaia877

Copy link
Copy Markdown
Contributor Author

Thanks @darcywong00! Noted about separate PRs: the later models (Kaiowá #359 and Nheengatu #360) were submitted one per PR. The readme.htm language is now pt-BR in all four models. Ready for review.

Comment thread release/bmj/bmj.kgp.kaingang/LICENSE.md Resolved
Comment thread release/bmj/bmj.tca.ticuna/LICENSE.md Resolved
@jahorton jahorton self-assigned this Nov 17, 2026
@Brunomaia877

Copy link
Copy Markdown
Contributor Author

Also added 50 author-supplied Ticuna words and names to the Ticuna wordlist (now 2,393 words), noted in README.md. Ready for review.

@darcywong00 darcywong00 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for fixing the License files.
I'll be away for a week, but @jahorton will get around to reviewing the custom word breaker.
Appreciate your patience, as he's regularly full-time as the software developer for lexical-models.

Comment on lines +15 to +25
wordBreaker: {
use: function (text: string): Span[] {
const spans: Span[] = [];
const re = /[\p{L}\p{N}][\p{L}\p{M}\p{N}'’]*/gu;
let m: RegExpExecArray | null;
while ((m = re.exec(text)) !== null) {
spans.push({ start: m.index, end: m.index + m[0].length, length: m[0].length, text: m[0] });
}
return spans;
}
},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

First things first, there is an issue here: custom functions should not be specified via the use: option as you have done here. Instead...

Suggested change
wordBreaker: {
use: function (text: string): Span[] {
const spans: Span[] = [];
const re = /[\p{L}\p{N}][\p{L}\p{M}\p{N}'’]*/gu;
let m: RegExpExecArray | null;
while ((m = re.exec(text)) !== null) {
spans.push({ start: m.index, end: m.index + m[0].length, length: m[0].length, text: m[0] });
}
return spans;
}
},
wordBreaker: function (text: string): Span[] {
const spans: Span[] = [];
const re = /[\p{L}\p{N}][\p{L}\p{M}\p{N}'’]*/gu;
let m: RegExpExecArray | null;
while ((m = re.exec(text)) !== null) {
spans.push({ start: m.index, end: m.index + m[0].length, length: m[0].length, text: m[0] });
}
return spans;
}

Setting custom wordbreaking functions via use: is unintended. Even if it does compile properly now, we can't guarantee it won't break in the future.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This looks like it would cover the majority of cases we'd expect to see for your language, based on what I see in the wordlist. I do have a couple of questions to make sure this is sufficient, though.

What do abbreviations look like in your language? For example, in English, we might right e.g. or e.x. to indicate examples. Alternatively, consider typing out a website name, such as www.example.com. Would you want your model to keep those together as a "single word", or would those who write and type this language be fine with suggestions "starting over" after each period, as this wordbreaker implementation would do?

The same question arises with numbers: 3,000.48 would be split into 3, ,, 000, ., and 48, rather than treated as a single, whole number. Of course, numbers probably aren't in your wordlist... so this is probably fine.

If you would prefer wordbreaking to not occur in the middle of a URL or an abbreviation, we'd advise adding a small customization to the default word-breaker instead, per https://help.keyman.com/developer/current-version/guides/lexical-models/advanced/unicode-breaker-extension:

Suggested change
wordBreaker: {
use: function (text: string): Span[] {
const spans: Span[] = [];
const re = /[\p{L}\p{N}][\p{L}\p{M}\p{N}'’]*/gu;
let m: RegExpExecArray | null;
while ((m = re.exec(text)) !== null) {
spans.push({ start: m.index, end: m.index + m[0].length, length: m[0].length, text: m[0] });
}
return spans;
}
},
wordBreaker: function (text: string): Span[] {
let customization = {
/*** Character class overrides for specific characters ***/
propertyMapping: (char) => {
// Treats the single-quote (apostrophe) only as a standard letter,
// rather than like the English quotation-mark.
//
// This will keep it attached to any words it ends.
if(char == '\'') {
return "ALetter";
} else {
// Treat every other character normally.
return null;
}
},
};
/*** Applies the customization for actual use in wordbreaking ***/
return wordBreakers['default'](text, customization);
},

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for catching this. Fixed in cde1c6a: wordBreaker is now the function itself, with no use:.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks, I'd rather keep URLs, abbreviations and numbers together, so cde1c6a uses your customization of the default breaker. It maps U+0027 to ALetter and also U+2019, since text pasted from PDFs often has the typographic apostrophe as the glottal stop. These languages are written in Latin script with Portuguese punctuation, so the UAX #29 defaults fit them.

Checked with the compiled model in KeymanWeb 18.0.255:

  • nü'ü̃ naca' pã'i → nü'ü̃ | naca' | pã'i (the word-final glottal stays attached)
  • Ngẽma i ü̃́ tchorü'ü̃ → combining marks stay with their letters
  • www.exemplo.com, 3.000,48 and 10,50 stay whole

Ready for review

Comment on lines +29 to +34
searchTermToKey: function (wordform: string): string {
let s = '';
for (const ch of wordform) {
s += ch.toLowerCase();
}
return s.normalize('NFKD').replace(/[̀-ͯ]/g, '').replace(/['’]/g, '');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Per your submission description...

and a searchTermToKey that lowercases, strips diacritics and apostrophes (typing nuu suggests nü'ü̃, pai suggests pã'i).

This implementation only strips certain diacritics, though it does appear to cover the common cases I was able to find from your wordlist. Just to confirm, only cases like ó and ẽ are expected here?

I don't see any other cases near the top of your wordlist; I didn't read through the full thing in case rarer diacritics do appear.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It strips every combining mark, not just some. After NFKD, every mark falls in U+0300–U+036F, and that whole range is removed. The range was written with the literal combining characters, so it rendered as [̀-ͯ] and was hard to read; cde1c6a writes it as \u0300-\u036f.

I checked every character in the four wordlists. After NFKD the only marks are:

So every key comes out as plain a–z.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the change in cde1c6a - it was hard to read as a character range with the combining characters and is much clearer with the Unicode escapes. 👍 That definitely helps with code clarity and ongoing maintenance.

Brunomaia877 added a commit to Brunomaia877/lexical-models that referenced this pull request Nov 20, 2026
Address review on keymanapp#358: assign the wordBreaker function directly instead
of via 'use:', and build on the default UAX #29 breaker so abbreviations,
URLs and numbers are handled; only the apostrophe (U+0027, U+2019) is
remapped to ALetter so glottals stay inside words.

Also clarify searchTermToKey: NFKD + stripping U+0300-U+036F removes all
diacritics used in the wordlists (acute, grave, tilde, diaeresis, macron,
ogonek), not just some.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015YPauqHVapcn1BMJU2JvPR
@Brunomaia877

Copy link
Copy Markdown
Contributor Author

Ready for review

@jahorton jahorton left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The models themselves look good to go, but it is our policy that each model be submitted in a separate PR. If you could put one of the two models in a separate PR and remove it from here, that would be most preferable.

Comment on lines +29 to +34
searchTermToKey: function (wordform: string): string {
let s = '';
for (const ch of wordform) {
s += ch.toLowerCase();
}
return s.normalize('NFKD').replace(/[̀-ͯ]/g, '').replace(/['’]/g, '');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the change in cde1c6a - it was hard to read as a character range with the combining characters and is much clearer with the Unicode escapes. 👍 That definitely helps with code clarity and ongoing maintenance.

Address review on keymanapp#358: assign the wordBreaker function directly instead
of via 'use:', and build on the default UAX #29 breaker so abbreviations,
URLs and numbers are handled; only the apostrophe (U+0027, U+2019) is
remapped to ALetter so glottals stay inside words.

Also clarify searchTermToKey: NFKD + stripping U+0300-U+036F removes all
diacritics used in the wordlists (acute, grave, tilde, diaeresis, macron,
ogonek), not just some.
Per review, each model goes in its own PR. bmj.kgp.kaingang is now in keymanapp#361
with the same files; this PR keeps only bmj.tca.ticuna.
@Brunomaia877
Brunomaia877 force-pushed the ticuna-kaingang-models branch from cde1c6a to 290fbb3 Compare November 23, 2026 15:50
@Brunomaia877 Brunomaia877 changed the title feat(bmj): add Ticuna (tca) and Kaingang (kgp) lexical models feat(bmj): add Ticuna (tca) lexical model Nov 23, 2026
@Brunomaia877

Copy link
Copy Markdown
Contributor Author

Thanks @jahorton! Done: the Kaingang model is now in its own PR, #361, with the same files as reviewed here. This PR keeps only bmj.tca.ticuna (290fbb3).

I also rewrote the message of the word-breaker commit, which is now b94851a instead of cde1c6a. The files are the same.

Ready for review

@jahorton jahorton left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM.

@jahorton
jahorton merged commit d15ab77 into keymanapp:master Nov 30, 2026
2 checks passed
jahorton pushed a commit that referenced this pull request Nov 30, 2026
Wordlist lexical model for the Kaingang keyboard (keymanapp/keyboards#4219),
split out of #358 so that each model has its own PR. The files are the same
as reviewed there, including the default word breaker with the apostrophe
mapped to ALetter and the \u0300-\u036f range in searchTermToKey.
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.

4 participants