Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding words to lexicon #188

Open
caw opened this issue Jul 20, 2022 · 3 comments
Open

Adding words to lexicon #188

caw opened this issue Jul 20, 2022 · 3 comments
Assignees

Comments

@caw
Copy link

caw commented Jul 20, 2022

How can I add words to the lexicon?
Apologies if this is 1)in the docs or 2)obvious or 3)obviously not within scope
Do I just edit rita.js, for example adding "palpate"
just embed
palpate: ["p-ae1-l p-ey1-t", "vb"]
into the word map?
with thanks

@dhowe
Copy link
Owner

dhowe commented Jul 25, 2022

simplest way is to get a handle to lexicon's data object and manually add the entry:

    let lexData = RiTa.lexicon().data;
    lexData["palpate"] = ["p-ae1-l p-ey1-t", "vb"];

or if you have multiple additons:

    let toAdd = {
      'palpate': ["p-ae1-l p-ey1-t", "vb"],
      'wadly': ['w-ae1-d l-iy', 'rb']
    }
    let lexData = RiTa.lexicon().data;
    Object.keys(toAdd).forEach(w => lexData[w] = toAdd[w]);

Alternatively, if you think these should be words in the default RiTa lexicon, then please submit a PR with your additions to this file: https://github.com/dhowe/ritajs/blob/master/src/rita_dict.js

@dhowe dhowe self-assigned this Jul 25, 2022
@caw
Copy link
Author

caw commented Jul 25, 2022

Thank you - that completely answers my question.
I will submit a list of medical terms - is there a canonical way to get the phonetics right?

@dhowe
Copy link
Owner

dhowe commented Jul 25, 2022

You can try this tool: http://www.speech.cs.cmu.edu/tools/lextool.html

Note that here is a tradeoff between package-size and lexicon coverage. We are often trying to reduce the size of the lexicon, rather than increase it. And I'm not sure average users would need medical terms. Perhaps we can publish this a sort of add-on or plugin ?

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

No branches or pull requests

2 participants