Use https for tarball URLs in .spec files
[xapian.git] / xapian-core / languages / finnish.sbl
blob1643c10de68eb9265bda776b0173bf61e91e4cf3
1 // Alias: fi
3 /* Finnish stemmer.
5    Numbers in square brackets refer to the sections in
6    Fred Karlsson, Finnish: An Essential Grammar. Routledge, 1999
7    ISBN 0-415-20705-3
9 */
11 routines (
12            mark_regions
13            R2
14            particle_etc possessive
15            LONG VI
16            case_ending
17            i_plural
18            t_plural
19            other_endings
20            tidy
23 externals ( stem )
25 integers ( p1 p2 )
26 strings ( x )
27 booleans ( ending_removed )
28 groupings ( AEI C V1 V2 particle_end )
30 stringescapes {}
32 /* special characters */
34 stringdef a"   '{U+00E4}'
35 stringdef o"   '{U+00F6}'
37 define AEI 'a{a"}ei'
38 define C 'bcdfghjklmnpqrstvwxz'
39 define V1 'aeiouy{a"}{o"}'
40 define V2 'aeiou{a"}{o"}'
41 define particle_end V1 + 'nt'
43 define mark_regions as (
45     $p1 = limit
46     $p2 = limit
48     goto V1  gopast non-V1  setmark p1
49     goto V1  gopast non-V1  setmark p2
52 backwardmode (
54     define R2 as $p2 <= cursor
56     define particle_etc as (
57         setlimit tomark p1 for ([substring])
58         among(
59             'kin'
60             'kaan' 'k{a"}{a"}n'
61             'ko'   'k{o"}'
62             'han'  'h{a"}n'
63             'pa'   'p{a"}'    // Particles [91]
64                 (particle_end)
65             'sti'             // Adverb [87]
66                 (R2)
67         )
68         delete
69     )
70     define possessive as (    // [36]
71         setlimit tomark p1 for ([substring])
72         among(
73             'si'
74                 (not 'k' delete)  // take 'ksi' as the Comitative case
75             'ni'
76                 (delete ['kse'] <- 'ksi') // kseni = ksi + ni
77             'nsa' 'ns{a"}'
78             'mme'
79             'nne'
80                 (delete)
81             /* Now for Vn possessives after case endings: [36] */
82             'an'
83                 (among('ta' 'ssa' 'sta' 'lla' 'lta' 'na') delete)
84             '{a"}n'
85                 (among('t{a"}' 'ss{a"}' 'st{a"}'
86                        'll{a"}' 'lt{a"}' 'n{a"}') delete)
87             'en'
88                 (among('lle' 'ine') delete)
89         )
90     )
92     define LONG as
93         among('aa' 'ee' 'ii' 'oo' 'uu' '{a"}{a"}' '{o"}{o"}')
95     define VI as ('i' V2)
97     define case_ending as (
98         setlimit tomark p1 for ([substring])
99         among(
100             'han'    ('a')          //-.
101             'hen'    ('e')          // |
102             'hin'    ('i')          // |
103             'hon'    ('o')          // |
104             'h{a"}n' ('{a"}')       // Illative   [43]
105             'h{o"}n' ('{o"}')       // |
106             'siin'   VI             // |
107             'seen'   LONG           //-'
109             'den'    VI
110             'tten'   VI             // Genitive plurals [34]
111                      ()
112             'n'                     // Genitive or Illative
113                 ( try ( LONG // Illative
114                         or 'ie' // Genitive
115                           and next ]
116                       )
117                   /* otherwise Genitive */
118                 )
120             'a' '{a"}'              //-.
121                      (V1 C)    // |
122             'tta' 'tt{a"}'          // Partitive  [32]
123                      ('e')          // |
124             'ta' 't{a"}'            //-'
126             'ssa' 'ss{a"}'          // Inessive   [41]
127             'sta' 'st{a"}'          // Elative    [42]
129             'lla' 'll{a"}'          // Adessive   [44]
130             'lta' 'lt{a"}'          // Ablative   [51]
131             'lle'                   // Allative   [46]
132             'na' 'n{a"}'            // Essive     [49]
133             'ksi'                   // Translative[50]
134             'ine'                   // Comitative [51]
136             /* Abessive and Instructive are too rare for
137                inclusion [51] */
139         )
140         delete
141         set ending_removed
142     )
143     define other_endings as (
144         setlimit tomark p2 for ([substring])
145         among(
146             'mpi' 'mpa' 'mp{a"}'
147             'mmi' 'mma' 'mm{a"}'    // Comparative forms [85]
148                 (not 'po')          //-improves things
149             'impi' 'impa' 'imp{a"}'
150             'immi' 'imma' 'imm{a"}' // Superlative forms [86]
151             'eja' 'ej{a"}'          // indicates agent [93.1B]
152         )
153         delete
154     )
155     define i_plural as (            // [26]
156         setlimit tomark p1 for ([substring])
157         among(
158             'i'  'j'
159         )
160         delete
161     )
162     define t_plural as (            // [26]
163         setlimit tomark p1 for (
164             ['t'] test V1
165             delete
166         )
167         setlimit tomark p2 for ([substring])
168         among(
169             'mma' (not 'po') //-mmat endings
170             'imma'           //-immat endings
171         )
172         delete
173     )
174     define tidy as (
175         setlimit tomark p1 for (
176             do ( LONG and ([next] delete ) ) // undouble vowel
177             do ( [AEI] C delete ) // remove trailing a, a", e, i
178             do ( ['j'] 'o' or 'u' delete )
179             do ( ['o'] 'j' delete )
180         )
181         goto non-V1 [C] -> x  x delete // undouble consonant
182     )
185 define stem as (
187     do mark_regions
188     unset ending_removed
189     backwards (
190         do particle_etc
191         do possessive
192         do case_ending
193         do other_endings
194         (ending_removed do i_plural) or do t_plural
195         do tidy
196     )