1 # © 2016 and later: Unicode, Inc. and others.
2 # License & terms of use: http://www.unicode.org/copyright.html#License
8 # Rules are predicated on running NFD first, and NFC afterwards
9 # :: [\u0000-\u007F \u0370-Ͽ [:Greek:] [:nonspacing mark:]] ;
10 # MINIMAL FILTER GENERATED FOR: Greek-Latin
11 :: [;µ·ÄËÏÖÜäëïöüÿ-āĒ-ēĪ-īŌ-ōŪ-ūŸǕ-ǜǞ-ǣǬ-ǭȪ-ȭȰ-ȳ\u0304\u0308\u0313-\u0314\u0342-\u0345ͺ;Ά-ΊΌΎ-ΡΣ-ώϐ-ϗϛϝϟϡϣϥϧϩϫϭϯ-ϵϷ-\u07FBЁЇёїӒ-ӓӚ-ӟӢ-ӧӪ-ӱӴ-ӵӸ-ӹḔ-ḗḠ-ḡḦ-ḧḮ-ḯḸ-ḹṎ-ṓṜ-ṝṺ-ṻẄ-ẅẌ-ẍẗἀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼι῁-ῄῆ-ῌ῏-ΐῖ-Ί῟-Ῥῲ-ῴῶ-ῼΩϹ] ;
14 # Ὀλίγοι ἔμφονες πολλῶν ἀφρόνων φοβερώτεροι — Πλάτωνος
22 $lower = [[:latin:][:greek:] & [:Ll:]];
23 $glower = [[:greek:] & [:Ll:]];
24 $upper = [[:latin:][:greek:] & [:Lu:]] ;
26 # NOTE: restrict to just the Greek & Latin accents that we care about
27 # TODO: broaden out once interation is fixed
28 $accentMinus = [ [\u0300-\u0345] & [:M:] - [\u0338]] ;
31 $ddotmac = [$ddot$macron];
32 $lcgvowel = [αεηιουω] ;
33 $ucgvowel = [ΑΕΗΙΟΥΩ] ;
34 $gvowel = [$lcgvowel $ucgvowel] ;
35 $lcgvowelC = [$lcgvowel $accent] ;
36 $evowel = [aeiouyAEIOUY];
38 $vowel = [ $evowel $gvowel] ;
39 $gammaLike = [ΓΚΞΧγκξχϰ] ;
40 $egammaLike = [GKXCgkxc] ;
44 $evowel_i = [$evowel-[iI]] ;
47 $afterLetter = [:L:] [[:M:]\']* ;
48 $beforeLetter = [[:M:]\']* [:L:] ;
49 $beforeLower = $accent * $lower ;
50 $notLetter = [^[:L:][:M:]] ;
58 # CIRCUMFLEX: convert greek circumflex to normal one. Could use tilde or inverted breve
60 # IOTA: convert iota subscript to iota
61 # first make previous alpha long!
62 $accent_minus = [[$accent]-[$iotasub$macron]];
63 Α } $accent_minus * $iotasub → | Α $macron ;
64 α } $accent_minus * $iotasub → | α $macron ;
65 # now convert to uppercase if after uppercase, ow to lowercase
66 $upper $accent * { $iotasub → I ;
68 | $1 $iotasub ← ($evowel $macron $accentMinus *) i ;
69 | $1 $iotasub ← ($evowel $macron $accentMinus *) I ;
71 # Convert rough breathing to h, and move before letters.
72 # Make A ` x = → H a x
73 Α ($macron?) $rough } $beforeLower → H | α $1;
74 Ε $rough } $beforeLower → H | ε;
75 Η $rough } $beforeLower → H | η ;
76 Ι ($ddot?) $rough } $beforeLower → H | ι $1;
77 Ο $rough } $beforeLower → H | ο ;
78 Υ $rough } $beforeLower → H | υ ;
79 Ω ($ddot?) $rough } $beforeLower → H | ω $1;
80 # Make A x ` = → H a x
81 Α ($glower $macron?) $rough → H | α $1 ;
82 Ε ($glower) $rough → H | ε $1 ;
83 Η ($glower) $rough → H | η $1 ;
84 Ι ($glower $ddot?) $rough → H | ι $1 ;
85 Ο ($glower) $rough → H | ο $1 ;
86 Υ ($glower) $rough → H | υ $1 ;
87 Ω ($glower $ddot?) $rough → H | ω $1 ;
88 #Otherwise, make x ` into h x and X ` into H X
89 ($lcgvowel + $ddotmac? ) $rough → h | $1 ;
90 ($gvowel + $ddotmac? ) $rough → H | $1 ;
92 | $1 $rough ← h ($evowel $macron $ddot? $evowel2_i $macron?) ;
93 | $1 $rough ← h ($evowel $ddot? $evowel2 $macron?) ;
94 | $1 $rough ← h ($evowel $macron? $ddot?) ;
95 | $1 $rough ← H ([AEIOUY] $macron $ddot? $evowel2_i $macron?) ;
96 | $1 $rough ← H ([AEIOUY] $ddot? $evowel2 $macron?) ;
97 | $1 $rough ← H ([AEIOUY] $macron? $ddot?) ;
98 # titlecase, have to fix individually
99 # in the future, we should add &uppercase() to make this easier
100 | A $1 $rough ← H a ($macron $ddot? $evowel2_i $macron?) ;
101 | E $1 $rough ← H e ($macron $ddot? $evowel2_i $macron?) ;
102 | I $1 $rough ← H i ($macron $ddot? $evowel2_i $macron?) ;
103 | O $1 $rough ← H o ($macron $ddot? $evowel2_i $macron?) ;
104 | U $1 $rough ← H u ($macron $ddot? $evowel2_i $macron?) ;
105 | Y $1 $rough ← H y ($macron $ddot? $evowel2_i $macron?) ;
106 | A $1 $rough ← H a ($ddot? $evowel2 $macron?) ;
107 | E $1 $rough ← H e ($ddot? $evowel2 $macron?) ;
108 | I $1 $rough ← H i ($ddot? $evowel2 $macron?) ;
109 | O $1 $rough ← H o ($ddot? $evowel2 $macron?) ;
110 | U $1 $rough ← H u ($ddot? $evowel2 $macron?) ;
111 | Y $1 $rough ← H y ($ddot? $evowel2 $macron?) ;
112 | A $1 $rough ← H a ($macron? $ddot? ) ;
113 | E $1 $rough ← H e ($macron? $ddot? ) ;
114 | I $1 $rough ← H i ($macron? $ddot? ) ;
115 | O $1 $rough ← H o ($macron? $ddot? ) ;
116 | U $1 $rough ← H u ($macron? $ddot? ) ;
117 | Y $1 $rough ← H y ($macron? $ddot? ) ;
119 #delete smooth breathing for Latin
122 # the assumption is that all Marks are on letters.
123 | $1 $smooth ← $notLetter { ([rR]) } [^hH$smooth$rough] ;
124 | $1 $smooth ← $notLetter { ($evowel $macron? $evowel2 $macron?) } [^$smooth$rough] ;
125 | $1 $smooth ← $notLetter { ($evowel $macron?) } [^$evowel2$smooth$rough] ;
126 # TODO: preserve smooth/rough breathing if not
127 # on initial vowel sequence
128 # need to have these up here so the rules don't mask
129 # remove now superfluous macron when returning
135 Ψ } $beforeLower ↔ Ps ;
137 Φ } $beforeLower ↔ Ph ;
147 γ } $gammaLike ↔ n } $egammaLike ;
149 Γ } $gammaLike ↔ N } $egammaLike ;
158 Θ } $beforeLower ↔ Th ;
168 ν } $gammaLike → n\' ;
170 Ν } $gammaLike ↔ N\' ;
179 Ρ $rough } $beforeLower ↔ Rh ;
183 # insert separator before things that turn into s
184 [Pp] { } [ςσΣϷϸϺϻ] → \' ;
186 Ϸ ↔ S\u030C ; # Ϸ GREEK CAPITAL LETTER SHO Uppercase_Letter Grek - L
187 ϸ ↔ s\u030C ; #ϸ GREEK SMALL LETTER SHO Lowercase_Letter Grek - L
188 Ϻ ↔ S\u0302 ; # Ϻ GREEK CAPITAL LETTER SAN Uppercase_Letter Grek - L
189 ϻ ↔ s\u0302 ; # ϻ GREEK SMALL LETTER SAN Lowercase_Letter Grek - L
190 # underbar means exception
191 # before a letter, initial
192 ς } $beforeLetter ↔ s $underbar } $beforeLetter;
193 σ } $beforeLetter ↔ s } $beforeLetter;
194 # otherwise, after a letter = final
195 $afterLetter { σ ↔ $afterLetter { s $underbar;
196 $afterLetter { ς ↔ $afterLetter { s ;
197 # otherwise (isolated) = initial
209 Χ } $beforeLower ↔ Ch ;
211 # Completeness for ASCII
212 $ignore = [[:Mark:]''] * ;
229 $rough } $ignore [:UppercaseLetter:] → H ;
230 $ignore [:UppercaseLetter:] { $rough → H ;
233 # Completeness for Greek
242 Ϲ → | Σ; #U+03F9 GREEK CAPITAL LUNATE SIGMA SYMBOL
248 # delete any trailing ' marks used for roundtripping
250 ← [Νν] { \' } $egammaLike ;
252 # ([\u0000-\u007F [:Latin:] [:Greek:] [:nonspacing mark:]]) ;
253 # ([\u0000-\u007F · [:Latin:] [:nonspacing mark:]]) ;
254 # MINIMAL FILTER GENERATED FOR: Latin-Greek BACKWARD
255 :: ( [':?A-Za-zÀ-ÅÇ-ÏÑ-ÖÙ-Ýà-åç-ïñ-öù-ýÿ-ďĒ-ĥĨ-İĴ-ķĹ-ľŃ-ňŌ-őŔ-ťŨ-žƠ-ơƯ-ưǍ-ǜǞ-ǣǦ-ǰǴ-ǵǸ-țȞ-ȟȦ-ȳ\u0300-\u0337\u0339-\u0345΅-ΆΈ-ΊΌΎ-ΐΪ-ΰϊ-ώϓ-ϔЀ-ЁЃЇЌ-ЎЙйѐ-ёѓїќ-ўѶ-ѷӁ-ӂӐ-ӓӖ-ӗӚ-ӟӢ-ӧӪ-ӵӸ-ӹḀ-ẙẛẠ-ỹἀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼ῁-ῄῆ-ΐῖ-Ί῝-΅ῲ-ῴῶ-ῼK-Å] ) ;