There is a simple way to transform Latin letters to Greek letters, using the stringi
package for R which relies on ICU's transliterator here:
library(stringi)
stri_trans_general("abcd", "latin-greek")
Is there a similar simple way to convert Latin to ancient Greek (αβγδ) instead of Greek (ἀβκδ)?
I guess what you'd like to do (at least, as a part of your task), is to remove all accents.
Here's a way to do that with stringi
.
library("stringi")
stri_flatten(
stri_extract_all_charclass(
stri_trans_nfkd(
stri_trans_general("abcd", "latin-greek")
),
"\\p{L}")[[1]]
)
## [1] "αβκδ"
First we transliterate a stringi to Greek script. Then we perform Unicode normalization NFKD -- this splits accented characters to characters and accents separately. Next its time to extract all the letters and concatenate the results. HTH
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With