| 1 |
routines ( |
| 2 |
postlude mark_regions |
| 3 |
RV R1 R2 |
| 4 |
attached_pronoun |
| 5 |
standard_suffix |
| 6 |
y_verb_suffix |
| 7 |
verb_suffix |
| 8 |
residual_suffix |
| 9 |
) |
| 10 |
|
| 11 |
externals ( stem ) |
| 12 |
|
| 13 |
integers ( pV p1 p2 ) |
| 14 |
|
| 15 |
groupings ( v ) |
| 16 |
|
| 17 |
stringescapes {} |
| 18 |
|
| 19 |
/* special characters (in ISO Latin I) */ |
| 20 |
|
| 21 |
stringdef a' hex 'E1' // a-acute |
| 22 |
stringdef e' hex 'E9' // e-acute |
| 23 |
stringdef i' hex 'ED' // i-acute |
| 24 |
stringdef o' hex 'F3' // o-acute |
| 25 |
stringdef u' hex 'FA' // u-acute |
| 26 |
stringdef u" hex 'FC' // u-diaeresis |
| 27 |
stringdef n~ hex 'F1' // n-tilde |
| 28 |
|
| 29 |
define v 'aeiou{a'}{e'}{i'}{o'}{u'}{u"}' |
| 30 |
|
| 31 |
define mark_regions as ( |
| 32 |
|
| 33 |
$pV = limit |
| 34 |
$p1 = limit |
| 35 |
$p2 = limit // defaults |
| 36 |
|
| 37 |
do ( |
| 38 |
( v (non-v gopast v) or (v gopast non-v) ) |
| 39 |
or |
| 40 |
( non-v (non-v gopast v) or (v next) ) |
| 41 |
setmark pV |
| 42 |
) |
| 43 |
do ( |
| 44 |
gopast v gopast non-v setmark p1 |
| 45 |
gopast v gopast non-v setmark p2 |
| 46 |
) |
| 47 |
) |
| 48 |
|
| 49 |
define postlude as repeat ( |
| 50 |
[substring] among( |
| 51 |
'{a'}' (<- 'a') |
| 52 |
'{e'}' (<- 'e') |
| 53 |
'{i'}' (<- 'i') |
| 54 |
'{o'}' (<- 'o') |
| 55 |
'{u'}' (<- 'u') |
| 56 |
// and possibly {u"}->u here, or in prelude |
| 57 |
'' (next) |
| 58 |
) //or next |
| 59 |
) |
| 60 |
|
| 61 |
backwardmode ( |
| 62 |
|
| 63 |
define RV as $pV <= cursor |
| 64 |
define R1 as $p1 <= cursor |
| 65 |
define R2 as $p2 <= cursor |
| 66 |
|
| 67 |
define attached_pronoun as ( |
| 68 |
[substring] among( |
| 69 |
'me' 'se' 'sela' 'selo' 'selas' 'selos' 'la' 'le' 'lo' |
| 70 |
'las' 'les' 'los' 'nos' |
| 71 |
) |
| 72 |
substring RV among( |
| 73 |
'i{e'}ndo' (] <- 'iendo') |
| 74 |
'{a'}ndo' (] <- 'ando') |
| 75 |
'{a'}r' (] <- 'ar') |
| 76 |
'{e'}r' (] <- 'er') |
| 77 |
'{i'}r' (] <- 'ir') |
| 78 |
'ando' |
| 79 |
'iendo' |
| 80 |
'ar' 'er' 'ir' |
| 81 |
(delete) |
| 82 |
'yendo' ('u' delete) |
| 83 |
) |
| 84 |
) |
| 85 |
|
| 86 |
define standard_suffix as ( |
| 87 |
[substring] among( |
| 88 |
|
| 89 |
'anza' 'anzas' |
| 90 |
'ico' 'ica' 'icos' 'icas' |
| 91 |
'ismo' 'ismos' |
| 92 |
'able' 'ables' |
| 93 |
'ible' 'ibles' |
| 94 |
'ista' 'istas' |
| 95 |
'oso' 'osa' 'osos' 'osas' |
| 96 |
'amiento' 'amientos' |
| 97 |
'imiento' 'imientos' |
| 98 |
( |
| 99 |
R2 delete |
| 100 |
) |
| 101 |
'adora' 'ador' 'aci{o'}n' |
| 102 |
'adoras' 'adores' 'aciones' |
| 103 |
'ante' 'antes' 'ancia' 'ancias'// Note 1 |
| 104 |
( |
| 105 |
R2 delete |
| 106 |
try ( ['ic'] R2 delete ) |
| 107 |
) |
| 108 |
'log{i'}a' |
| 109 |
'log{i'}as' |
| 110 |
( |
| 111 |
R2 <- 'log' |
| 112 |
) |
| 113 |
'uci{o'}n' 'uciones' |
| 114 |
( |
| 115 |
R2 <- 'u' |
| 116 |
) |
| 117 |
'encia' 'encias' |
| 118 |
( |
| 119 |
R2 <- 'ente' |
| 120 |
) |
| 121 |
'amente' |
| 122 |
( |
| 123 |
R1 delete |
| 124 |
try ( |
| 125 |
[substring] R2 delete among( |
| 126 |
'iv' (['at'] R2 delete) |
| 127 |
'os' |
| 128 |
'ic' |
| 129 |
'ad' |
| 130 |
) |
| 131 |
) |
| 132 |
) |
| 133 |
'mente' |
| 134 |
( |
| 135 |
R2 delete |
| 136 |
try ( |
| 137 |
[substring] among( |
| 138 |
'ante' // Note 1 |
| 139 |
'able' |
| 140 |
'ible' (R2 delete) |
| 141 |
) |
| 142 |
) |
| 143 |
) |
| 144 |
'idad' |
| 145 |
'idades' |
| 146 |
( |
| 147 |
R2 delete |
| 148 |
try ( |
| 149 |
[substring] among( |
| 150 |
'abil' |
| 151 |
'ic' |
| 152 |
'iv' (R2 delete) |
| 153 |
) |
| 154 |
) |
| 155 |
) |
| 156 |
'iva' 'ivo' |
| 157 |
'ivas' 'ivos' |
| 158 |
( |
| 159 |
R2 delete |
| 160 |
try ( |
| 161 |
['at'] R2 delete // but not a further ['ic'] R2 delete |
| 162 |
) |
| 163 |
) |
| 164 |
) |
| 165 |
) |
| 166 |
|
| 167 |
define y_verb_suffix as ( |
| 168 |
setlimit tomark pV for ([substring]) among( |
| 169 |
'ya' 'ye' 'yan' 'yen' 'yeron' 'yendo' 'yo' 'y{o'}' |
| 170 |
'yas' 'yes' 'yais' 'yamos' |
| 171 |
('u' delete) |
| 172 |
) |
| 173 |
) |
| 174 |
|
| 175 |
define verb_suffix as ( |
| 176 |
setlimit tomark pV for ([substring]) among( |
| 177 |
|
| 178 |
'en' 'es' '{e'}is' 'emos' |
| 179 |
(try ('u' test 'g') ] delete) |
| 180 |
|
| 181 |
'ar{i'}an' 'ar{i'}as' 'ar{a'}n' 'ar{a'}s' 'ar{i'}ais' |
| 182 |
'ar{i'}a' 'ar{e'}is' 'ar{i'}amos' 'aremos' 'ar{a'}' |
| 183 |
'ar{e'}' |
| 184 |
'er{i'}an' 'er{i'}as' 'er{a'}n' 'er{a'}s' 'er{i'}ais' |
| 185 |
'er{i'}a' 'er{e'}is' 'er{i'}amos' 'eremos' 'er{a'}' |
| 186 |
'er{e'}' |
| 187 |
'ir{i'}an' 'ir{i'}as' 'ir{a'}n' 'ir{a'}s' 'ir{i'}ais' |
| 188 |
'ir{i'}a' 'ir{e'}is' 'ir{i'}amos' 'iremos' 'ir{a'}' |
| 189 |
'ir{e'}' |
| 190 |
|
| 191 |
'aba' 'ada' 'ida' '{i'}a' 'ara' 'iera' 'ad' 'ed' |
| 192 |
'id' 'ase' 'iese' 'aste' 'iste' 'an' 'aban' '{i'}an' |
| 193 |
'aran' 'ieran' 'asen' 'iesen' 'aron' 'ieron' 'ado' |
| 194 |
'ido' 'ando' 'iendo' 'i{o'}' 'ar' 'er' 'ir' 'as' |
| 195 |
'abas' 'adas' 'idas' '{i'}as' 'aras' 'ieras' 'ases' |
| 196 |
'ieses' '{i'}s' '{a'}is' 'abais' '{i'}ais' 'arais' |
| 197 |
'ierais' 'aseis' 'ieseis' 'asteis' 'isteis' 'ados' |
| 198 |
'idos' 'amos' '{a'}bamos' '{i'}amos' 'imos' |
| 199 |
'{a'}ramos' 'i{e'}ramos' 'i{e'}semos' '{a'}semos' |
| 200 |
(delete) |
| 201 |
) |
| 202 |
) |
| 203 |
|
| 204 |
define residual_suffix as ( |
| 205 |
[substring] among( |
| 206 |
'os' |
| 207 |
'a' 'o' '{a'}' '{i'}' '{o'}' |
| 208 |
( RV delete ) |
| 209 |
'e' '{e'}' |
| 210 |
( RV delete try( ['u'] test 'g' RV delete ) ) |
| 211 |
) |
| 212 |
) |
| 213 |
) |
| 214 |
|
| 215 |
define stem as ( |
| 216 |
do mark_regions |
| 217 |
backwards ( |
| 218 |
do attached_pronoun |
| 219 |
do ( standard_suffix or |
| 220 |
y_verb_suffix or |
| 221 |
verb_suffix |
| 222 |
) |
| 223 |
do residual_suffix |
| 224 |
) |
| 225 |
do postlude |
| 226 |
) |
| 227 |
|
| 228 |
/* |
| 229 |
Note 1: additions of 15 Jun 2005 |
| 230 |
*/ |