How add_lex() works
Correcting transcriptions in Fonology 1.5.0
A word comes out wrong. You correct it once, and from then on every transcription uses your version — without losing the corrections that ship with the package.
Two ways to correct a word
Both are the same function. Which one you want depends on whether the pipeline is almost right or plainly wrong.
Give the word back with a stress or quality diacritic. It still runs through the normal rules — you are telling them what to assume. Available for Portuguese, Spanish and Italian.
add_lex_pt("bórdas")
ipa("bordas", lg = "pt")
#> [1] "ˈbɔr.das" # was ˈbor.das*Hand over the finished IPA. The rules are skipped entirely — for loanwords and names no rule will ever get right. Available for all five languages.
add_lex_pt("shampoo", ipa = "ʃam.ˈpu")
ipa("shampoo", lg = "pt")
#> [1] "ʃam.ˈpu" # was ʃam.ˈpo.o*The ipa argument stores its value verbatim and skips transcription, so passing a diacritized spelling there returns that spelling as the “transcription”. Since version 1.5.0, add_lex_*() warns when an override looks like orthography rather than IPA.
Where your entry sits
Every word runs the same gauntlet. The first store that recognises it wins, and the search stops there.
ipa(). An asterisk marks a form produced by rules alone, so starred output in a corpus is a ready-made list of words worth checking.Your corrections and ours, side by side
Steps 1 and 2 each read from two places: the corrections shipped with the package, and the ones you added on this machine. They are merged every time you transcribe, and yours win.
Call remove_lex_pt("shampoo") once and your override is gone, so the shipped transcription comes back. Call it again and the shipped one is hidden too. Nothing you do here affects anyone else’s copy.
From your machine into the package
Your entries live in your own data directory, not in the installed package and not in your script. For the maintainer, promote_lex() is the step that turns a local fix into one everybody gets.
The whole interface
| Call | What it does |
|---|---|
add_lex_pt("bórdas") |
Fix stress or vowel quality; the word still goes through the rules. Portuguese, Spanish and Italian. |
add_lex_pt(w, ipa = "…") |
Store an exact transcription, skipping the rules. All five languages. |
remove_lex_pt("bordas") |
Drop your entry. Again on the same word hides the shipped one. |
export_lex("pt", file) |
Write your entries to a file, to share or to re-import. |
promote_lex() |
Maintainer. Move your entries into the package’s own lexicon, then empty yours. |
Your entries live on your machine, so a colleague running your script will not have them. Declare the add_lex_*() calls at the top of the script — re-running them is safe — or ship the file from export_lex() alongside it.
Copyright © Guilherme Duarte Garcia