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

Could "Any-Latin; Latin-ASCII" be added to replace_non_ascii() to address logographics/cyrillic/devanagari? #64

Open
dustinstoltz opened this issue Jun 17, 2022 · 0 comments

Comments

@dustinstoltz
Copy link

I see that replace_non_ascii() uses stringi::stri_trans_general(x, "latin-ascii")

This doesn't seem to work for logographic, Cyrillic, or Devanagari characters:

library(stringi)
x <-  c("キャンパス", "재미", "wylądować", "Дорога", "heiß", "Raül", 'brûlée', "भोजन")
Encoding(x) <- "UTF-8"
stri_trans_general(in_str, id = "Latin-ASCII")
[1] "キャンパス" "재미"       "wyladowac"  "Дорога"     "heiss"     
[6] "Raul"       "brulee"     "भोजन" 

The function could first transliterate to Any-Latin and then to Latin-ASCII, which seems a safer default:

stri_trans_general(x, id = "Any-Latin; Latin-ASCII")
[1] "kyanpasu"  "jaemi"     "wyladowac" "Doroga"    "heiss"     "Raul"     
[7] "brulee"    "bhojana"

Just a thought -- love the package!

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

1 participant