This function reverses the work of betacode_to_unicode, converting Ancient Greek text in Unicode to well-formed Beta Code.
Value
A character vector with corresponding Beta Code. The function gives a warning when it encounters characters that cannot be converted to Beta Code, returning these characters wrapped in brackets.
Examples
unicode_text <- betacode_to_unicode(plato_republic$text[1:2])
unicode_text
#> [1] "κατέβην χθὲς εἰς Πειραιᾶ μετὰ Γλαύκωνος τοῦ Ἀρίστωνος προσευξόμενός τε τῇ θεῷ καὶ ἅμα τὴν ἑορτὴν βουλόμενος θεάσασθαι τίνα τρόπον ποιήσουσιν ἅτε νῦν πρῶτον ἄγοντες"
#> [2] "καλὴ μὲν οὖν μοι καὶ ἡ τῶν ἐπιχωρίων πομπὴ ἔδοξεν εἶναι οὐ μέντοι ἧττον ἐφαίνετο πρέπειν ἣν οἱ Θρᾷκες ἔπεμπον"
unicode_to_betacode(unicode_text)
#> [1] "kate/bhn xqe\\s ei)s *peiraia= meta\\ *glau/kwnos tou= *)ari/stwnos proseuco/meno/s te th=| qew=| kai\\ a(/ma th\\n e(orth\\n boulo/menos qea/sasqai ti/na tro/pon poih/sousin a(/te nu=n prw=ton a)/gontes"
#> [2] "kalh\\ me\\n ou)=n moi kai\\ h( tw=n e)pixwri/wn pomph\\ e)/docen ei)=nai ou) me/ntoi h(=tton e)fai/neto pre/pein h(\\n oi( *qra=|kes e)/pempon"
# The function gives a warning when it encounters non-Unicode Greek
# characters, wrapping them in brackets.
unicode_to_betacode(paste(unicode_text, "abc"))
#> Warning: Some characters were not converted to Beta Code. They may not be unicode Greek characters. These are wrapped in brackets.
#> Warning: Some characters were not converted to Beta Code. They may not be unicode Greek characters. These are wrapped in brackets.
#> [1] "kate/bhn xqe\\s ei)s *peiraia= meta\\ *glau/kwnos tou= *)ari/stwnos proseuco/meno/s te th=| qew=| kai\\ a(/ma th\\n e(orth\\n boulo/menos qea/sasqai ti/na tro/pon poih/sousin a(/te nu=n prw=ton a)/gontes [abc]"
#> [2] "kalh\\ me\\n ou)=n moi kai\\ h( tw=n e)pixwri/wn pomph\\ e)/docen ei)=nai ou) me/ntoi h(=tton e)fai/neto pre/pein h(\\n oi( *qra=|kes e)/pempon [abc]"