neelsmith / greek

Utilities in Scala for working with polytonic ancient Greek.
https://neelsmith.github.io/greek/
2 stars 3 forks source link

Extend terminal sigma mapping #15

Closed neelsmith closed 5 years ago

neelsmith commented 7 years ago

Map s + [space, punctuation or final position] to terminal sigma

neelsmith commented 7 years ago

currently only doing mapping when sigma is followed by space

Eumaeus commented 6 years ago

val uc:String = [Some string with possibly messed up sigmas] val sigmaTerminators:Vector[String] = Vector(",",".",":", ";", "'", "—", " ", "\t") val matcher = "σ.".r
val stringWithFixedSigmas = { matcher.replaceAllIn(uc, m => { val secondChar:String = m.group(0).tail if (sigmaTerminators.contains(secondChar)) { s"ς${secondChar}"} else { s"σ${secondChar}"} }) }

Eumaeus commented 6 years ago

I've been working with this library a bit lately. The above code is what I've implemented on an ad hoc basis to sort out sigmas.

neelsmith commented 5 years ago

Fixed and tested.