| 1 |
stringescapes {} |
| 2 |
|
| 3 |
/* the 32 Cyrillic letters in Unicode */ |
| 4 |
|
| 5 |
stringdef a hex '430' |
| 6 |
stringdef b hex '431' |
| 7 |
stringdef v hex '432' |
| 8 |
stringdef g hex '433' |
| 9 |
stringdef d hex '434' |
| 10 |
stringdef e hex '435' |
| 11 |
stringdef zh hex '436' |
| 12 |
stringdef z hex '437' |
| 13 |
stringdef i hex '438' |
| 14 |
stringdef i` hex '439' |
| 15 |
stringdef k hex '43A' |
| 16 |
stringdef l hex '43B' |
| 17 |
stringdef m hex '43C' |
| 18 |
stringdef n hex '43D' |
| 19 |
stringdef o hex '43E' |
| 20 |
stringdef p hex '43F' |
| 21 |
stringdef r hex '440' |
| 22 |
stringdef s hex '441' |
| 23 |
stringdef t hex '442' |
| 24 |
stringdef u hex '443' |
| 25 |
stringdef f hex '444' |
| 26 |
stringdef kh hex '445' |
| 27 |
stringdef ts hex '446' |
| 28 |
stringdef ch hex '447' |
| 29 |
stringdef sh hex '448' |
| 30 |
stringdef shch hex '449' |
| 31 |
stringdef " hex '44A' |
| 32 |
stringdef y hex '44B' |
| 33 |
stringdef ' hex '44C' |
| 34 |
stringdef e` hex '44D' |
| 35 |
stringdef iu hex '44E' |
| 36 |
stringdef ia hex '44F' |
| 37 |
|
| 38 |
routines ( mark_regions R2 |
| 39 |
perfective_gerund |
| 40 |
adjective |
| 41 |
adjectival |
| 42 |
reflexive |
| 43 |
verb |
| 44 |
noun |
| 45 |
derivational |
| 46 |
tidy_up |
| 47 |
) |
| 48 |
|
| 49 |
externals ( stem ) |
| 50 |
|
| 51 |
integers ( pV p2 ) |
| 52 |
|
| 53 |
groupings ( v ) |
| 54 |
|
| 55 |
define v '{a}{e}{i}{o}{u}{y}{e`}{iu}{ia}' |
| 56 |
|
| 57 |
define mark_regions as ( |
| 58 |
|
| 59 |
$pV = limit |
| 60 |
$p2 = limit |
| 61 |
do ( |
| 62 |
gopast v setmark pV gopast non-v |
| 63 |
gopast v gopast non-v setmark p2 |
| 64 |
) |
| 65 |
) |
| 66 |
|
| 67 |
backwardmode ( |
| 68 |
|
| 69 |
define R2 as $p2 <= cursor |
| 70 |
|
| 71 |
define perfective_gerund as ( |
| 72 |
[substring] among ( |
| 73 |
'{v}' |
| 74 |
'{v}{sh}{i}' |
| 75 |
'{v}{sh}{i}{s}{'}' |
| 76 |
('{a}' or '{ia}' delete) |
| 77 |
'{i}{v}' |
| 78 |
'{i}{v}{sh}{i}' |
| 79 |
'{i}{v}{sh}{i}{s}{'}' |
| 80 |
'{y}{v}' |
| 81 |
'{y}{v}{sh}{i}' |
| 82 |
'{y}{v}{sh}{i}{s}{'}' |
| 83 |
(delete) |
| 84 |
) |
| 85 |
) |
| 86 |
|
| 87 |
define adjective as ( |
| 88 |
[substring] among ( |
| 89 |
'{e}{e}' '{i}{e}' '{y}{e}' '{o}{e}' '{i}{m}{i}' '{y}{m}{i}' |
| 90 |
'{e}{i`}' '{i}{i`}' '{y}{i`}' '{o}{i`}' '{e}{m}' '{i}{m}' |
| 91 |
'{y}{m}' '{o}{m}' '{e}{g}{o}' '{o}{g}{o}' '{e}{m}{u}' |
| 92 |
'{o}{m}{u}' '{i}{kh}' '{y}{kh}' '{u}{iu}' '{iu}{iu}' '{a}{ia}' |
| 93 |
'{ia}{ia}' |
| 94 |
// and - |
| 95 |
'{o}{iu}' // - which is somewhat archaic |
| 96 |
'{e}{iu}' // - soft form of {o}{iu} |
| 97 |
(delete) |
| 98 |
) |
| 99 |
) |
| 100 |
|
| 101 |
define adjectival as ( |
| 102 |
adjective |
| 103 |
|
| 104 |
/* of the participle forms, em, vsh, ivsh, yvsh are readily removable. |
| 105 |
nn, {iu}shch, shch, u{iu}shch can be removed, with a small proportion of |
| 106 |
errors. Removing im, uem, enn creates too many errors. |
| 107 |
*/ |
| 108 |
|
| 109 |
try ( |
| 110 |
[substring] among ( |
| 111 |
'{e}{m}' // present passive participle |
| 112 |
'{n}{n}' // adjective from past passive participle |
| 113 |
'{v}{sh}' // past active participle |
| 114 |
'{iu}{shch}' '{shch}' // present active participle |
| 115 |
('{a}' or '{ia}' delete) |
| 116 |
|
| 117 |
//but not '{i}{m}' '{u}{e}{m}' // present passive participle |
| 118 |
//or '{e}{n}{n}' // adjective from past passive participle |
| 119 |
|
| 120 |
'{i}{v}{sh}' '{y}{v}{sh}'// past active participle |
| 121 |
'{u}{iu}{shch}' // present active participle |
| 122 |
(delete) |
| 123 |
) |
| 124 |
) |
| 125 |
|
| 126 |
) |
| 127 |
|
| 128 |
define reflexive as ( |
| 129 |
[substring] among ( |
| 130 |
'{s}{ia}' |
| 131 |
'{s}{'}' |
| 132 |
(delete) |
| 133 |
) |
| 134 |
) |
| 135 |
|
| 136 |
define verb as ( |
| 137 |
[substring] among ( |
| 138 |
'{l}{a}' '{n}{a}' '{e}{t}{e}' '{i`}{t}{e}' '{l}{i}' '{i`}' |
| 139 |
'{l}' '{e}{m}' '{n}' '{l}{o}' '{n}{o}' '{e}{t}' '{iu}{t}' |
| 140 |
'{n}{y}' '{t}{'}' '{e}{sh}{'}' |
| 141 |
|
| 142 |
'{n}{n}{o}' |
| 143 |
('{a}' or '{ia}' delete) |
| 144 |
|
| 145 |
'{i}{l}{a}' '{y}{l}{a}' '{e}{n}{a}' '{e}{i`}{t}{e}' |
| 146 |
'{u}{i`}{t}{e}' '{i}{t}{e}' '{i}{l}{i}' '{y}{l}{i}' '{e}{i`}' |
| 147 |
'{u}{i`}' '{i}{l}' '{y}{l}' '{i}{m}' '{y}{m}' '{e}{n}' |
| 148 |
'{i}{l}{o}' '{y}{l}{o}' '{e}{n}{o}' '{ia}{t}' '{u}{e}{t}' |
| 149 |
'{u}{iu}{t}' '{i}{t}' '{y}{t}' '{e}{n}{y}' '{i}{t}{'}' |
| 150 |
'{y}{t}{'}' '{i}{sh}{'}' '{u}{iu}' '{iu}' |
| 151 |
(delete) |
| 152 |
/* note the short passive participle tests: |
| 153 |
'{n}{a}' '{n}' '{n}{o}' '{n}{y}' |
| 154 |
'{e}{n}{a}' '{e}{n}' '{e}{n}{o}' '{e}{n}{y}' |
| 155 |
*/ |
| 156 |
) |
| 157 |
) |
| 158 |
|
| 159 |
define noun as ( |
| 160 |
[substring] among ( |
| 161 |
'{a}' '{e}{v}' '{o}{v}' '{i}{e}' '{'}{e}' '{e}' |
| 162 |
'{i}{ia}{m}{i}' '{ia}{m}{i}' '{a}{m}{i}' '{e}{i}' '{i}{i}' |
| 163 |
'{i}' '{i}{e}{i`}' '{e}{i`}' '{o}{i`}' '{i}{i`}' '{i`}' |
| 164 |
'{i}{ia}{m}' '{ia}{m}' '{i}{e}{m}' '{e}{m}' '{a}{m}' '{o}{m}' |
| 165 |
'{o}' '{u}' '{a}{kh}' '{i}{ia}{kh}' '{ia}{kh}' '{y}' '{'}' |
| 166 |
'{i}{iu}' '{'}{iu}' '{iu}' '{i}{ia}' '{'}{ia}' '{ia}' |
| 167 |
(delete) |
| 168 |
/* the small class of neuter forms '{e}{n}{i}' '{e}{n}{e}{m}' |
| 169 |
'{e}{n}{a}' '{e}{n}' '{e}{n}{a}{m}' '{e}{n}{a}{m}{i}' '{e}{n}{a}{x}' |
| 170 |
omitted - they only occur on 12 words. |
| 171 |
*/ |
| 172 |
) |
| 173 |
) |
| 174 |
|
| 175 |
define derivational as ( |
| 176 |
[substring] R2 among ( |
| 177 |
'{o}{s}{t}' |
| 178 |
'{o}{s}{t}{'}' |
| 179 |
(delete) |
| 180 |
) |
| 181 |
) |
| 182 |
|
| 183 |
define tidy_up as ( |
| 184 |
[substring] among ( |
| 185 |
|
| 186 |
'{e}{i`}{sh}' |
| 187 |
'{e}{i`}{sh}{e}' // superlative forms |
| 188 |
(delete |
| 189 |
['{n}'] '{n}' delete |
| 190 |
) |
| 191 |
'{n}' |
| 192 |
('{n}' delete) // e.g. -nno endings |
| 193 |
'{'}' |
| 194 |
(delete) // with some slight false conflations |
| 195 |
) |
| 196 |
) |
| 197 |
) |
| 198 |
|
| 199 |
define stem as ( |
| 200 |
|
| 201 |
do mark_regions |
| 202 |
backwards setlimit tomark pV for ( |
| 203 |
do ( |
| 204 |
perfective_gerund or |
| 205 |
( try reflexive |
| 206 |
adjectival or verb or noun |
| 207 |
) |
| 208 |
) |
| 209 |
try([ '{i}' ] delete) |
| 210 |
// because noun ending -i{iu} is being treated as verb ending -{iu} |
| 211 |
|
| 212 |
do derivational |
| 213 |
do tidy_up |
| 214 |
) |
| 215 |
) |