Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions scripts/aggregation-helper-functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -235,13 +235,13 @@ make_typestring <- function(strings, ...) {
codepts <- get_codepoints(chars)
codepts[codepts %in% get_codepoints(base_glyphs)] <- "B"
codepts[codepts %in% get_codepoints(modifiers)] <- "M"
codepts[codepts %in% get_codepoints(clicks)] <- "M"
codepts[codepts %in% get_codepoints(clicks)] <- "K"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I checked git blame for this line, which led me to #365. It's PR description says (among other things):

when building feature vectors, clicks are now handled like modifiers (not like base glyphs), which makes it easier to get the correct features (previously they were incorrect)

SO I think this change will likely result in incorrect feature vectors for clicks. I'd rather try changing the line in order_ipa that checks for modifiers %in% mods (see other comment)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I checked the diff between output files generated with the original code, previous fix (clicks as "K") and this suggested fix. There's a few things to note:

  1. The feature vectors do change, but worth noting the original (unfixed) code does not produce a valid phoible.csv file that matches the one in the repo. Running a fresh install crashes in add-features.R with the following error:
    GlyphID 0353 (frictionalized) used on base glyph k was not handled.

This probably means the current phoible.csv was obtained by running add-features.R on a pre-existing phoible-nofeats.csv?

  1. The original code and the suggested fix change the ordering of some modifiers. For example: in kǃ̠ʰ (Present in HAZDA and SANDAWE), the original code changes it to k̠ʰʰ, then crashes with the above error. The suggested fix moves the diacritic onto the base k instead (k̠ǃʰ). This implies the feature vectors will be different but I'm not sure if this is intended behaviour.

This is because the above fix only solves for "MM" (two modifiers appearing sequentially) and not for "MD" (which is the above example - "BMDM")
So we need to further add in line 302 under while (stri_detect_fixed(typestring, "MD"))

            if (string[ix] %in% clicks) break

(Please check the comment below)

  1. Finally, I compared the files generated with the previous fix (clicks as "K"), this complete fix and the phoible.csv currently committed in the repo: All three are identical.

codepts[codepts %in% get_codepoints(diacritics)] <- "D"
codepts[codepts %in% get_codepoints(contour_glyphs)] <- "C"
codepts[codepts %in% get_codepoints(tones)] <- "T"
codepts[codepts %in% get_codepoints(null_phone)] <- "N"
codepts[codepts %in% get_codepoints(disjunct)] <- "|"
missed <- !codepts %in% c("B", "M", "C", "D", "T", "N", "|")
missed <- !codepts %in% c("B", "M", "K", "C", "D", "T", "N", "|")
if (any(missed)) {
warning(paste("Unfamiliar glyph components.", "Phone:", string,
"Codepoint:", codepts[missed]),
Expand Down
Loading