Document xapian-compact --blocksize takes an argument
[xapian.git] / xapian-core / languages / english.sbl
blobc43c15c74a402b731178f610f577fa4bbca1a297
1 // Alias: en
3 integers ( p1 p2 )
4 booleans ( Y_found )
6 routines (
7     prelude postlude
8     mark_regions
9     shortv
10     R1 R2
11     Step_1a Step_1b Step_1c Step_2 Step_3 Step_4 Step_5
12     exception1
13     exception2
16 externals ( stem )
18 groupings ( v v_WXY valid_LI )
20 stringescapes {}
22 define v        'aeiouy'
23 define v_WXY    v + 'wxY'
25 define valid_LI 'cdeghkmnrt'
27 define prelude as (
28     unset Y_found
29     do ( ['{'}'] delete)
30     do ( ['y'] <-'Y' set Y_found)
31     do repeat(goto (v ['y']) <-'Y' set Y_found)
34 define mark_regions as (
35     $p1 = limit
36     $p2 = limit
37     do(
38         among (
39             'gener'
40             'commun'  //  added May 2005
41             'arsen'   //  added Nov 2006 (arsenic/arsenal)
42             // ... extensions possible here ...
43         ) or (gopast v  gopast non-v)
44         setmark p1
45         gopast v  gopast non-v  setmark p2
46     )
49 backwardmode (
51     define shortv as (
52         ( non-v_WXY v non-v )
53         or
54         ( non-v v atlimit )
55     )
57     define R1 as $p1 <= cursor
58     define R2 as $p2 <= cursor
60     define Step_1a as (
61         try (
62             [substring] among (
63                 '{'}' '{'}s' '{'}s{'}'
64                        (delete)
65             )
66         )
67         [substring] among (
68             'sses' (<-'ss')
69             'ied' 'ies'
70                    ((hop 2 <-'i') or <-'ie')
71             's'    (next gopast v delete)
72             'us' 'ss'
73         )
74     )
76     define Step_1b as (
77         [substring] among (
78             'eed' 'eedly'
79                 (R1 <-'ee')
80             'ed' 'edly' 'ing' 'ingly'
81                 (
82                 test gopast v  delete
83                 test substring among(
84                     'at' 'bl' 'iz'
85                          (<+ 'e')
86                     'bb' 'dd' 'ff' 'gg' 'mm' 'nn' 'pp' 'rr' 'tt'
87                     // ignoring double c, h, j, k, q, v, w, and x
88                          ([next]  delete)
89                     ''   (atmark p1  test shortv  <+ 'e')
90                 )
91             )
92         )
93     )
95     define Step_1c as (
96         ['y' or 'Y']
97         non-v not atlimit
98         <-'i'
99     )
101     define Step_2 as (
102         [substring] R1 among (
103             'tional'  (<-'tion')
104             'enci'    (<-'ence')
105             'anci'    (<-'ance')
106             'abli'    (<-'able')
107             'entli'   (<-'ent')
108             'izer' 'ization'
109                       (<-'ize')
110             'ational' 'ation' 'ator'
111                       (<-'ate')
112             'alism' 'aliti' 'alli'
113                       (<-'al')
114             'fulness' (<-'ful')
115             'ousli' 'ousness'
116                       (<-'ous')
117             'iveness' 'iviti'
118                       (<-'ive')
119             'biliti' 'bli'
120                       (<-'ble')
121             'ogi'     ('l' <-'og')
122             'fulli'   (<-'ful')
123             'lessli'  (<-'less')
124             'li'      (valid_LI delete)
125         )
126     )
128     define Step_3 as (
129         [substring] R1 among (
130             'tional'  (<- 'tion')
131             'ational' (<- 'ate')
132             'alize'   (<-'al')
133             'icate' 'iciti' 'ical'
134                       (<-'ic')
135             'ful' 'ness'
136                       (delete)
137             'ative'
138                       (R2 delete)  // 'R2' added Dec 2001
139         )
140     )
142     define Step_4 as (
143         [substring] R2 among (
144             'al' 'ance' 'ence' 'er' 'ic' 'able' 'ible' 'ant' 'ement'
145             'ment' 'ent' 'ism' 'ate' 'iti' 'ous' 'ive' 'ize'
146                       (delete)
147             'ion'     ('s' or 't' delete)
148         )
149     )
151     define Step_5 as (
152         [substring] among (
153             'e' (R2 or (R1 not shortv) delete)
154             'l' (R2 'l' delete)
155         )
156     )
158     define exception2 as (
160         [substring] atlimit among(
161             'inning' 'outing' 'canning' 'herring' 'earring'
162             'proceed' 'exceed' 'succeed'
164             // ... extensions possible here ...
166         )
167     )
170 define exception1 as (
172     [substring] atlimit among(
174         /* special changes: */
176         'skis'      (<-'ski')
177         'skies'     (<-'sky')
178         'dying'     (<-'die')
179         'lying'     (<-'lie')
180         'tying'     (<-'tie')
182         /* special -LY cases */
184         'idly'      (<-'idl')
185         'gently'    (<-'gentl')
186         'ugly'      (<-'ugli')
187         'early'     (<-'earli')
188         'only'      (<-'onli')
189         'singly'    (<-'singl')
191         // ... extensions possible here ...
193         /* invariant forms: */
195         'sky'
196         'news'
197         'howe'
199         'atlas' 'cosmos' 'bias' 'andes' // not plural forms
201         // ... extensions possible here ...
202     )
205 define postlude as (Y_found  repeat(goto (['Y']) <-'y'))
207 define stem as (
209     exception1 or
210     not hop 3 or (
211         do prelude
212         do mark_regions
213         backwards (
215             do Step_1a
217             exception2 or (
219                 do Step_1b
220                 do Step_1c
222                 do Step_2
223                 do Step_3
224                 do Step_4
226                 do Step_5
227             )
228         )
229         do postlude
230     )