Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Finnish stemmer #16

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ This crate implements some stemmer algorithms found in the [snowball project](ht
- Danish
- Dutch
- English
- Finnish
- French
- German
- Greek
Expand Down
15 changes: 8 additions & 7 deletions algorithms/finnish.sbl
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,17 @@ externals ( stem )
integers ( p1 p2 )
strings ( x )
booleans ( ending_removed )
groupings ( AEI V1 V2 particle_end )
groupings ( AEI C V1 V2 particle_end )

stringescapes {}

/* special characters (in ISO Latin I) */
/* special characters */

stringdef a" hex 'E4'
stringdef o" hex 'F6'
stringdef a" '{U+00E4}'
stringdef o" '{U+00F6}'

define AEI 'a{a"}ei'
define C 'bcdfghjklmnpqrstvwxz'
define V1 'aeiouy{a"}{o"}'
define V2 'aeiou{a"}{o"}'
define particle_end V1 + 'nt'
Expand Down Expand Up @@ -115,7 +116,7 @@ backwardmode (
)

'a' '{a"}' //-.
(V1 non-V1) // |
(V1 C) // |
'tta' 'tt{a"}' // Partitive [32]
('e') // |
'ta' 't{a"}' //-'
Expand Down Expand Up @@ -171,11 +172,11 @@ backwardmode (
define tidy as (
setlimit tomark p1 for (
do ( LONG and ([next] delete ) ) // undouble vowel
do ( [AEI] non-V1 delete ) // remove trailing a, a", e, i
do ( [AEI] C delete ) // remove trailing a, a", e, i
do ( ['j'] 'o' or 'u' delete )
do ( ['o'] 'j' delete )
)
goto non-V1 [next] -> x x delete // undouble consonant
goto non-V1 [C] -> x x delete // undouble consonant
)
)

Expand Down
Loading