├── .gitignore ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── src ├── main │ └── java │ │ └── org │ │ └── tartarus │ │ └── snowball │ │ ├── SnowballStemmer.java │ │ ├── Among.java │ │ ├── TestApp.java │ │ ├── SnowballProgram.java │ │ └── ext │ │ ├── swedishStemmer.java │ │ ├── norwegianStemmer.java │ │ ├── danishStemmer.java │ │ ├── germanStemmer.java │ │ ├── russianStemmer.java │ │ ├── dutchStemmer.java │ │ └── porterStemmer.java └── test │ └── java │ └── org │ └── tartarus │ └── snowball │ └── test │ └── StemmerTest.java ├── HISTORY.md ├── README.md ├── gradlew.bat └── gradlew /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | .idea 3 | build 4 | out 5 | *.iml 6 | *.ipr 7 | *.iws 8 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rholder/snowball-stemmer/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /src/main/java/org/tartarus/snowball/SnowballStemmer.java: -------------------------------------------------------------------------------- 1 | 2 | package org.tartarus.snowball; 3 | import java.lang.reflect.InvocationTargetException; 4 | 5 | public abstract class SnowballStemmer extends SnowballProgram { 6 | public abstract boolean stem(); 7 | }; 8 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Thu Jan 23 01:30:32 CST 2014 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=http\://services.gradle.org/distributions/gradle-1.10-bin.zip 7 | -------------------------------------------------------------------------------- /HISTORY.md: -------------------------------------------------------------------------------- 1 | ## 1.3.0.581 - 2020-08-24 2 | * Minor edits to README.md and HISTORY.md for markdown updates 3 | 4 | ## 1.3.0.581 - 2013-01-23 5 | * Patched the frenchStemmer from original generated output to fix spurious break statements 6 | * Added Gradle 1.10 wrapper, project structure, and a minimal sanity checking test 7 | -------------------------------------------------------------------------------- /src/test/java/org/tartarus/snowball/test/StemmerTest.java: -------------------------------------------------------------------------------- 1 | package org.tartarus.snowball.test; 2 | 3 | import org.junit.Assert; 4 | import org.junit.Test; 5 | import org.tartarus.snowball.SnowballStemmer; 6 | import org.tartarus.snowball.ext.englishStemmer; 7 | 8 | public class StemmerTest { 9 | 10 | @Test 11 | public void englishSanityCheck() { 12 | 13 | SnowballStemmer snowballStemmer = new englishStemmer(); 14 | snowballStemmer.setCurrent("Jumps"); 15 | snowballStemmer.stem(); 16 | String result = snowballStemmer.getCurrent(); 17 | 18 | Assert.assertEquals("Jump", result); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/org/tartarus/snowball/Among.java: -------------------------------------------------------------------------------- 1 | package org.tartarus.snowball; 2 | 3 | import java.lang.reflect.Method; 4 | 5 | public class Among { 6 | public Among (String s, int substring_i, int result, 7 | String methodname, SnowballProgram methodobject) { 8 | this.s_size = s.length(); 9 | this.s = s.toCharArray(); 10 | this.substring_i = substring_i; 11 | this.result = result; 12 | this.methodobject = methodobject; 13 | if (methodname.length() == 0) { 14 | this.method = null; 15 | } else { 16 | try { 17 | this.method = methodobject.getClass(). 18 | getDeclaredMethod(methodname, new Class[0]); 19 | } catch (NoSuchMethodException e) { 20 | throw new RuntimeException(e); 21 | } 22 | } 23 | } 24 | 25 | public final int s_size; /* search string */ 26 | public final char[] s; /* search string */ 27 | public final int substring_i; /* index to longest matching substring */ 28 | public final int result; /* result of the lookup */ 29 | public final Method method; /* method to use if substring matches */ 30 | public final SnowballProgram methodobject; /* object to invoke method on */ 31 | }; 32 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## What is this? 2 | This is a repackaging of a version of the snowball-stemmer found at http://snowball.tartarus.org/ so that it's available 3 | on Maven Central. 4 | 5 | ## Maven 6 | ```xml 7 | 8 | com.github.rholder 9 | snowball-stemmer 10 | 1.3.0.581.1 11 | 12 | ``` 13 | 14 | ## Gradle 15 | ```groovy 16 | compile "com.github.rholder:snowball-stemmer:1.3.0.581.1" 17 | ``` 18 | 19 | ## Versioning 20 | In the absence of tags, branches, or releases in the original project SVN repository to call out a version, let's go 21 | with what [PyStemmer](https://pypi.python.org/pypi/PyStemmer) is currently using and tack on the SVN revision number at 22 | the end followed by my patch revision number (to fix anything weird that I introduce). For the initial version, we'll 23 | use 1.3.0.581.1. 24 | 25 | ## License 26 | This is a copy of the details about the license from [here](http://snowball.tartarus.org/license.php): 27 | 28 | ``` 29 | All the software given out on this Snowball site is covered by the BSD License 30 | (see http://www.opensource.org/licenses/bsd-license.html ), with Copyright (c) 31 | 2001, Dr Martin Porter, and (for the Java developments) Copyright (c) 2002, 32 | Richard Boulton. 33 | 34 | Essentially, all this means is that you can do what you like with the code, 35 | except claim another Copyright for it, or claim that it is issued under a 36 | different license. The software is also issued without warranties, which means 37 | that if anyone suffers through its use, they cannot come back and sue you. You 38 | also have to alert anyone to whom you give the Snowball software to the fact 39 | that it is covered by the BSD license. 40 | 41 | We have not bothered to insert the licensing arrangement into the text of the 42 | Snowball software. 43 | ``` 44 | 45 | ## References 46 | * http://snowball.tartarus.org 47 | * https://github.com/snowballstem 48 | -------------------------------------------------------------------------------- /src/main/java/org/tartarus/snowball/TestApp.java: -------------------------------------------------------------------------------- 1 | 2 | package org.tartarus.snowball; 3 | 4 | import java.lang.reflect.Method; 5 | import java.io.Reader; 6 | import java.io.Writer; 7 | import java.io.BufferedReader; 8 | import java.io.BufferedWriter; 9 | import java.io.FileInputStream; 10 | import java.io.InputStreamReader; 11 | import java.io.OutputStreamWriter; 12 | import java.io.OutputStream; 13 | import java.io.FileOutputStream; 14 | 15 | public class TestApp { 16 | private static void usage() 17 | { 18 | System.err.println("Usage: TestApp [-o ]"); 19 | } 20 | 21 | public static void main(String [] args) throws Throwable { 22 | if (args.length < 2) { 23 | usage(); 24 | return; 25 | } 26 | 27 | Class stemClass = Class.forName("org.tartarus.snowball.ext." + 28 | args[0] + "Stemmer"); 29 | SnowballStemmer stemmer = (SnowballStemmer) stemClass.newInstance(); 30 | 31 | Reader reader; 32 | reader = new InputStreamReader(new FileInputStream(args[1])); 33 | reader = new BufferedReader(reader); 34 | 35 | StringBuffer input = new StringBuffer(); 36 | 37 | OutputStream outstream; 38 | 39 | if (args.length > 2) { 40 | if (args.length >= 4 && args[2].equals("-o")) { 41 | outstream = new FileOutputStream(args[3]); 42 | } else { 43 | usage(); 44 | return; 45 | } 46 | } else { 47 | outstream = System.out; 48 | } 49 | Writer output = new OutputStreamWriter(outstream); 50 | output = new BufferedWriter(output); 51 | 52 | int repeat = 1; 53 | if (args.length > 4) { 54 | repeat = Integer.parseInt(args[4]); 55 | } 56 | 57 | Object [] emptyArgs = new Object[0]; 58 | int character; 59 | while ((character = reader.read()) != -1) { 60 | char ch = (char) character; 61 | if (Character.isWhitespace((char) ch)) { 62 | if (input.length() > 0) { 63 | stemmer.setCurrent(input.toString()); 64 | for (int i = repeat; i != 0; i--) { 65 | stemmer.stem(); 66 | } 67 | output.write(stemmer.getCurrent()); 68 | output.write('\n'); 69 | input.delete(0, input.length()); 70 | } 71 | } else { 72 | input.append(Character.toLowerCase(ch)); 73 | } 74 | } 75 | output.flush(); 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # For Cygwin, ensure paths are in UNIX format before anything is touched. 46 | if $cygwin ; then 47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 48 | fi 49 | 50 | # Attempt to set APP_HOME 51 | # Resolve links: $0 may be a link 52 | PRG="$0" 53 | # Need this for relative symlinks. 54 | while [ -h "$PRG" ] ; do 55 | ls=`ls -ld "$PRG"` 56 | link=`expr "$ls" : '.*-> \(.*\)$'` 57 | if expr "$link" : '/.*' > /dev/null; then 58 | PRG="$link" 59 | else 60 | PRG=`dirname "$PRG"`"/$link" 61 | fi 62 | done 63 | SAVED="`pwd`" 64 | cd "`dirname \"$PRG\"`/" >&- 65 | APP_HOME="`pwd -P`" 66 | cd "$SAVED" >&- 67 | 68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 69 | 70 | # Determine the Java command to use to start the JVM. 71 | if [ -n "$JAVA_HOME" ] ; then 72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 73 | # IBM's JDK on AIX uses strange locations for the executables 74 | JAVACMD="$JAVA_HOME/jre/sh/java" 75 | else 76 | JAVACMD="$JAVA_HOME/bin/java" 77 | fi 78 | if [ ! -x "$JAVACMD" ] ; then 79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 80 | 81 | Please set the JAVA_HOME variable in your environment to match the 82 | location of your Java installation." 83 | fi 84 | else 85 | JAVACMD="java" 86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 87 | 88 | Please set the JAVA_HOME variable in your environment to match the 89 | location of your Java installation." 90 | fi 91 | 92 | # Increase the maximum file descriptors if we can. 93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 94 | MAX_FD_LIMIT=`ulimit -H -n` 95 | if [ $? -eq 0 ] ; then 96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 97 | MAX_FD="$MAX_FD_LIMIT" 98 | fi 99 | ulimit -n $MAX_FD 100 | if [ $? -ne 0 ] ; then 101 | warn "Could not set maximum file descriptor limit: $MAX_FD" 102 | fi 103 | else 104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 105 | fi 106 | fi 107 | 108 | # For Darwin, add options to specify how the application appears in the dock 109 | if $darwin; then 110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 111 | fi 112 | 113 | # For Cygwin, switch paths to Windows format before running java 114 | if $cygwin ; then 115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 158 | function splitJvmOpts() { 159 | JVM_OPTS=("$@") 160 | } 161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 163 | 164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 165 | -------------------------------------------------------------------------------- /src/main/java/org/tartarus/snowball/SnowballProgram.java: -------------------------------------------------------------------------------- 1 | 2 | package org.tartarus.snowball; 3 | import java.lang.reflect.InvocationTargetException; 4 | 5 | public class SnowballProgram { 6 | protected SnowballProgram() 7 | { 8 | current = new StringBuffer(); 9 | setCurrent(""); 10 | } 11 | 12 | /** 13 | * Set the current string. 14 | */ 15 | public void setCurrent(String value) 16 | { 17 | current.replace(0, current.length(), value); 18 | cursor = 0; 19 | limit = current.length(); 20 | limit_backward = 0; 21 | bra = cursor; 22 | ket = limit; 23 | } 24 | 25 | /** 26 | * Get the current string. 27 | */ 28 | public String getCurrent() 29 | { 30 | String result = current.toString(); 31 | // Make a new StringBuffer. If we reuse the old one, and a user of 32 | // the library keeps a reference to the buffer returned (for example, 33 | // by converting it to a String in a way which doesn't force a copy), 34 | // the buffer size will not decrease, and we will risk wasting a large 35 | // amount of memory. 36 | // Thanks to Wolfram Esser for spotting this problem. 37 | current = new StringBuffer(); 38 | return result; 39 | } 40 | 41 | // current string 42 | protected StringBuffer current; 43 | 44 | protected int cursor; 45 | protected int limit; 46 | protected int limit_backward; 47 | protected int bra; 48 | protected int ket; 49 | 50 | protected void copy_from(SnowballProgram other) 51 | { 52 | current = other.current; 53 | cursor = other.cursor; 54 | limit = other.limit; 55 | limit_backward = other.limit_backward; 56 | bra = other.bra; 57 | ket = other.ket; 58 | } 59 | 60 | protected boolean in_grouping(char [] s, int min, int max) 61 | { 62 | if (cursor >= limit) return false; 63 | char ch = current.charAt(cursor); 64 | if (ch > max || ch < min) return false; 65 | ch -= min; 66 | if ((s[ch >> 3] & (0X1 << (ch & 0X7))) == 0) return false; 67 | cursor++; 68 | return true; 69 | } 70 | 71 | protected boolean in_grouping_b(char [] s, int min, int max) 72 | { 73 | if (cursor <= limit_backward) return false; 74 | char ch = current.charAt(cursor - 1); 75 | if (ch > max || ch < min) return false; 76 | ch -= min; 77 | if ((s[ch >> 3] & (0X1 << (ch & 0X7))) == 0) return false; 78 | cursor--; 79 | return true; 80 | } 81 | 82 | protected boolean out_grouping(char [] s, int min, int max) 83 | { 84 | if (cursor >= limit) return false; 85 | char ch = current.charAt(cursor); 86 | if (ch > max || ch < min) { 87 | cursor++; 88 | return true; 89 | } 90 | ch -= min; 91 | if ((s[ch >> 3] & (0X1 << (ch & 0X7))) == 0) { 92 | cursor ++; 93 | return true; 94 | } 95 | return false; 96 | } 97 | 98 | protected boolean out_grouping_b(char [] s, int min, int max) 99 | { 100 | if (cursor <= limit_backward) return false; 101 | char ch = current.charAt(cursor - 1); 102 | if (ch > max || ch < min) { 103 | cursor--; 104 | return true; 105 | } 106 | ch -= min; 107 | if ((s[ch >> 3] & (0X1 << (ch & 0X7))) == 0) { 108 | cursor--; 109 | return true; 110 | } 111 | return false; 112 | } 113 | 114 | protected boolean in_range(int min, int max) 115 | { 116 | if (cursor >= limit) return false; 117 | char ch = current.charAt(cursor); 118 | if (ch > max || ch < min) return false; 119 | cursor++; 120 | return true; 121 | } 122 | 123 | protected boolean in_range_b(int min, int max) 124 | { 125 | if (cursor <= limit_backward) return false; 126 | char ch = current.charAt(cursor - 1); 127 | if (ch > max || ch < min) return false; 128 | cursor--; 129 | return true; 130 | } 131 | 132 | protected boolean out_range(int min, int max) 133 | { 134 | if (cursor >= limit) return false; 135 | char ch = current.charAt(cursor); 136 | if (!(ch > max || ch < min)) return false; 137 | cursor++; 138 | return true; 139 | } 140 | 141 | protected boolean out_range_b(int min, int max) 142 | { 143 | if (cursor <= limit_backward) return false; 144 | char ch = current.charAt(cursor - 1); 145 | if(!(ch > max || ch < min)) return false; 146 | cursor--; 147 | return true; 148 | } 149 | 150 | protected boolean eq_s(int s_size, String s) 151 | { 152 | if (limit - cursor < s_size) return false; 153 | int i; 154 | for (i = 0; i != s_size; i++) { 155 | if (current.charAt(cursor + i) != s.charAt(i)) return false; 156 | } 157 | cursor += s_size; 158 | return true; 159 | } 160 | 161 | protected boolean eq_s_b(int s_size, String s) 162 | { 163 | if (cursor - limit_backward < s_size) return false; 164 | int i; 165 | for (i = 0; i != s_size; i++) { 166 | if (current.charAt(cursor - s_size + i) != s.charAt(i)) return false; 167 | } 168 | cursor -= s_size; 169 | return true; 170 | } 171 | 172 | protected boolean eq_v(CharSequence s) 173 | { 174 | return eq_s(s.length(), s.toString()); 175 | } 176 | 177 | protected boolean eq_v_b(CharSequence s) 178 | { return eq_s_b(s.length(), s.toString()); 179 | } 180 | 181 | protected int find_among(Among v[], int v_size) 182 | { 183 | int i = 0; 184 | int j = v_size; 185 | 186 | int c = cursor; 187 | int l = limit; 188 | 189 | int common_i = 0; 190 | int common_j = 0; 191 | 192 | boolean first_key_inspected = false; 193 | 194 | while(true) { 195 | int k = i + ((j - i) >> 1); 196 | int diff = 0; 197 | int common = common_i < common_j ? common_i : common_j; // smaller 198 | Among w = v[k]; 199 | int i2; 200 | for (i2 = common; i2 < w.s_size; i2++) { 201 | if (c + common == l) { 202 | diff = -1; 203 | break; 204 | } 205 | diff = current.charAt(c + common) - w.s[i2]; 206 | if (diff != 0) break; 207 | common++; 208 | } 209 | if (diff < 0) { 210 | j = k; 211 | common_j = common; 212 | } else { 213 | i = k; 214 | common_i = common; 215 | } 216 | if (j - i <= 1) { 217 | if (i > 0) break; // v->s has been inspected 218 | if (j == i) break; // only one item in v 219 | 220 | // - but now we need to go round once more to get 221 | // v->s inspected. This looks messy, but is actually 222 | // the optimal approach. 223 | 224 | if (first_key_inspected) break; 225 | first_key_inspected = true; 226 | } 227 | } 228 | while(true) { 229 | Among w = v[i]; 230 | if (common_i >= w.s_size) { 231 | cursor = c + w.s_size; 232 | if (w.method == null) return w.result; 233 | boolean res; 234 | try { 235 | Object resobj = w.method.invoke(w.methodobject, 236 | new Object[0]); 237 | res = resobj.toString().equals("true"); 238 | } catch (InvocationTargetException e) { 239 | res = false; 240 | // FIXME - debug message 241 | } catch (IllegalAccessException e) { 242 | res = false; 243 | // FIXME - debug message 244 | } 245 | cursor = c + w.s_size; 246 | if (res) return w.result; 247 | } 248 | i = w.substring_i; 249 | if (i < 0) return 0; 250 | } 251 | } 252 | 253 | // find_among_b is for backwards processing. Same comments apply 254 | protected int find_among_b(Among v[], int v_size) 255 | { 256 | int i = 0; 257 | int j = v_size; 258 | 259 | int c = cursor; 260 | int lb = limit_backward; 261 | 262 | int common_i = 0; 263 | int common_j = 0; 264 | 265 | boolean first_key_inspected = false; 266 | 267 | while(true) { 268 | int k = i + ((j - i) >> 1); 269 | int diff = 0; 270 | int common = common_i < common_j ? common_i : common_j; 271 | Among w = v[k]; 272 | int i2; 273 | for (i2 = w.s_size - 1 - common; i2 >= 0; i2--) { 274 | if (c - common == lb) { 275 | diff = -1; 276 | break; 277 | } 278 | diff = current.charAt(c - 1 - common) - w.s[i2]; 279 | if (diff != 0) break; 280 | common++; 281 | } 282 | if (diff < 0) { 283 | j = k; 284 | common_j = common; 285 | } else { 286 | i = k; 287 | common_i = common; 288 | } 289 | if (j - i <= 1) { 290 | if (i > 0) break; 291 | if (j == i) break; 292 | if (first_key_inspected) break; 293 | first_key_inspected = true; 294 | } 295 | } 296 | while(true) { 297 | Among w = v[i]; 298 | if (common_i >= w.s_size) { 299 | cursor = c - w.s_size; 300 | if (w.method == null) return w.result; 301 | 302 | boolean res; 303 | try { 304 | Object resobj = w.method.invoke(w.methodobject, 305 | new Object[0]); 306 | res = resobj.toString().equals("true"); 307 | } catch (InvocationTargetException e) { 308 | res = false; 309 | // FIXME - debug message 310 | } catch (IllegalAccessException e) { 311 | res = false; 312 | // FIXME - debug message 313 | } 314 | cursor = c - w.s_size; 315 | if (res) return w.result; 316 | } 317 | i = w.substring_i; 318 | if (i < 0) return 0; 319 | } 320 | } 321 | 322 | /* to replace chars between c_bra and c_ket in current by the 323 | * chars in s. 324 | */ 325 | protected int replace_s(int c_bra, int c_ket, String s) 326 | { 327 | int adjustment = s.length() - (c_ket - c_bra); 328 | current.replace(c_bra, c_ket, s); 329 | limit += adjustment; 330 | if (cursor >= c_ket) cursor += adjustment; 331 | else if (cursor > c_bra) cursor = c_bra; 332 | return adjustment; 333 | } 334 | 335 | protected void slice_check() 336 | { 337 | if (bra < 0 || 338 | bra > ket || 339 | ket > limit || 340 | limit > current.length()) // this line could be removed 341 | { 342 | System.err.println("faulty slice operation"); 343 | // FIXME: report error somehow. 344 | /* 345 | fprintf(stderr, "faulty slice operation:\n"); 346 | debug(z, -1, 0); 347 | exit(1); 348 | */ 349 | } 350 | } 351 | 352 | protected void slice_from(String s) 353 | { 354 | slice_check(); 355 | replace_s(bra, ket, s); 356 | } 357 | 358 | protected void slice_from(CharSequence s) 359 | { 360 | slice_from(s.toString()); 361 | } 362 | 363 | protected void slice_del() 364 | { 365 | slice_from(""); 366 | } 367 | 368 | protected void insert(int c_bra, int c_ket, String s) 369 | { 370 | int adjustment = replace_s(c_bra, c_ket, s); 371 | if (c_bra <= bra) bra += adjustment; 372 | if (c_bra <= ket) ket += adjustment; 373 | } 374 | 375 | protected void insert(int c_bra, int c_ket, CharSequence s) 376 | { 377 | insert(c_bra, c_ket, s.toString()); 378 | } 379 | 380 | /* Copy the slice into the supplied StringBuffer */ 381 | protected StringBuffer slice_to(StringBuffer s) 382 | { 383 | slice_check(); 384 | int len = ket - bra; 385 | s.replace(0, s.length(), current.substring(bra, ket)); 386 | return s; 387 | } 388 | 389 | /* Copy the slice into the supplied StringBuilder */ 390 | protected StringBuilder slice_to(StringBuilder s) 391 | { 392 | slice_check(); 393 | int len = ket - bra; 394 | s.replace(0, s.length(), current.substring(bra, ket)); 395 | return s; 396 | } 397 | 398 | protected StringBuffer assign_to(StringBuffer s) 399 | { 400 | s.replace(0, s.length(), current.substring(0, limit)); 401 | return s; 402 | } 403 | 404 | protected StringBuilder assign_to(StringBuilder s) 405 | { 406 | s.replace(0, s.length(), current.substring(0, limit)); 407 | return s; 408 | } 409 | 410 | /* 411 | extern void debug(struct SN_env * z, int number, int line_count) 412 | { int i; 413 | int limit = SIZE(z->p); 414 | //if (number >= 0) printf("%3d (line %4d): '", number, line_count); 415 | if (number >= 0) printf("%3d (line %4d): [%d]'", number, line_count,limit); 416 | for (i = 0; i <= limit; i++) 417 | { if (z->lb == i) printf("{"); 418 | if (z->bra == i) printf("["); 419 | if (z->c == i) printf("|"); 420 | if (z->ket == i) printf("]"); 421 | if (z->l == i) printf("}"); 422 | if (i < limit) 423 | { int ch = z->p[i]; 424 | if (ch == 0) ch = '#'; 425 | printf("%c", ch); 426 | } 427 | } 428 | printf("'\n"); 429 | } 430 | */ 431 | 432 | }; 433 | -------------------------------------------------------------------------------- /src/main/java/org/tartarus/snowball/ext/swedishStemmer.java: -------------------------------------------------------------------------------- 1 | // This file was generated automatically by the Snowball to Java compiler 2 | 3 | package org.tartarus.snowball.ext; 4 | 5 | import org.tartarus.snowball.Among; 6 | 7 | /** 8 | * This class was automatically generated by a Snowball to Java compiler 9 | * It implements the stemming algorithm defined by a snowball script. 10 | */ 11 | 12 | public class swedishStemmer extends org.tartarus.snowball.SnowballStemmer { 13 | 14 | private static final long serialVersionUID = 1L; 15 | 16 | private final static swedishStemmer methodObject = new swedishStemmer (); 17 | 18 | private final static Among a_0[] = { 19 | new Among ( "a", -1, 1, "", methodObject ), 20 | new Among ( "arna", 0, 1, "", methodObject ), 21 | new Among ( "erna", 0, 1, "", methodObject ), 22 | new Among ( "heterna", 2, 1, "", methodObject ), 23 | new Among ( "orna", 0, 1, "", methodObject ), 24 | new Among ( "ad", -1, 1, "", methodObject ), 25 | new Among ( "e", -1, 1, "", methodObject ), 26 | new Among ( "ade", 6, 1, "", methodObject ), 27 | new Among ( "ande", 6, 1, "", methodObject ), 28 | new Among ( "arne", 6, 1, "", methodObject ), 29 | new Among ( "are", 6, 1, "", methodObject ), 30 | new Among ( "aste", 6, 1, "", methodObject ), 31 | new Among ( "en", -1, 1, "", methodObject ), 32 | new Among ( "anden", 12, 1, "", methodObject ), 33 | new Among ( "aren", 12, 1, "", methodObject ), 34 | new Among ( "heten", 12, 1, "", methodObject ), 35 | new Among ( "ern", -1, 1, "", methodObject ), 36 | new Among ( "ar", -1, 1, "", methodObject ), 37 | new Among ( "er", -1, 1, "", methodObject ), 38 | new Among ( "heter", 18, 1, "", methodObject ), 39 | new Among ( "or", -1, 1, "", methodObject ), 40 | new Among ( "s", -1, 2, "", methodObject ), 41 | new Among ( "as", 21, 1, "", methodObject ), 42 | new Among ( "arnas", 22, 1, "", methodObject ), 43 | new Among ( "ernas", 22, 1, "", methodObject ), 44 | new Among ( "ornas", 22, 1, "", methodObject ), 45 | new Among ( "es", 21, 1, "", methodObject ), 46 | new Among ( "ades", 26, 1, "", methodObject ), 47 | new Among ( "andes", 26, 1, "", methodObject ), 48 | new Among ( "ens", 21, 1, "", methodObject ), 49 | new Among ( "arens", 29, 1, "", methodObject ), 50 | new Among ( "hetens", 29, 1, "", methodObject ), 51 | new Among ( "erns", 21, 1, "", methodObject ), 52 | new Among ( "at", -1, 1, "", methodObject ), 53 | new Among ( "andet", -1, 1, "", methodObject ), 54 | new Among ( "het", -1, 1, "", methodObject ), 55 | new Among ( "ast", -1, 1, "", methodObject ) 56 | }; 57 | 58 | private final static Among a_1[] = { 59 | new Among ( "dd", -1, -1, "", methodObject ), 60 | new Among ( "gd", -1, -1, "", methodObject ), 61 | new Among ( "nn", -1, -1, "", methodObject ), 62 | new Among ( "dt", -1, -1, "", methodObject ), 63 | new Among ( "gt", -1, -1, "", methodObject ), 64 | new Among ( "kt", -1, -1, "", methodObject ), 65 | new Among ( "tt", -1, -1, "", methodObject ) 66 | }; 67 | 68 | private final static Among a_2[] = { 69 | new Among ( "ig", -1, 1, "", methodObject ), 70 | new Among ( "lig", 0, 1, "", methodObject ), 71 | new Among ( "els", -1, 1, "", methodObject ), 72 | new Among ( "fullt", -1, 3, "", methodObject ), 73 | new Among ( "l\u00F6st", -1, 2, "", methodObject ) 74 | }; 75 | 76 | private static final char g_v[] = {17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 0, 32 }; 77 | 78 | private static final char g_s_ending[] = {119, 127, 149 }; 79 | 80 | private int I_x; 81 | private int I_p1; 82 | 83 | private void copy_from(swedishStemmer other) { 84 | I_x = other.I_x; 85 | I_p1 = other.I_p1; 86 | super.copy_from(other); 87 | } 88 | 89 | private boolean r_mark_regions() { 90 | int v_1; 91 | int v_2; 92 | // (, line 26 93 | I_p1 = limit; 94 | // test, line 29 95 | v_1 = cursor; 96 | // (, line 29 97 | // hop, line 29 98 | { 99 | int c = cursor + 3; 100 | if (0 > c || c > limit) 101 | { 102 | return false; 103 | } 104 | cursor = c; 105 | } 106 | // setmark x, line 29 107 | I_x = cursor; 108 | cursor = v_1; 109 | // goto, line 30 110 | golab0: while(true) 111 | { 112 | v_2 = cursor; 113 | lab1: do { 114 | if (!(in_grouping(g_v, 97, 246))) 115 | { 116 | break lab1; 117 | } 118 | cursor = v_2; 119 | break golab0; 120 | } while (false); 121 | cursor = v_2; 122 | if (cursor >= limit) 123 | { 124 | return false; 125 | } 126 | cursor++; 127 | } 128 | // gopast, line 30 129 | golab2: while(true) 130 | { 131 | lab3: do { 132 | if (!(out_grouping(g_v, 97, 246))) 133 | { 134 | break lab3; 135 | } 136 | break golab2; 137 | } while (false); 138 | if (cursor >= limit) 139 | { 140 | return false; 141 | } 142 | cursor++; 143 | } 144 | // setmark p1, line 30 145 | I_p1 = cursor; 146 | // try, line 31 147 | lab4: do { 148 | // (, line 31 149 | if (!(I_p1 < I_x)) 150 | { 151 | break lab4; 152 | } 153 | I_p1 = I_x; 154 | } while (false); 155 | return true; 156 | } 157 | 158 | private boolean r_main_suffix() { 159 | int among_var; 160 | int v_1; 161 | int v_2; 162 | // (, line 36 163 | // setlimit, line 37 164 | v_1 = limit - cursor; 165 | // tomark, line 37 166 | if (cursor < I_p1) 167 | { 168 | return false; 169 | } 170 | cursor = I_p1; 171 | v_2 = limit_backward; 172 | limit_backward = cursor; 173 | cursor = limit - v_1; 174 | // (, line 37 175 | // [, line 37 176 | ket = cursor; 177 | // substring, line 37 178 | among_var = find_among_b(a_0, 37); 179 | if (among_var == 0) 180 | { 181 | limit_backward = v_2; 182 | return false; 183 | } 184 | // ], line 37 185 | bra = cursor; 186 | limit_backward = v_2; 187 | switch(among_var) { 188 | case 0: 189 | return false; 190 | case 1: 191 | // (, line 44 192 | // delete, line 44 193 | slice_del(); 194 | break; 195 | case 2: 196 | // (, line 46 197 | if (!(in_grouping_b(g_s_ending, 98, 121))) 198 | { 199 | return false; 200 | } 201 | // delete, line 46 202 | slice_del(); 203 | break; 204 | } 205 | return true; 206 | } 207 | 208 | private boolean r_consonant_pair() { 209 | int v_1; 210 | int v_2; 211 | int v_3; 212 | // setlimit, line 50 213 | v_1 = limit - cursor; 214 | // tomark, line 50 215 | if (cursor < I_p1) 216 | { 217 | return false; 218 | } 219 | cursor = I_p1; 220 | v_2 = limit_backward; 221 | limit_backward = cursor; 222 | cursor = limit - v_1; 223 | // (, line 50 224 | // and, line 52 225 | v_3 = limit - cursor; 226 | // among, line 51 227 | if (find_among_b(a_1, 7) == 0) 228 | { 229 | limit_backward = v_2; 230 | return false; 231 | } 232 | cursor = limit - v_3; 233 | // (, line 52 234 | // [, line 52 235 | ket = cursor; 236 | // next, line 52 237 | if (cursor <= limit_backward) 238 | { 239 | limit_backward = v_2; 240 | return false; 241 | } 242 | cursor--; 243 | // ], line 52 244 | bra = cursor; 245 | // delete, line 52 246 | slice_del(); 247 | limit_backward = v_2; 248 | return true; 249 | } 250 | 251 | private boolean r_other_suffix() { 252 | int among_var; 253 | int v_1; 254 | int v_2; 255 | // setlimit, line 55 256 | v_1 = limit - cursor; 257 | // tomark, line 55 258 | if (cursor < I_p1) 259 | { 260 | return false; 261 | } 262 | cursor = I_p1; 263 | v_2 = limit_backward; 264 | limit_backward = cursor; 265 | cursor = limit - v_1; 266 | // (, line 55 267 | // [, line 56 268 | ket = cursor; 269 | // substring, line 56 270 | among_var = find_among_b(a_2, 5); 271 | if (among_var == 0) 272 | { 273 | limit_backward = v_2; 274 | return false; 275 | } 276 | // ], line 56 277 | bra = cursor; 278 | switch(among_var) { 279 | case 0: 280 | limit_backward = v_2; 281 | return false; 282 | case 1: 283 | // (, line 57 284 | // delete, line 57 285 | slice_del(); 286 | break; 287 | case 2: 288 | // (, line 58 289 | // <-, line 58 290 | slice_from("l\u00F6s"); 291 | break; 292 | case 3: 293 | // (, line 59 294 | // <-, line 59 295 | slice_from("full"); 296 | break; 297 | } 298 | limit_backward = v_2; 299 | return true; 300 | } 301 | 302 | public boolean stem() { 303 | int v_1; 304 | int v_2; 305 | int v_3; 306 | int v_4; 307 | // (, line 64 308 | // do, line 66 309 | v_1 = cursor; 310 | lab0: do { 311 | // call mark_regions, line 66 312 | if (!r_mark_regions()) 313 | { 314 | break lab0; 315 | } 316 | } while (false); 317 | cursor = v_1; 318 | // backwards, line 67 319 | limit_backward = cursor; cursor = limit; 320 | // (, line 67 321 | // do, line 68 322 | v_2 = limit - cursor; 323 | lab1: do { 324 | // call main_suffix, line 68 325 | if (!r_main_suffix()) 326 | { 327 | break lab1; 328 | } 329 | } while (false); 330 | cursor = limit - v_2; 331 | // do, line 69 332 | v_3 = limit - cursor; 333 | lab2: do { 334 | // call consonant_pair, line 69 335 | if (!r_consonant_pair()) 336 | { 337 | break lab2; 338 | } 339 | } while (false); 340 | cursor = limit - v_3; 341 | // do, line 70 342 | v_4 = limit - cursor; 343 | lab3: do { 344 | // call other_suffix, line 70 345 | if (!r_other_suffix()) 346 | { 347 | break lab3; 348 | } 349 | } while (false); 350 | cursor = limit - v_4; 351 | cursor = limit_backward; return true; 352 | } 353 | 354 | public boolean equals( Object o ) { 355 | return o instanceof swedishStemmer; 356 | } 357 | 358 | public int hashCode() { 359 | return swedishStemmer.class.getName().hashCode(); 360 | } 361 | 362 | 363 | 364 | } 365 | 366 | -------------------------------------------------------------------------------- /src/main/java/org/tartarus/snowball/ext/norwegianStemmer.java: -------------------------------------------------------------------------------- 1 | // This file was generated automatically by the Snowball to Java compiler 2 | 3 | package org.tartarus.snowball.ext; 4 | 5 | import org.tartarus.snowball.Among; 6 | 7 | /** 8 | * This class was automatically generated by a Snowball to Java compiler 9 | * It implements the stemming algorithm defined by a snowball script. 10 | */ 11 | 12 | public class norwegianStemmer extends org.tartarus.snowball.SnowballStemmer { 13 | 14 | private static final long serialVersionUID = 1L; 15 | 16 | private final static norwegianStemmer methodObject = new norwegianStemmer (); 17 | 18 | private final static Among a_0[] = { 19 | new Among ( "a", -1, 1, "", methodObject ), 20 | new Among ( "e", -1, 1, "", methodObject ), 21 | new Among ( "ede", 1, 1, "", methodObject ), 22 | new Among ( "ande", 1, 1, "", methodObject ), 23 | new Among ( "ende", 1, 1, "", methodObject ), 24 | new Among ( "ane", 1, 1, "", methodObject ), 25 | new Among ( "ene", 1, 1, "", methodObject ), 26 | new Among ( "hetene", 6, 1, "", methodObject ), 27 | new Among ( "erte", 1, 3, "", methodObject ), 28 | new Among ( "en", -1, 1, "", methodObject ), 29 | new Among ( "heten", 9, 1, "", methodObject ), 30 | new Among ( "ar", -1, 1, "", methodObject ), 31 | new Among ( "er", -1, 1, "", methodObject ), 32 | new Among ( "heter", 12, 1, "", methodObject ), 33 | new Among ( "s", -1, 2, "", methodObject ), 34 | new Among ( "as", 14, 1, "", methodObject ), 35 | new Among ( "es", 14, 1, "", methodObject ), 36 | new Among ( "edes", 16, 1, "", methodObject ), 37 | new Among ( "endes", 16, 1, "", methodObject ), 38 | new Among ( "enes", 16, 1, "", methodObject ), 39 | new Among ( "hetenes", 19, 1, "", methodObject ), 40 | new Among ( "ens", 14, 1, "", methodObject ), 41 | new Among ( "hetens", 21, 1, "", methodObject ), 42 | new Among ( "ers", 14, 1, "", methodObject ), 43 | new Among ( "ets", 14, 1, "", methodObject ), 44 | new Among ( "et", -1, 1, "", methodObject ), 45 | new Among ( "het", 25, 1, "", methodObject ), 46 | new Among ( "ert", -1, 3, "", methodObject ), 47 | new Among ( "ast", -1, 1, "", methodObject ) 48 | }; 49 | 50 | private final static Among a_1[] = { 51 | new Among ( "dt", -1, -1, "", methodObject ), 52 | new Among ( "vt", -1, -1, "", methodObject ) 53 | }; 54 | 55 | private final static Among a_2[] = { 56 | new Among ( "leg", -1, 1, "", methodObject ), 57 | new Among ( "eleg", 0, 1, "", methodObject ), 58 | new Among ( "ig", -1, 1, "", methodObject ), 59 | new Among ( "eig", 2, 1, "", methodObject ), 60 | new Among ( "lig", 2, 1, "", methodObject ), 61 | new Among ( "elig", 4, 1, "", methodObject ), 62 | new Among ( "els", -1, 1, "", methodObject ), 63 | new Among ( "lov", -1, 1, "", methodObject ), 64 | new Among ( "elov", 7, 1, "", methodObject ), 65 | new Among ( "slov", 7, 1, "", methodObject ), 66 | new Among ( "hetslov", 9, 1, "", methodObject ) 67 | }; 68 | 69 | private static final char g_v[] = {17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 0, 128 }; 70 | 71 | private static final char g_s_ending[] = {119, 125, 149, 1 }; 72 | 73 | private int I_x; 74 | private int I_p1; 75 | 76 | private void copy_from(norwegianStemmer other) { 77 | I_x = other.I_x; 78 | I_p1 = other.I_p1; 79 | super.copy_from(other); 80 | } 81 | 82 | private boolean r_mark_regions() { 83 | int v_1; 84 | int v_2; 85 | // (, line 26 86 | I_p1 = limit; 87 | // test, line 30 88 | v_1 = cursor; 89 | // (, line 30 90 | // hop, line 30 91 | { 92 | int c = cursor + 3; 93 | if (0 > c || c > limit) 94 | { 95 | return false; 96 | } 97 | cursor = c; 98 | } 99 | // setmark x, line 30 100 | I_x = cursor; 101 | cursor = v_1; 102 | // goto, line 31 103 | golab0: while(true) 104 | { 105 | v_2 = cursor; 106 | lab1: do { 107 | if (!(in_grouping(g_v, 97, 248))) 108 | { 109 | break lab1; 110 | } 111 | cursor = v_2; 112 | break golab0; 113 | } while (false); 114 | cursor = v_2; 115 | if (cursor >= limit) 116 | { 117 | return false; 118 | } 119 | cursor++; 120 | } 121 | // gopast, line 31 122 | golab2: while(true) 123 | { 124 | lab3: do { 125 | if (!(out_grouping(g_v, 97, 248))) 126 | { 127 | break lab3; 128 | } 129 | break golab2; 130 | } while (false); 131 | if (cursor >= limit) 132 | { 133 | return false; 134 | } 135 | cursor++; 136 | } 137 | // setmark p1, line 31 138 | I_p1 = cursor; 139 | // try, line 32 140 | lab4: do { 141 | // (, line 32 142 | if (!(I_p1 < I_x)) 143 | { 144 | break lab4; 145 | } 146 | I_p1 = I_x; 147 | } while (false); 148 | return true; 149 | } 150 | 151 | private boolean r_main_suffix() { 152 | int among_var; 153 | int v_1; 154 | int v_2; 155 | int v_3; 156 | // (, line 37 157 | // setlimit, line 38 158 | v_1 = limit - cursor; 159 | // tomark, line 38 160 | if (cursor < I_p1) 161 | { 162 | return false; 163 | } 164 | cursor = I_p1; 165 | v_2 = limit_backward; 166 | limit_backward = cursor; 167 | cursor = limit - v_1; 168 | // (, line 38 169 | // [, line 38 170 | ket = cursor; 171 | // substring, line 38 172 | among_var = find_among_b(a_0, 29); 173 | if (among_var == 0) 174 | { 175 | limit_backward = v_2; 176 | return false; 177 | } 178 | // ], line 38 179 | bra = cursor; 180 | limit_backward = v_2; 181 | switch(among_var) { 182 | case 0: 183 | return false; 184 | case 1: 185 | // (, line 44 186 | // delete, line 44 187 | slice_del(); 188 | break; 189 | case 2: 190 | // (, line 46 191 | // or, line 46 192 | lab0: do { 193 | v_3 = limit - cursor; 194 | lab1: do { 195 | if (!(in_grouping_b(g_s_ending, 98, 122))) 196 | { 197 | break lab1; 198 | } 199 | break lab0; 200 | } while (false); 201 | cursor = limit - v_3; 202 | // (, line 46 203 | // literal, line 46 204 | if (!(eq_s_b(1, "k"))) 205 | { 206 | return false; 207 | } 208 | if (!(out_grouping_b(g_v, 97, 248))) 209 | { 210 | return false; 211 | } 212 | } while (false); 213 | // delete, line 46 214 | slice_del(); 215 | break; 216 | case 3: 217 | // (, line 48 218 | // <-, line 48 219 | slice_from("er"); 220 | break; 221 | } 222 | return true; 223 | } 224 | 225 | private boolean r_consonant_pair() { 226 | int v_1; 227 | int v_2; 228 | int v_3; 229 | // (, line 52 230 | // test, line 53 231 | v_1 = limit - cursor; 232 | // (, line 53 233 | // setlimit, line 54 234 | v_2 = limit - cursor; 235 | // tomark, line 54 236 | if (cursor < I_p1) 237 | { 238 | return false; 239 | } 240 | cursor = I_p1; 241 | v_3 = limit_backward; 242 | limit_backward = cursor; 243 | cursor = limit - v_2; 244 | // (, line 54 245 | // [, line 54 246 | ket = cursor; 247 | // substring, line 54 248 | if (find_among_b(a_1, 2) == 0) 249 | { 250 | limit_backward = v_3; 251 | return false; 252 | } 253 | // ], line 54 254 | bra = cursor; 255 | limit_backward = v_3; 256 | cursor = limit - v_1; 257 | // next, line 59 258 | if (cursor <= limit_backward) 259 | { 260 | return false; 261 | } 262 | cursor--; 263 | // ], line 59 264 | bra = cursor; 265 | // delete, line 59 266 | slice_del(); 267 | return true; 268 | } 269 | 270 | private boolean r_other_suffix() { 271 | int among_var; 272 | int v_1; 273 | int v_2; 274 | // (, line 62 275 | // setlimit, line 63 276 | v_1 = limit - cursor; 277 | // tomark, line 63 278 | if (cursor < I_p1) 279 | { 280 | return false; 281 | } 282 | cursor = I_p1; 283 | v_2 = limit_backward; 284 | limit_backward = cursor; 285 | cursor = limit - v_1; 286 | // (, line 63 287 | // [, line 63 288 | ket = cursor; 289 | // substring, line 63 290 | among_var = find_among_b(a_2, 11); 291 | if (among_var == 0) 292 | { 293 | limit_backward = v_2; 294 | return false; 295 | } 296 | // ], line 63 297 | bra = cursor; 298 | limit_backward = v_2; 299 | switch(among_var) { 300 | case 0: 301 | return false; 302 | case 1: 303 | // (, line 67 304 | // delete, line 67 305 | slice_del(); 306 | break; 307 | } 308 | return true; 309 | } 310 | 311 | public boolean stem() { 312 | int v_1; 313 | int v_2; 314 | int v_3; 315 | int v_4; 316 | // (, line 72 317 | // do, line 74 318 | v_1 = cursor; 319 | lab0: do { 320 | // call mark_regions, line 74 321 | if (!r_mark_regions()) 322 | { 323 | break lab0; 324 | } 325 | } while (false); 326 | cursor = v_1; 327 | // backwards, line 75 328 | limit_backward = cursor; cursor = limit; 329 | // (, line 75 330 | // do, line 76 331 | v_2 = limit - cursor; 332 | lab1: do { 333 | // call main_suffix, line 76 334 | if (!r_main_suffix()) 335 | { 336 | break lab1; 337 | } 338 | } while (false); 339 | cursor = limit - v_2; 340 | // do, line 77 341 | v_3 = limit - cursor; 342 | lab2: do { 343 | // call consonant_pair, line 77 344 | if (!r_consonant_pair()) 345 | { 346 | break lab2; 347 | } 348 | } while (false); 349 | cursor = limit - v_3; 350 | // do, line 78 351 | v_4 = limit - cursor; 352 | lab3: do { 353 | // call other_suffix, line 78 354 | if (!r_other_suffix()) 355 | { 356 | break lab3; 357 | } 358 | } while (false); 359 | cursor = limit - v_4; 360 | cursor = limit_backward; return true; 361 | } 362 | 363 | public boolean equals( Object o ) { 364 | return o instanceof norwegianStemmer; 365 | } 366 | 367 | public int hashCode() { 368 | return norwegianStemmer.class.getName().hashCode(); 369 | } 370 | 371 | 372 | 373 | } 374 | 375 | -------------------------------------------------------------------------------- /src/main/java/org/tartarus/snowball/ext/danishStemmer.java: -------------------------------------------------------------------------------- 1 | // This file was generated automatically by the Snowball to Java compiler 2 | 3 | package org.tartarus.snowball.ext; 4 | 5 | import org.tartarus.snowball.Among; 6 | 7 | /** 8 | * This class was automatically generated by a Snowball to Java compiler 9 | * It implements the stemming algorithm defined by a snowball script. 10 | */ 11 | 12 | public class danishStemmer extends org.tartarus.snowball.SnowballStemmer { 13 | 14 | private static final long serialVersionUID = 1L; 15 | 16 | private final static danishStemmer methodObject = new danishStemmer (); 17 | 18 | private final static Among a_0[] = { 19 | new Among ( "hed", -1, 1, "", methodObject ), 20 | new Among ( "ethed", 0, 1, "", methodObject ), 21 | new Among ( "ered", -1, 1, "", methodObject ), 22 | new Among ( "e", -1, 1, "", methodObject ), 23 | new Among ( "erede", 3, 1, "", methodObject ), 24 | new Among ( "ende", 3, 1, "", methodObject ), 25 | new Among ( "erende", 5, 1, "", methodObject ), 26 | new Among ( "ene", 3, 1, "", methodObject ), 27 | new Among ( "erne", 3, 1, "", methodObject ), 28 | new Among ( "ere", 3, 1, "", methodObject ), 29 | new Among ( "en", -1, 1, "", methodObject ), 30 | new Among ( "heden", 10, 1, "", methodObject ), 31 | new Among ( "eren", 10, 1, "", methodObject ), 32 | new Among ( "er", -1, 1, "", methodObject ), 33 | new Among ( "heder", 13, 1, "", methodObject ), 34 | new Among ( "erer", 13, 1, "", methodObject ), 35 | new Among ( "s", -1, 2, "", methodObject ), 36 | new Among ( "heds", 16, 1, "", methodObject ), 37 | new Among ( "es", 16, 1, "", methodObject ), 38 | new Among ( "endes", 18, 1, "", methodObject ), 39 | new Among ( "erendes", 19, 1, "", methodObject ), 40 | new Among ( "enes", 18, 1, "", methodObject ), 41 | new Among ( "ernes", 18, 1, "", methodObject ), 42 | new Among ( "eres", 18, 1, "", methodObject ), 43 | new Among ( "ens", 16, 1, "", methodObject ), 44 | new Among ( "hedens", 24, 1, "", methodObject ), 45 | new Among ( "erens", 24, 1, "", methodObject ), 46 | new Among ( "ers", 16, 1, "", methodObject ), 47 | new Among ( "ets", 16, 1, "", methodObject ), 48 | new Among ( "erets", 28, 1, "", methodObject ), 49 | new Among ( "et", -1, 1, "", methodObject ), 50 | new Among ( "eret", 30, 1, "", methodObject ) 51 | }; 52 | 53 | private final static Among a_1[] = { 54 | new Among ( "gd", -1, -1, "", methodObject ), 55 | new Among ( "dt", -1, -1, "", methodObject ), 56 | new Among ( "gt", -1, -1, "", methodObject ), 57 | new Among ( "kt", -1, -1, "", methodObject ) 58 | }; 59 | 60 | private final static Among a_2[] = { 61 | new Among ( "ig", -1, 1, "", methodObject ), 62 | new Among ( "lig", 0, 1, "", methodObject ), 63 | new Among ( "elig", 1, 1, "", methodObject ), 64 | new Among ( "els", -1, 1, "", methodObject ), 65 | new Among ( "l\u00F8st", -1, 2, "", methodObject ) 66 | }; 67 | 68 | private static final char g_v[] = {17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 0, 128 }; 69 | 70 | private static final char g_s_ending[] = {239, 254, 42, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16 }; 71 | 72 | private int I_x; 73 | private int I_p1; 74 | private java.lang.StringBuilder S_ch = new java.lang.StringBuilder(); 75 | 76 | private void copy_from(danishStemmer other) { 77 | I_x = other.I_x; 78 | I_p1 = other.I_p1; 79 | S_ch = other.S_ch; 80 | super.copy_from(other); 81 | } 82 | 83 | private boolean r_mark_regions() { 84 | int v_1; 85 | int v_2; 86 | // (, line 29 87 | I_p1 = limit; 88 | // test, line 33 89 | v_1 = cursor; 90 | // (, line 33 91 | // hop, line 33 92 | { 93 | int c = cursor + 3; 94 | if (0 > c || c > limit) 95 | { 96 | return false; 97 | } 98 | cursor = c; 99 | } 100 | // setmark x, line 33 101 | I_x = cursor; 102 | cursor = v_1; 103 | // goto, line 34 104 | golab0: while(true) 105 | { 106 | v_2 = cursor; 107 | lab1: do { 108 | if (!(in_grouping(g_v, 97, 248))) 109 | { 110 | break lab1; 111 | } 112 | cursor = v_2; 113 | break golab0; 114 | } while (false); 115 | cursor = v_2; 116 | if (cursor >= limit) 117 | { 118 | return false; 119 | } 120 | cursor++; 121 | } 122 | // gopast, line 34 123 | golab2: while(true) 124 | { 125 | lab3: do { 126 | if (!(out_grouping(g_v, 97, 248))) 127 | { 128 | break lab3; 129 | } 130 | break golab2; 131 | } while (false); 132 | if (cursor >= limit) 133 | { 134 | return false; 135 | } 136 | cursor++; 137 | } 138 | // setmark p1, line 34 139 | I_p1 = cursor; 140 | // try, line 35 141 | lab4: do { 142 | // (, line 35 143 | if (!(I_p1 < I_x)) 144 | { 145 | break lab4; 146 | } 147 | I_p1 = I_x; 148 | } while (false); 149 | return true; 150 | } 151 | 152 | private boolean r_main_suffix() { 153 | int among_var; 154 | int v_1; 155 | int v_2; 156 | // (, line 40 157 | // setlimit, line 41 158 | v_1 = limit - cursor; 159 | // tomark, line 41 160 | if (cursor < I_p1) 161 | { 162 | return false; 163 | } 164 | cursor = I_p1; 165 | v_2 = limit_backward; 166 | limit_backward = cursor; 167 | cursor = limit - v_1; 168 | // (, line 41 169 | // [, line 41 170 | ket = cursor; 171 | // substring, line 41 172 | among_var = find_among_b(a_0, 32); 173 | if (among_var == 0) 174 | { 175 | limit_backward = v_2; 176 | return false; 177 | } 178 | // ], line 41 179 | bra = cursor; 180 | limit_backward = v_2; 181 | switch(among_var) { 182 | case 0: 183 | return false; 184 | case 1: 185 | // (, line 48 186 | // delete, line 48 187 | slice_del(); 188 | break; 189 | case 2: 190 | // (, line 50 191 | if (!(in_grouping_b(g_s_ending, 97, 229))) 192 | { 193 | return false; 194 | } 195 | // delete, line 50 196 | slice_del(); 197 | break; 198 | } 199 | return true; 200 | } 201 | 202 | private boolean r_consonant_pair() { 203 | int v_1; 204 | int v_2; 205 | int v_3; 206 | // (, line 54 207 | // test, line 55 208 | v_1 = limit - cursor; 209 | // (, line 55 210 | // setlimit, line 56 211 | v_2 = limit - cursor; 212 | // tomark, line 56 213 | if (cursor < I_p1) 214 | { 215 | return false; 216 | } 217 | cursor = I_p1; 218 | v_3 = limit_backward; 219 | limit_backward = cursor; 220 | cursor = limit - v_2; 221 | // (, line 56 222 | // [, line 56 223 | ket = cursor; 224 | // substring, line 56 225 | if (find_among_b(a_1, 4) == 0) 226 | { 227 | limit_backward = v_3; 228 | return false; 229 | } 230 | // ], line 56 231 | bra = cursor; 232 | limit_backward = v_3; 233 | cursor = limit - v_1; 234 | // next, line 62 235 | if (cursor <= limit_backward) 236 | { 237 | return false; 238 | } 239 | cursor--; 240 | // ], line 62 241 | bra = cursor; 242 | // delete, line 62 243 | slice_del(); 244 | return true; 245 | } 246 | 247 | private boolean r_other_suffix() { 248 | int among_var; 249 | int v_1; 250 | int v_2; 251 | int v_3; 252 | int v_4; 253 | // (, line 65 254 | // do, line 66 255 | v_1 = limit - cursor; 256 | lab0: do { 257 | // (, line 66 258 | // [, line 66 259 | ket = cursor; 260 | // literal, line 66 261 | if (!(eq_s_b(2, "st"))) 262 | { 263 | break lab0; 264 | } 265 | // ], line 66 266 | bra = cursor; 267 | // literal, line 66 268 | if (!(eq_s_b(2, "ig"))) 269 | { 270 | break lab0; 271 | } 272 | // delete, line 66 273 | slice_del(); 274 | } while (false); 275 | cursor = limit - v_1; 276 | // setlimit, line 67 277 | v_2 = limit - cursor; 278 | // tomark, line 67 279 | if (cursor < I_p1) 280 | { 281 | return false; 282 | } 283 | cursor = I_p1; 284 | v_3 = limit_backward; 285 | limit_backward = cursor; 286 | cursor = limit - v_2; 287 | // (, line 67 288 | // [, line 67 289 | ket = cursor; 290 | // substring, line 67 291 | among_var = find_among_b(a_2, 5); 292 | if (among_var == 0) 293 | { 294 | limit_backward = v_3; 295 | return false; 296 | } 297 | // ], line 67 298 | bra = cursor; 299 | limit_backward = v_3; 300 | switch(among_var) { 301 | case 0: 302 | return false; 303 | case 1: 304 | // (, line 70 305 | // delete, line 70 306 | slice_del(); 307 | // do, line 70 308 | v_4 = limit - cursor; 309 | lab1: do { 310 | // call consonant_pair, line 70 311 | if (!r_consonant_pair()) 312 | { 313 | break lab1; 314 | } 315 | } while (false); 316 | cursor = limit - v_4; 317 | break; 318 | case 2: 319 | // (, line 72 320 | // <-, line 72 321 | slice_from("l\u00F8s"); 322 | break; 323 | } 324 | return true; 325 | } 326 | 327 | private boolean r_undouble() { 328 | int v_1; 329 | int v_2; 330 | // (, line 75 331 | // setlimit, line 76 332 | v_1 = limit - cursor; 333 | // tomark, line 76 334 | if (cursor < I_p1) 335 | { 336 | return false; 337 | } 338 | cursor = I_p1; 339 | v_2 = limit_backward; 340 | limit_backward = cursor; 341 | cursor = limit - v_1; 342 | // (, line 76 343 | // [, line 76 344 | ket = cursor; 345 | if (!(out_grouping_b(g_v, 97, 248))) 346 | { 347 | limit_backward = v_2; 348 | return false; 349 | } 350 | // ], line 76 351 | bra = cursor; 352 | // -> ch, line 76 353 | S_ch = slice_to(S_ch); 354 | limit_backward = v_2; 355 | // name ch, line 77 356 | if (!(eq_v_b(S_ch))) 357 | { 358 | return false; 359 | } 360 | // delete, line 78 361 | slice_del(); 362 | return true; 363 | } 364 | 365 | public boolean stem() { 366 | int v_1; 367 | int v_2; 368 | int v_3; 369 | int v_4; 370 | int v_5; 371 | // (, line 82 372 | // do, line 84 373 | v_1 = cursor; 374 | lab0: do { 375 | // call mark_regions, line 84 376 | if (!r_mark_regions()) 377 | { 378 | break lab0; 379 | } 380 | } while (false); 381 | cursor = v_1; 382 | // backwards, line 85 383 | limit_backward = cursor; cursor = limit; 384 | // (, line 85 385 | // do, line 86 386 | v_2 = limit - cursor; 387 | lab1: do { 388 | // call main_suffix, line 86 389 | if (!r_main_suffix()) 390 | { 391 | break lab1; 392 | } 393 | } while (false); 394 | cursor = limit - v_2; 395 | // do, line 87 396 | v_3 = limit - cursor; 397 | lab2: do { 398 | // call consonant_pair, line 87 399 | if (!r_consonant_pair()) 400 | { 401 | break lab2; 402 | } 403 | } while (false); 404 | cursor = limit - v_3; 405 | // do, line 88 406 | v_4 = limit - cursor; 407 | lab3: do { 408 | // call other_suffix, line 88 409 | if (!r_other_suffix()) 410 | { 411 | break lab3; 412 | } 413 | } while (false); 414 | cursor = limit - v_4; 415 | // do, line 89 416 | v_5 = limit - cursor; 417 | lab4: do { 418 | // call undouble, line 89 419 | if (!r_undouble()) 420 | { 421 | break lab4; 422 | } 423 | } while (false); 424 | cursor = limit - v_5; 425 | cursor = limit_backward; return true; 426 | } 427 | 428 | public boolean equals( Object o ) { 429 | return o instanceof danishStemmer; 430 | } 431 | 432 | public int hashCode() { 433 | return danishStemmer.class.getName().hashCode(); 434 | } 435 | 436 | 437 | 438 | } 439 | 440 | -------------------------------------------------------------------------------- /src/main/java/org/tartarus/snowball/ext/germanStemmer.java: -------------------------------------------------------------------------------- 1 | // This file was generated automatically by the Snowball to Java compiler 2 | 3 | package org.tartarus.snowball.ext; 4 | 5 | import org.tartarus.snowball.Among; 6 | 7 | /** 8 | * This class was automatically generated by a Snowball to Java compiler 9 | * It implements the stemming algorithm defined by a snowball script. 10 | */ 11 | 12 | public class germanStemmer extends org.tartarus.snowball.SnowballStemmer { 13 | 14 | private static final long serialVersionUID = 1L; 15 | 16 | private final static germanStemmer methodObject = new germanStemmer (); 17 | 18 | private final static Among a_0[] = { 19 | new Among ( "", -1, 6, "", methodObject ), 20 | new Among ( "U", 0, 2, "", methodObject ), 21 | new Among ( "Y", 0, 1, "", methodObject ), 22 | new Among ( "\u00E4", 0, 3, "", methodObject ), 23 | new Among ( "\u00F6", 0, 4, "", methodObject ), 24 | new Among ( "\u00FC", 0, 5, "", methodObject ) 25 | }; 26 | 27 | private final static Among a_1[] = { 28 | new Among ( "e", -1, 2, "", methodObject ), 29 | new Among ( "em", -1, 1, "", methodObject ), 30 | new Among ( "en", -1, 2, "", methodObject ), 31 | new Among ( "ern", -1, 1, "", methodObject ), 32 | new Among ( "er", -1, 1, "", methodObject ), 33 | new Among ( "s", -1, 3, "", methodObject ), 34 | new Among ( "es", 5, 2, "", methodObject ) 35 | }; 36 | 37 | private final static Among a_2[] = { 38 | new Among ( "en", -1, 1, "", methodObject ), 39 | new Among ( "er", -1, 1, "", methodObject ), 40 | new Among ( "st", -1, 2, "", methodObject ), 41 | new Among ( "est", 2, 1, "", methodObject ) 42 | }; 43 | 44 | private final static Among a_3[] = { 45 | new Among ( "ig", -1, 1, "", methodObject ), 46 | new Among ( "lich", -1, 1, "", methodObject ) 47 | }; 48 | 49 | private final static Among a_4[] = { 50 | new Among ( "end", -1, 1, "", methodObject ), 51 | new Among ( "ig", -1, 2, "", methodObject ), 52 | new Among ( "ung", -1, 1, "", methodObject ), 53 | new Among ( "lich", -1, 3, "", methodObject ), 54 | new Among ( "isch", -1, 2, "", methodObject ), 55 | new Among ( "ik", -1, 2, "", methodObject ), 56 | new Among ( "heit", -1, 3, "", methodObject ), 57 | new Among ( "keit", -1, 4, "", methodObject ) 58 | }; 59 | 60 | private static final char g_v[] = {17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 32, 8 }; 61 | 62 | private static final char g_s_ending[] = {117, 30, 5 }; 63 | 64 | private static final char g_st_ending[] = {117, 30, 4 }; 65 | 66 | private int I_x; 67 | private int I_p2; 68 | private int I_p1; 69 | 70 | private void copy_from(germanStemmer other) { 71 | I_x = other.I_x; 72 | I_p2 = other.I_p2; 73 | I_p1 = other.I_p1; 74 | super.copy_from(other); 75 | } 76 | 77 | private boolean r_prelude() { 78 | int v_1; 79 | int v_2; 80 | int v_3; 81 | int v_4; 82 | int v_5; 83 | int v_6; 84 | // (, line 33 85 | // test, line 35 86 | v_1 = cursor; 87 | // repeat, line 35 88 | replab0: while(true) 89 | { 90 | v_2 = cursor; 91 | lab1: do { 92 | // (, line 35 93 | // or, line 38 94 | lab2: do { 95 | v_3 = cursor; 96 | lab3: do { 97 | // (, line 36 98 | // [, line 37 99 | bra = cursor; 100 | // literal, line 37 101 | if (!(eq_s(1, "\u00DF"))) 102 | { 103 | break lab3; 104 | } 105 | // ], line 37 106 | ket = cursor; 107 | // <-, line 37 108 | slice_from("ss"); 109 | break lab2; 110 | } while (false); 111 | cursor = v_3; 112 | // next, line 38 113 | if (cursor >= limit) 114 | { 115 | break lab1; 116 | } 117 | cursor++; 118 | } while (false); 119 | continue replab0; 120 | } while (false); 121 | cursor = v_2; 122 | break replab0; 123 | } 124 | cursor = v_1; 125 | // repeat, line 41 126 | replab4: while(true) 127 | { 128 | v_4 = cursor; 129 | lab5: do { 130 | // goto, line 41 131 | golab6: while(true) 132 | { 133 | v_5 = cursor; 134 | lab7: do { 135 | // (, line 41 136 | if (!(in_grouping(g_v, 97, 252))) 137 | { 138 | break lab7; 139 | } 140 | // [, line 42 141 | bra = cursor; 142 | // or, line 42 143 | lab8: do { 144 | v_6 = cursor; 145 | lab9: do { 146 | // (, line 42 147 | // literal, line 42 148 | if (!(eq_s(1, "u"))) 149 | { 150 | break lab9; 151 | } 152 | // ], line 42 153 | ket = cursor; 154 | if (!(in_grouping(g_v, 97, 252))) 155 | { 156 | break lab9; 157 | } 158 | // <-, line 42 159 | slice_from("U"); 160 | break lab8; 161 | } while (false); 162 | cursor = v_6; 163 | // (, line 43 164 | // literal, line 43 165 | if (!(eq_s(1, "y"))) 166 | { 167 | break lab7; 168 | } 169 | // ], line 43 170 | ket = cursor; 171 | if (!(in_grouping(g_v, 97, 252))) 172 | { 173 | break lab7; 174 | } 175 | // <-, line 43 176 | slice_from("Y"); 177 | } while (false); 178 | cursor = v_5; 179 | break golab6; 180 | } while (false); 181 | cursor = v_5; 182 | if (cursor >= limit) 183 | { 184 | break lab5; 185 | } 186 | cursor++; 187 | } 188 | continue replab4; 189 | } while (false); 190 | cursor = v_4; 191 | break replab4; 192 | } 193 | return true; 194 | } 195 | 196 | private boolean r_mark_regions() { 197 | int v_1; 198 | // (, line 47 199 | I_p1 = limit; 200 | I_p2 = limit; 201 | // test, line 52 202 | v_1 = cursor; 203 | // (, line 52 204 | // hop, line 52 205 | { 206 | int c = cursor + 3; 207 | if (0 > c || c > limit) 208 | { 209 | return false; 210 | } 211 | cursor = c; 212 | } 213 | // setmark x, line 52 214 | I_x = cursor; 215 | cursor = v_1; 216 | // gopast, line 54 217 | golab0: while(true) 218 | { 219 | lab1: do { 220 | if (!(in_grouping(g_v, 97, 252))) 221 | { 222 | break lab1; 223 | } 224 | break golab0; 225 | } while (false); 226 | if (cursor >= limit) 227 | { 228 | return false; 229 | } 230 | cursor++; 231 | } 232 | // gopast, line 54 233 | golab2: while(true) 234 | { 235 | lab3: do { 236 | if (!(out_grouping(g_v, 97, 252))) 237 | { 238 | break lab3; 239 | } 240 | break golab2; 241 | } while (false); 242 | if (cursor >= limit) 243 | { 244 | return false; 245 | } 246 | cursor++; 247 | } 248 | // setmark p1, line 54 249 | I_p1 = cursor; 250 | // try, line 55 251 | lab4: do { 252 | // (, line 55 253 | if (!(I_p1 < I_x)) 254 | { 255 | break lab4; 256 | } 257 | I_p1 = I_x; 258 | } while (false); 259 | // gopast, line 56 260 | golab5: while(true) 261 | { 262 | lab6: do { 263 | if (!(in_grouping(g_v, 97, 252))) 264 | { 265 | break lab6; 266 | } 267 | break golab5; 268 | } while (false); 269 | if (cursor >= limit) 270 | { 271 | return false; 272 | } 273 | cursor++; 274 | } 275 | // gopast, line 56 276 | golab7: while(true) 277 | { 278 | lab8: do { 279 | if (!(out_grouping(g_v, 97, 252))) 280 | { 281 | break lab8; 282 | } 283 | break golab7; 284 | } while (false); 285 | if (cursor >= limit) 286 | { 287 | return false; 288 | } 289 | cursor++; 290 | } 291 | // setmark p2, line 56 292 | I_p2 = cursor; 293 | return true; 294 | } 295 | 296 | private boolean r_postlude() { 297 | int among_var; 298 | int v_1; 299 | // repeat, line 60 300 | replab0: while(true) 301 | { 302 | v_1 = cursor; 303 | lab1: do { 304 | // (, line 60 305 | // [, line 62 306 | bra = cursor; 307 | // substring, line 62 308 | among_var = find_among(a_0, 6); 309 | if (among_var == 0) 310 | { 311 | break lab1; 312 | } 313 | // ], line 62 314 | ket = cursor; 315 | switch(among_var) { 316 | case 0: 317 | break lab1; 318 | case 1: 319 | // (, line 63 320 | // <-, line 63 321 | slice_from("y"); 322 | break; 323 | case 2: 324 | // (, line 64 325 | // <-, line 64 326 | slice_from("u"); 327 | break; 328 | case 3: 329 | // (, line 65 330 | // <-, line 65 331 | slice_from("a"); 332 | break; 333 | case 4: 334 | // (, line 66 335 | // <-, line 66 336 | slice_from("o"); 337 | break; 338 | case 5: 339 | // (, line 67 340 | // <-, line 67 341 | slice_from("u"); 342 | break; 343 | case 6: 344 | // (, line 68 345 | // next, line 68 346 | if (cursor >= limit) 347 | { 348 | break lab1; 349 | } 350 | cursor++; 351 | break; 352 | } 353 | continue replab0; 354 | } while (false); 355 | cursor = v_1; 356 | break replab0; 357 | } 358 | return true; 359 | } 360 | 361 | private boolean r_R1() { 362 | if (!(I_p1 <= cursor)) 363 | { 364 | return false; 365 | } 366 | return true; 367 | } 368 | 369 | private boolean r_R2() { 370 | if (!(I_p2 <= cursor)) 371 | { 372 | return false; 373 | } 374 | return true; 375 | } 376 | 377 | private boolean r_standard_suffix() { 378 | int among_var; 379 | int v_1; 380 | int v_2; 381 | int v_3; 382 | int v_4; 383 | int v_5; 384 | int v_6; 385 | int v_7; 386 | int v_8; 387 | int v_9; 388 | int v_10; 389 | // (, line 78 390 | // do, line 79 391 | v_1 = limit - cursor; 392 | lab0: do { 393 | // (, line 79 394 | // [, line 80 395 | ket = cursor; 396 | // substring, line 80 397 | among_var = find_among_b(a_1, 7); 398 | if (among_var == 0) 399 | { 400 | break lab0; 401 | } 402 | // ], line 80 403 | bra = cursor; 404 | // call R1, line 80 405 | if (!r_R1()) 406 | { 407 | break lab0; 408 | } 409 | switch(among_var) { 410 | case 0: 411 | break lab0; 412 | case 1: 413 | // (, line 82 414 | // delete, line 82 415 | slice_del(); 416 | break; 417 | case 2: 418 | // (, line 85 419 | // delete, line 85 420 | slice_del(); 421 | // try, line 86 422 | v_2 = limit - cursor; 423 | lab1: do { 424 | // (, line 86 425 | // [, line 86 426 | ket = cursor; 427 | // literal, line 86 428 | if (!(eq_s_b(1, "s"))) 429 | { 430 | cursor = limit - v_2; 431 | break lab1; 432 | } 433 | // ], line 86 434 | bra = cursor; 435 | // literal, line 86 436 | if (!(eq_s_b(3, "nis"))) 437 | { 438 | cursor = limit - v_2; 439 | break lab1; 440 | } 441 | // delete, line 86 442 | slice_del(); 443 | } while (false); 444 | break; 445 | case 3: 446 | // (, line 89 447 | if (!(in_grouping_b(g_s_ending, 98, 116))) 448 | { 449 | break lab0; 450 | } 451 | // delete, line 89 452 | slice_del(); 453 | break; 454 | } 455 | } while (false); 456 | cursor = limit - v_1; 457 | // do, line 93 458 | v_3 = limit - cursor; 459 | lab2: do { 460 | // (, line 93 461 | // [, line 94 462 | ket = cursor; 463 | // substring, line 94 464 | among_var = find_among_b(a_2, 4); 465 | if (among_var == 0) 466 | { 467 | break lab2; 468 | } 469 | // ], line 94 470 | bra = cursor; 471 | // call R1, line 94 472 | if (!r_R1()) 473 | { 474 | break lab2; 475 | } 476 | switch(among_var) { 477 | case 0: 478 | break lab2; 479 | case 1: 480 | // (, line 96 481 | // delete, line 96 482 | slice_del(); 483 | break; 484 | case 2: 485 | // (, line 99 486 | if (!(in_grouping_b(g_st_ending, 98, 116))) 487 | { 488 | break lab2; 489 | } 490 | // hop, line 99 491 | { 492 | int c = cursor - 3; 493 | if (limit_backward > c || c > limit) 494 | { 495 | break lab2; 496 | } 497 | cursor = c; 498 | } 499 | // delete, line 99 500 | slice_del(); 501 | break; 502 | } 503 | } while (false); 504 | cursor = limit - v_3; 505 | // do, line 103 506 | v_4 = limit - cursor; 507 | lab3: do { 508 | // (, line 103 509 | // [, line 104 510 | ket = cursor; 511 | // substring, line 104 512 | among_var = find_among_b(a_4, 8); 513 | if (among_var == 0) 514 | { 515 | break lab3; 516 | } 517 | // ], line 104 518 | bra = cursor; 519 | // call R2, line 104 520 | if (!r_R2()) 521 | { 522 | break lab3; 523 | } 524 | switch(among_var) { 525 | case 0: 526 | break lab3; 527 | case 1: 528 | // (, line 106 529 | // delete, line 106 530 | slice_del(); 531 | // try, line 107 532 | v_5 = limit - cursor; 533 | lab4: do { 534 | // (, line 107 535 | // [, line 107 536 | ket = cursor; 537 | // literal, line 107 538 | if (!(eq_s_b(2, "ig"))) 539 | { 540 | cursor = limit - v_5; 541 | break lab4; 542 | } 543 | // ], line 107 544 | bra = cursor; 545 | // not, line 107 546 | { 547 | v_6 = limit - cursor; 548 | lab5: do { 549 | // literal, line 107 550 | if (!(eq_s_b(1, "e"))) 551 | { 552 | break lab5; 553 | } 554 | cursor = limit - v_5; 555 | break lab4; 556 | } while (false); 557 | cursor = limit - v_6; 558 | } 559 | // call R2, line 107 560 | if (!r_R2()) 561 | { 562 | cursor = limit - v_5; 563 | break lab4; 564 | } 565 | // delete, line 107 566 | slice_del(); 567 | } while (false); 568 | break; 569 | case 2: 570 | // (, line 110 571 | // not, line 110 572 | { 573 | v_7 = limit - cursor; 574 | lab6: do { 575 | // literal, line 110 576 | if (!(eq_s_b(1, "e"))) 577 | { 578 | break lab6; 579 | } 580 | break lab3; 581 | } while (false); 582 | cursor = limit - v_7; 583 | } 584 | // delete, line 110 585 | slice_del(); 586 | break; 587 | case 3: 588 | // (, line 113 589 | // delete, line 113 590 | slice_del(); 591 | // try, line 114 592 | v_8 = limit - cursor; 593 | lab7: do { 594 | // (, line 114 595 | // [, line 115 596 | ket = cursor; 597 | // or, line 115 598 | lab8: do { 599 | v_9 = limit - cursor; 600 | lab9: do { 601 | // literal, line 115 602 | if (!(eq_s_b(2, "er"))) 603 | { 604 | break lab9; 605 | } 606 | break lab8; 607 | } while (false); 608 | cursor = limit - v_9; 609 | // literal, line 115 610 | if (!(eq_s_b(2, "en"))) 611 | { 612 | cursor = limit - v_8; 613 | break lab7; 614 | } 615 | } while (false); 616 | // ], line 115 617 | bra = cursor; 618 | // call R1, line 115 619 | if (!r_R1()) 620 | { 621 | cursor = limit - v_8; 622 | break lab7; 623 | } 624 | // delete, line 115 625 | slice_del(); 626 | } while (false); 627 | break; 628 | case 4: 629 | // (, line 119 630 | // delete, line 119 631 | slice_del(); 632 | // try, line 120 633 | v_10 = limit - cursor; 634 | lab10: do { 635 | // (, line 120 636 | // [, line 121 637 | ket = cursor; 638 | // substring, line 121 639 | among_var = find_among_b(a_3, 2); 640 | if (among_var == 0) 641 | { 642 | cursor = limit - v_10; 643 | break lab10; 644 | } 645 | // ], line 121 646 | bra = cursor; 647 | // call R2, line 121 648 | if (!r_R2()) 649 | { 650 | cursor = limit - v_10; 651 | break lab10; 652 | } 653 | switch(among_var) { 654 | case 0: 655 | cursor = limit - v_10; 656 | break lab10; 657 | case 1: 658 | // (, line 123 659 | // delete, line 123 660 | slice_del(); 661 | break; 662 | } 663 | } while (false); 664 | break; 665 | } 666 | } while (false); 667 | cursor = limit - v_4; 668 | return true; 669 | } 670 | 671 | public boolean stem() { 672 | int v_1; 673 | int v_2; 674 | int v_3; 675 | int v_4; 676 | // (, line 133 677 | // do, line 134 678 | v_1 = cursor; 679 | lab0: do { 680 | // call prelude, line 134 681 | if (!r_prelude()) 682 | { 683 | break lab0; 684 | } 685 | } while (false); 686 | cursor = v_1; 687 | // do, line 135 688 | v_2 = cursor; 689 | lab1: do { 690 | // call mark_regions, line 135 691 | if (!r_mark_regions()) 692 | { 693 | break lab1; 694 | } 695 | } while (false); 696 | cursor = v_2; 697 | // backwards, line 136 698 | limit_backward = cursor; cursor = limit; 699 | // do, line 137 700 | v_3 = limit - cursor; 701 | lab2: do { 702 | // call standard_suffix, line 137 703 | if (!r_standard_suffix()) 704 | { 705 | break lab2; 706 | } 707 | } while (false); 708 | cursor = limit - v_3; 709 | cursor = limit_backward; // do, line 138 710 | v_4 = cursor; 711 | lab3: do { 712 | // call postlude, line 138 713 | if (!r_postlude()) 714 | { 715 | break lab3; 716 | } 717 | } while (false); 718 | cursor = v_4; 719 | return true; 720 | } 721 | 722 | public boolean equals( Object o ) { 723 | return o instanceof germanStemmer; 724 | } 725 | 726 | public int hashCode() { 727 | return germanStemmer.class.getName().hashCode(); 728 | } 729 | 730 | 731 | 732 | } 733 | 734 | -------------------------------------------------------------------------------- /src/main/java/org/tartarus/snowball/ext/russianStemmer.java: -------------------------------------------------------------------------------- 1 | // This file was generated automatically by the Snowball to Java compiler 2 | 3 | package org.tartarus.snowball.ext; 4 | 5 | import org.tartarus.snowball.Among; 6 | 7 | /** 8 | * This class was automatically generated by a Snowball to Java compiler 9 | * It implements the stemming algorithm defined by a snowball script. 10 | */ 11 | 12 | public class russianStemmer extends org.tartarus.snowball.SnowballStemmer { 13 | 14 | private static final long serialVersionUID = 1L; 15 | 16 | private final static russianStemmer methodObject = new russianStemmer (); 17 | 18 | private final static Among a_0[] = { 19 | new Among ( "\u0432", -1, 1, "", methodObject ), 20 | new Among ( "\u0438\u0432", 0, 2, "", methodObject ), 21 | new Among ( "\u044B\u0432", 0, 2, "", methodObject ), 22 | new Among ( "\u0432\u0448\u0438", -1, 1, "", methodObject ), 23 | new Among ( "\u0438\u0432\u0448\u0438", 3, 2, "", methodObject ), 24 | new Among ( "\u044B\u0432\u0448\u0438", 3, 2, "", methodObject ), 25 | new Among ( "\u0432\u0448\u0438\u0441\u044C", -1, 1, "", methodObject ), 26 | new Among ( "\u0438\u0432\u0448\u0438\u0441\u044C", 6, 2, "", methodObject ), 27 | new Among ( "\u044B\u0432\u0448\u0438\u0441\u044C", 6, 2, "", methodObject ) 28 | }; 29 | 30 | private final static Among a_1[] = { 31 | new Among ( "\u0435\u0435", -1, 1, "", methodObject ), 32 | new Among ( "\u0438\u0435", -1, 1, "", methodObject ), 33 | new Among ( "\u043E\u0435", -1, 1, "", methodObject ), 34 | new Among ( "\u044B\u0435", -1, 1, "", methodObject ), 35 | new Among ( "\u0438\u043C\u0438", -1, 1, "", methodObject ), 36 | new Among ( "\u044B\u043C\u0438", -1, 1, "", methodObject ), 37 | new Among ( "\u0435\u0439", -1, 1, "", methodObject ), 38 | new Among ( "\u0438\u0439", -1, 1, "", methodObject ), 39 | new Among ( "\u043E\u0439", -1, 1, "", methodObject ), 40 | new Among ( "\u044B\u0439", -1, 1, "", methodObject ), 41 | new Among ( "\u0435\u043C", -1, 1, "", methodObject ), 42 | new Among ( "\u0438\u043C", -1, 1, "", methodObject ), 43 | new Among ( "\u043E\u043C", -1, 1, "", methodObject ), 44 | new Among ( "\u044B\u043C", -1, 1, "", methodObject ), 45 | new Among ( "\u0435\u0433\u043E", -1, 1, "", methodObject ), 46 | new Among ( "\u043E\u0433\u043E", -1, 1, "", methodObject ), 47 | new Among ( "\u0435\u043C\u0443", -1, 1, "", methodObject ), 48 | new Among ( "\u043E\u043C\u0443", -1, 1, "", methodObject ), 49 | new Among ( "\u0438\u0445", -1, 1, "", methodObject ), 50 | new Among ( "\u044B\u0445", -1, 1, "", methodObject ), 51 | new Among ( "\u0435\u044E", -1, 1, "", methodObject ), 52 | new Among ( "\u043E\u044E", -1, 1, "", methodObject ), 53 | new Among ( "\u0443\u044E", -1, 1, "", methodObject ), 54 | new Among ( "\u044E\u044E", -1, 1, "", methodObject ), 55 | new Among ( "\u0430\u044F", -1, 1, "", methodObject ), 56 | new Among ( "\u044F\u044F", -1, 1, "", methodObject ) 57 | }; 58 | 59 | private final static Among a_2[] = { 60 | new Among ( "\u0435\u043C", -1, 1, "", methodObject ), 61 | new Among ( "\u043D\u043D", -1, 1, "", methodObject ), 62 | new Among ( "\u0432\u0448", -1, 1, "", methodObject ), 63 | new Among ( "\u0438\u0432\u0448", 2, 2, "", methodObject ), 64 | new Among ( "\u044B\u0432\u0448", 2, 2, "", methodObject ), 65 | new Among ( "\u0449", -1, 1, "", methodObject ), 66 | new Among ( "\u044E\u0449", 5, 1, "", methodObject ), 67 | new Among ( "\u0443\u044E\u0449", 6, 2, "", methodObject ) 68 | }; 69 | 70 | private final static Among a_3[] = { 71 | new Among ( "\u0441\u044C", -1, 1, "", methodObject ), 72 | new Among ( "\u0441\u044F", -1, 1, "", methodObject ) 73 | }; 74 | 75 | private final static Among a_4[] = { 76 | new Among ( "\u043B\u0430", -1, 1, "", methodObject ), 77 | new Among ( "\u0438\u043B\u0430", 0, 2, "", methodObject ), 78 | new Among ( "\u044B\u043B\u0430", 0, 2, "", methodObject ), 79 | new Among ( "\u043D\u0430", -1, 1, "", methodObject ), 80 | new Among ( "\u0435\u043D\u0430", 3, 2, "", methodObject ), 81 | new Among ( "\u0435\u0442\u0435", -1, 1, "", methodObject ), 82 | new Among ( "\u0438\u0442\u0435", -1, 2, "", methodObject ), 83 | new Among ( "\u0439\u0442\u0435", -1, 1, "", methodObject ), 84 | new Among ( "\u0435\u0439\u0442\u0435", 7, 2, "", methodObject ), 85 | new Among ( "\u0443\u0439\u0442\u0435", 7, 2, "", methodObject ), 86 | new Among ( "\u043B\u0438", -1, 1, "", methodObject ), 87 | new Among ( "\u0438\u043B\u0438", 10, 2, "", methodObject ), 88 | new Among ( "\u044B\u043B\u0438", 10, 2, "", methodObject ), 89 | new Among ( "\u0439", -1, 1, "", methodObject ), 90 | new Among ( "\u0435\u0439", 13, 2, "", methodObject ), 91 | new Among ( "\u0443\u0439", 13, 2, "", methodObject ), 92 | new Among ( "\u043B", -1, 1, "", methodObject ), 93 | new Among ( "\u0438\u043B", 16, 2, "", methodObject ), 94 | new Among ( "\u044B\u043B", 16, 2, "", methodObject ), 95 | new Among ( "\u0435\u043C", -1, 1, "", methodObject ), 96 | new Among ( "\u0438\u043C", -1, 2, "", methodObject ), 97 | new Among ( "\u044B\u043C", -1, 2, "", methodObject ), 98 | new Among ( "\u043D", -1, 1, "", methodObject ), 99 | new Among ( "\u0435\u043D", 22, 2, "", methodObject ), 100 | new Among ( "\u043B\u043E", -1, 1, "", methodObject ), 101 | new Among ( "\u0438\u043B\u043E", 24, 2, "", methodObject ), 102 | new Among ( "\u044B\u043B\u043E", 24, 2, "", methodObject ), 103 | new Among ( "\u043D\u043E", -1, 1, "", methodObject ), 104 | new Among ( "\u0435\u043D\u043E", 27, 2, "", methodObject ), 105 | new Among ( "\u043D\u043D\u043E", 27, 1, "", methodObject ), 106 | new Among ( "\u0435\u0442", -1, 1, "", methodObject ), 107 | new Among ( "\u0443\u0435\u0442", 30, 2, "", methodObject ), 108 | new Among ( "\u0438\u0442", -1, 2, "", methodObject ), 109 | new Among ( "\u044B\u0442", -1, 2, "", methodObject ), 110 | new Among ( "\u044E\u0442", -1, 1, "", methodObject ), 111 | new Among ( "\u0443\u044E\u0442", 34, 2, "", methodObject ), 112 | new Among ( "\u044F\u0442", -1, 2, "", methodObject ), 113 | new Among ( "\u043D\u044B", -1, 1, "", methodObject ), 114 | new Among ( "\u0435\u043D\u044B", 37, 2, "", methodObject ), 115 | new Among ( "\u0442\u044C", -1, 1, "", methodObject ), 116 | new Among ( "\u0438\u0442\u044C", 39, 2, "", methodObject ), 117 | new Among ( "\u044B\u0442\u044C", 39, 2, "", methodObject ), 118 | new Among ( "\u0435\u0448\u044C", -1, 1, "", methodObject ), 119 | new Among ( "\u0438\u0448\u044C", -1, 2, "", methodObject ), 120 | new Among ( "\u044E", -1, 2, "", methodObject ), 121 | new Among ( "\u0443\u044E", 44, 2, "", methodObject ) 122 | }; 123 | 124 | private final static Among a_5[] = { 125 | new Among ( "\u0430", -1, 1, "", methodObject ), 126 | new Among ( "\u0435\u0432", -1, 1, "", methodObject ), 127 | new Among ( "\u043E\u0432", -1, 1, "", methodObject ), 128 | new Among ( "\u0435", -1, 1, "", methodObject ), 129 | new Among ( "\u0438\u0435", 3, 1, "", methodObject ), 130 | new Among ( "\u044C\u0435", 3, 1, "", methodObject ), 131 | new Among ( "\u0438", -1, 1, "", methodObject ), 132 | new Among ( "\u0435\u0438", 6, 1, "", methodObject ), 133 | new Among ( "\u0438\u0438", 6, 1, "", methodObject ), 134 | new Among ( "\u0430\u043C\u0438", 6, 1, "", methodObject ), 135 | new Among ( "\u044F\u043C\u0438", 6, 1, "", methodObject ), 136 | new Among ( "\u0438\u044F\u043C\u0438", 10, 1, "", methodObject ), 137 | new Among ( "\u0439", -1, 1, "", methodObject ), 138 | new Among ( "\u0435\u0439", 12, 1, "", methodObject ), 139 | new Among ( "\u0438\u0435\u0439", 13, 1, "", methodObject ), 140 | new Among ( "\u0438\u0439", 12, 1, "", methodObject ), 141 | new Among ( "\u043E\u0439", 12, 1, "", methodObject ), 142 | new Among ( "\u0430\u043C", -1, 1, "", methodObject ), 143 | new Among ( "\u0435\u043C", -1, 1, "", methodObject ), 144 | new Among ( "\u0438\u0435\u043C", 18, 1, "", methodObject ), 145 | new Among ( "\u043E\u043C", -1, 1, "", methodObject ), 146 | new Among ( "\u044F\u043C", -1, 1, "", methodObject ), 147 | new Among ( "\u0438\u044F\u043C", 21, 1, "", methodObject ), 148 | new Among ( "\u043E", -1, 1, "", methodObject ), 149 | new Among ( "\u0443", -1, 1, "", methodObject ), 150 | new Among ( "\u0430\u0445", -1, 1, "", methodObject ), 151 | new Among ( "\u044F\u0445", -1, 1, "", methodObject ), 152 | new Among ( "\u0438\u044F\u0445", 26, 1, "", methodObject ), 153 | new Among ( "\u044B", -1, 1, "", methodObject ), 154 | new Among ( "\u044C", -1, 1, "", methodObject ), 155 | new Among ( "\u044E", -1, 1, "", methodObject ), 156 | new Among ( "\u0438\u044E", 30, 1, "", methodObject ), 157 | new Among ( "\u044C\u044E", 30, 1, "", methodObject ), 158 | new Among ( "\u044F", -1, 1, "", methodObject ), 159 | new Among ( "\u0438\u044F", 33, 1, "", methodObject ), 160 | new Among ( "\u044C\u044F", 33, 1, "", methodObject ) 161 | }; 162 | 163 | private final static Among a_6[] = { 164 | new Among ( "\u043E\u0441\u0442", -1, 1, "", methodObject ), 165 | new Among ( "\u043E\u0441\u0442\u044C", -1, 1, "", methodObject ) 166 | }; 167 | 168 | private final static Among a_7[] = { 169 | new Among ( "\u0435\u0439\u0448\u0435", -1, 1, "", methodObject ), 170 | new Among ( "\u043D", -1, 2, "", methodObject ), 171 | new Among ( "\u0435\u0439\u0448", -1, 1, "", methodObject ), 172 | new Among ( "\u044C", -1, 3, "", methodObject ) 173 | }; 174 | 175 | private static final char g_v[] = {33, 65, 8, 232 }; 176 | 177 | private int I_p2; 178 | private int I_pV; 179 | 180 | private void copy_from(russianStemmer other) { 181 | I_p2 = other.I_p2; 182 | I_pV = other.I_pV; 183 | super.copy_from(other); 184 | } 185 | 186 | private boolean r_mark_regions() { 187 | int v_1; 188 | // (, line 57 189 | I_pV = limit; 190 | I_p2 = limit; 191 | // do, line 61 192 | v_1 = cursor; 193 | lab0: do { 194 | // (, line 61 195 | // gopast, line 62 196 | golab1: while(true) 197 | { 198 | lab2: do { 199 | if (!(in_grouping(g_v, 1072, 1103))) 200 | { 201 | break lab2; 202 | } 203 | break golab1; 204 | } while (false); 205 | if (cursor >= limit) 206 | { 207 | break lab0; 208 | } 209 | cursor++; 210 | } 211 | // setmark pV, line 62 212 | I_pV = cursor; 213 | // gopast, line 62 214 | golab3: while(true) 215 | { 216 | lab4: do { 217 | if (!(out_grouping(g_v, 1072, 1103))) 218 | { 219 | break lab4; 220 | } 221 | break golab3; 222 | } while (false); 223 | if (cursor >= limit) 224 | { 225 | break lab0; 226 | } 227 | cursor++; 228 | } 229 | // gopast, line 63 230 | golab5: while(true) 231 | { 232 | lab6: do { 233 | if (!(in_grouping(g_v, 1072, 1103))) 234 | { 235 | break lab6; 236 | } 237 | break golab5; 238 | } while (false); 239 | if (cursor >= limit) 240 | { 241 | break lab0; 242 | } 243 | cursor++; 244 | } 245 | // gopast, line 63 246 | golab7: while(true) 247 | { 248 | lab8: do { 249 | if (!(out_grouping(g_v, 1072, 1103))) 250 | { 251 | break lab8; 252 | } 253 | break golab7; 254 | } while (false); 255 | if (cursor >= limit) 256 | { 257 | break lab0; 258 | } 259 | cursor++; 260 | } 261 | // setmark p2, line 63 262 | I_p2 = cursor; 263 | } while (false); 264 | cursor = v_1; 265 | return true; 266 | } 267 | 268 | private boolean r_R2() { 269 | if (!(I_p2 <= cursor)) 270 | { 271 | return false; 272 | } 273 | return true; 274 | } 275 | 276 | private boolean r_perfective_gerund() { 277 | int among_var; 278 | int v_1; 279 | // (, line 71 280 | // [, line 72 281 | ket = cursor; 282 | // substring, line 72 283 | among_var = find_among_b(a_0, 9); 284 | if (among_var == 0) 285 | { 286 | return false; 287 | } 288 | // ], line 72 289 | bra = cursor; 290 | switch(among_var) { 291 | case 0: 292 | return false; 293 | case 1: 294 | // (, line 76 295 | // or, line 76 296 | lab0: do { 297 | v_1 = limit - cursor; 298 | lab1: do { 299 | // literal, line 76 300 | if (!(eq_s_b(1, "\u0430"))) 301 | { 302 | break lab1; 303 | } 304 | break lab0; 305 | } while (false); 306 | cursor = limit - v_1; 307 | // literal, line 76 308 | if (!(eq_s_b(1, "\u044F"))) 309 | { 310 | return false; 311 | } 312 | } while (false); 313 | // delete, line 76 314 | slice_del(); 315 | break; 316 | case 2: 317 | // (, line 83 318 | // delete, line 83 319 | slice_del(); 320 | break; 321 | } 322 | return true; 323 | } 324 | 325 | private boolean r_adjective() { 326 | int among_var; 327 | // (, line 87 328 | // [, line 88 329 | ket = cursor; 330 | // substring, line 88 331 | among_var = find_among_b(a_1, 26); 332 | if (among_var == 0) 333 | { 334 | return false; 335 | } 336 | // ], line 88 337 | bra = cursor; 338 | switch(among_var) { 339 | case 0: 340 | return false; 341 | case 1: 342 | // (, line 97 343 | // delete, line 97 344 | slice_del(); 345 | break; 346 | } 347 | return true; 348 | } 349 | 350 | private boolean r_adjectival() { 351 | int among_var; 352 | int v_1; 353 | int v_2; 354 | // (, line 101 355 | // call adjective, line 102 356 | if (!r_adjective()) 357 | { 358 | return false; 359 | } 360 | // try, line 109 361 | v_1 = limit - cursor; 362 | lab0: do { 363 | // (, line 109 364 | // [, line 110 365 | ket = cursor; 366 | // substring, line 110 367 | among_var = find_among_b(a_2, 8); 368 | if (among_var == 0) 369 | { 370 | cursor = limit - v_1; 371 | break lab0; 372 | } 373 | // ], line 110 374 | bra = cursor; 375 | switch(among_var) { 376 | case 0: 377 | cursor = limit - v_1; 378 | break lab0; 379 | case 1: 380 | // (, line 115 381 | // or, line 115 382 | lab1: do { 383 | v_2 = limit - cursor; 384 | lab2: do { 385 | // literal, line 115 386 | if (!(eq_s_b(1, "\u0430"))) 387 | { 388 | break lab2; 389 | } 390 | break lab1; 391 | } while (false); 392 | cursor = limit - v_2; 393 | // literal, line 115 394 | if (!(eq_s_b(1, "\u044F"))) 395 | { 396 | cursor = limit - v_1; 397 | break lab0; 398 | } 399 | } while (false); 400 | // delete, line 115 401 | slice_del(); 402 | break; 403 | case 2: 404 | // (, line 122 405 | // delete, line 122 406 | slice_del(); 407 | break; 408 | } 409 | } while (false); 410 | return true; 411 | } 412 | 413 | private boolean r_reflexive() { 414 | int among_var; 415 | // (, line 128 416 | // [, line 129 417 | ket = cursor; 418 | // substring, line 129 419 | among_var = find_among_b(a_3, 2); 420 | if (among_var == 0) 421 | { 422 | return false; 423 | } 424 | // ], line 129 425 | bra = cursor; 426 | switch(among_var) { 427 | case 0: 428 | return false; 429 | case 1: 430 | // (, line 132 431 | // delete, line 132 432 | slice_del(); 433 | break; 434 | } 435 | return true; 436 | } 437 | 438 | private boolean r_verb() { 439 | int among_var; 440 | int v_1; 441 | // (, line 136 442 | // [, line 137 443 | ket = cursor; 444 | // substring, line 137 445 | among_var = find_among_b(a_4, 46); 446 | if (among_var == 0) 447 | { 448 | return false; 449 | } 450 | // ], line 137 451 | bra = cursor; 452 | switch(among_var) { 453 | case 0: 454 | return false; 455 | case 1: 456 | // (, line 143 457 | // or, line 143 458 | lab0: do { 459 | v_1 = limit - cursor; 460 | lab1: do { 461 | // literal, line 143 462 | if (!(eq_s_b(1, "\u0430"))) 463 | { 464 | break lab1; 465 | } 466 | break lab0; 467 | } while (false); 468 | cursor = limit - v_1; 469 | // literal, line 143 470 | if (!(eq_s_b(1, "\u044F"))) 471 | { 472 | return false; 473 | } 474 | } while (false); 475 | // delete, line 143 476 | slice_del(); 477 | break; 478 | case 2: 479 | // (, line 151 480 | // delete, line 151 481 | slice_del(); 482 | break; 483 | } 484 | return true; 485 | } 486 | 487 | private boolean r_noun() { 488 | int among_var; 489 | // (, line 159 490 | // [, line 160 491 | ket = cursor; 492 | // substring, line 160 493 | among_var = find_among_b(a_5, 36); 494 | if (among_var == 0) 495 | { 496 | return false; 497 | } 498 | // ], line 160 499 | bra = cursor; 500 | switch(among_var) { 501 | case 0: 502 | return false; 503 | case 1: 504 | // (, line 167 505 | // delete, line 167 506 | slice_del(); 507 | break; 508 | } 509 | return true; 510 | } 511 | 512 | private boolean r_derivational() { 513 | int among_var; 514 | // (, line 175 515 | // [, line 176 516 | ket = cursor; 517 | // substring, line 176 518 | among_var = find_among_b(a_6, 2); 519 | if (among_var == 0) 520 | { 521 | return false; 522 | } 523 | // ], line 176 524 | bra = cursor; 525 | // call R2, line 176 526 | if (!r_R2()) 527 | { 528 | return false; 529 | } 530 | switch(among_var) { 531 | case 0: 532 | return false; 533 | case 1: 534 | // (, line 179 535 | // delete, line 179 536 | slice_del(); 537 | break; 538 | } 539 | return true; 540 | } 541 | 542 | private boolean r_tidy_up() { 543 | int among_var; 544 | // (, line 183 545 | // [, line 184 546 | ket = cursor; 547 | // substring, line 184 548 | among_var = find_among_b(a_7, 4); 549 | if (among_var == 0) 550 | { 551 | return false; 552 | } 553 | // ], line 184 554 | bra = cursor; 555 | switch(among_var) { 556 | case 0: 557 | return false; 558 | case 1: 559 | // (, line 188 560 | // delete, line 188 561 | slice_del(); 562 | // [, line 189 563 | ket = cursor; 564 | // literal, line 189 565 | if (!(eq_s_b(1, "\u043D"))) 566 | { 567 | return false; 568 | } 569 | // ], line 189 570 | bra = cursor; 571 | // literal, line 189 572 | if (!(eq_s_b(1, "\u043D"))) 573 | { 574 | return false; 575 | } 576 | // delete, line 189 577 | slice_del(); 578 | break; 579 | case 2: 580 | // (, line 192 581 | // literal, line 192 582 | if (!(eq_s_b(1, "\u043D"))) 583 | { 584 | return false; 585 | } 586 | // delete, line 192 587 | slice_del(); 588 | break; 589 | case 3: 590 | // (, line 194 591 | // delete, line 194 592 | slice_del(); 593 | break; 594 | } 595 | return true; 596 | } 597 | 598 | public boolean stem() { 599 | int v_1; 600 | int v_2; 601 | int v_3; 602 | int v_4; 603 | int v_5; 604 | int v_6; 605 | int v_7; 606 | int v_8; 607 | int v_9; 608 | int v_10; 609 | // (, line 199 610 | // do, line 201 611 | v_1 = cursor; 612 | lab0: do { 613 | // call mark_regions, line 201 614 | if (!r_mark_regions()) 615 | { 616 | break lab0; 617 | } 618 | } while (false); 619 | cursor = v_1; 620 | // backwards, line 202 621 | limit_backward = cursor; cursor = limit; 622 | // setlimit, line 202 623 | v_2 = limit - cursor; 624 | // tomark, line 202 625 | if (cursor < I_pV) 626 | { 627 | return false; 628 | } 629 | cursor = I_pV; 630 | v_3 = limit_backward; 631 | limit_backward = cursor; 632 | cursor = limit - v_2; 633 | // (, line 202 634 | // do, line 203 635 | v_4 = limit - cursor; 636 | lab1: do { 637 | // (, line 203 638 | // or, line 204 639 | lab2: do { 640 | v_5 = limit - cursor; 641 | lab3: do { 642 | // call perfective_gerund, line 204 643 | if (!r_perfective_gerund()) 644 | { 645 | break lab3; 646 | } 647 | break lab2; 648 | } while (false); 649 | cursor = limit - v_5; 650 | // (, line 205 651 | // try, line 205 652 | v_6 = limit - cursor; 653 | lab4: do { 654 | // call reflexive, line 205 655 | if (!r_reflexive()) 656 | { 657 | cursor = limit - v_6; 658 | break lab4; 659 | } 660 | } while (false); 661 | // or, line 206 662 | lab5: do { 663 | v_7 = limit - cursor; 664 | lab6: do { 665 | // call adjectival, line 206 666 | if (!r_adjectival()) 667 | { 668 | break lab6; 669 | } 670 | break lab5; 671 | } while (false); 672 | cursor = limit - v_7; 673 | lab7: do { 674 | // call verb, line 206 675 | if (!r_verb()) 676 | { 677 | break lab7; 678 | } 679 | break lab5; 680 | } while (false); 681 | cursor = limit - v_7; 682 | // call noun, line 206 683 | if (!r_noun()) 684 | { 685 | break lab1; 686 | } 687 | } while (false); 688 | } while (false); 689 | } while (false); 690 | cursor = limit - v_4; 691 | // try, line 209 692 | v_8 = limit - cursor; 693 | lab8: do { 694 | // (, line 209 695 | // [, line 209 696 | ket = cursor; 697 | // literal, line 209 698 | if (!(eq_s_b(1, "\u0438"))) 699 | { 700 | cursor = limit - v_8; 701 | break lab8; 702 | } 703 | // ], line 209 704 | bra = cursor; 705 | // delete, line 209 706 | slice_del(); 707 | } while (false); 708 | // do, line 212 709 | v_9 = limit - cursor; 710 | lab9: do { 711 | // call derivational, line 212 712 | if (!r_derivational()) 713 | { 714 | break lab9; 715 | } 716 | } while (false); 717 | cursor = limit - v_9; 718 | // do, line 213 719 | v_10 = limit - cursor; 720 | lab10: do { 721 | // call tidy_up, line 213 722 | if (!r_tidy_up()) 723 | { 724 | break lab10; 725 | } 726 | } while (false); 727 | cursor = limit - v_10; 728 | limit_backward = v_3; 729 | cursor = limit_backward; return true; 730 | } 731 | 732 | public boolean equals( Object o ) { 733 | return o instanceof russianStemmer; 734 | } 735 | 736 | public int hashCode() { 737 | return russianStemmer.class.getName().hashCode(); 738 | } 739 | 740 | 741 | 742 | } 743 | 744 | -------------------------------------------------------------------------------- /src/main/java/org/tartarus/snowball/ext/dutchStemmer.java: -------------------------------------------------------------------------------- 1 | // This file was generated automatically by the Snowball to Java compiler 2 | 3 | package org.tartarus.snowball.ext; 4 | 5 | import org.tartarus.snowball.Among; 6 | 7 | /** 8 | * This class was automatically generated by a Snowball to Java compiler 9 | * It implements the stemming algorithm defined by a snowball script. 10 | */ 11 | 12 | public class dutchStemmer extends org.tartarus.snowball.SnowballStemmer { 13 | 14 | private static final long serialVersionUID = 1L; 15 | 16 | private final static dutchStemmer methodObject = new dutchStemmer (); 17 | 18 | private final static Among a_0[] = { 19 | new Among ( "", -1, 6, "", methodObject ), 20 | new Among ( "\u00E1", 0, 1, "", methodObject ), 21 | new Among ( "\u00E4", 0, 1, "", methodObject ), 22 | new Among ( "\u00E9", 0, 2, "", methodObject ), 23 | new Among ( "\u00EB", 0, 2, "", methodObject ), 24 | new Among ( "\u00ED", 0, 3, "", methodObject ), 25 | new Among ( "\u00EF", 0, 3, "", methodObject ), 26 | new Among ( "\u00F3", 0, 4, "", methodObject ), 27 | new Among ( "\u00F6", 0, 4, "", methodObject ), 28 | new Among ( "\u00FA", 0, 5, "", methodObject ), 29 | new Among ( "\u00FC", 0, 5, "", methodObject ) 30 | }; 31 | 32 | private final static Among a_1[] = { 33 | new Among ( "", -1, 3, "", methodObject ), 34 | new Among ( "I", 0, 2, "", methodObject ), 35 | new Among ( "Y", 0, 1, "", methodObject ) 36 | }; 37 | 38 | private final static Among a_2[] = { 39 | new Among ( "dd", -1, -1, "", methodObject ), 40 | new Among ( "kk", -1, -1, "", methodObject ), 41 | new Among ( "tt", -1, -1, "", methodObject ) 42 | }; 43 | 44 | private final static Among a_3[] = { 45 | new Among ( "ene", -1, 2, "", methodObject ), 46 | new Among ( "se", -1, 3, "", methodObject ), 47 | new Among ( "en", -1, 2, "", methodObject ), 48 | new Among ( "heden", 2, 1, "", methodObject ), 49 | new Among ( "s", -1, 3, "", methodObject ) 50 | }; 51 | 52 | private final static Among a_4[] = { 53 | new Among ( "end", -1, 1, "", methodObject ), 54 | new Among ( "ig", -1, 2, "", methodObject ), 55 | new Among ( "ing", -1, 1, "", methodObject ), 56 | new Among ( "lijk", -1, 3, "", methodObject ), 57 | new Among ( "baar", -1, 4, "", methodObject ), 58 | new Among ( "bar", -1, 5, "", methodObject ) 59 | }; 60 | 61 | private final static Among a_5[] = { 62 | new Among ( "aa", -1, -1, "", methodObject ), 63 | new Among ( "ee", -1, -1, "", methodObject ), 64 | new Among ( "oo", -1, -1, "", methodObject ), 65 | new Among ( "uu", -1, -1, "", methodObject ) 66 | }; 67 | 68 | private static final char g_v[] = {17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128 }; 69 | 70 | private static final char g_v_I[] = {1, 0, 0, 17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128 }; 71 | 72 | private static final char g_v_j[] = {17, 67, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128 }; 73 | 74 | private int I_p2; 75 | private int I_p1; 76 | private boolean B_e_found; 77 | 78 | private void copy_from(dutchStemmer other) { 79 | I_p2 = other.I_p2; 80 | I_p1 = other.I_p1; 81 | B_e_found = other.B_e_found; 82 | super.copy_from(other); 83 | } 84 | 85 | private boolean r_prelude() { 86 | int among_var; 87 | int v_1; 88 | int v_2; 89 | int v_3; 90 | int v_4; 91 | int v_5; 92 | int v_6; 93 | // (, line 41 94 | // test, line 42 95 | v_1 = cursor; 96 | // repeat, line 42 97 | replab0: while(true) 98 | { 99 | v_2 = cursor; 100 | lab1: do { 101 | // (, line 42 102 | // [, line 43 103 | bra = cursor; 104 | // substring, line 43 105 | among_var = find_among(a_0, 11); 106 | if (among_var == 0) 107 | { 108 | break lab1; 109 | } 110 | // ], line 43 111 | ket = cursor; 112 | switch(among_var) { 113 | case 0: 114 | break lab1; 115 | case 1: 116 | // (, line 45 117 | // <-, line 45 118 | slice_from("a"); 119 | break; 120 | case 2: 121 | // (, line 47 122 | // <-, line 47 123 | slice_from("e"); 124 | break; 125 | case 3: 126 | // (, line 49 127 | // <-, line 49 128 | slice_from("i"); 129 | break; 130 | case 4: 131 | // (, line 51 132 | // <-, line 51 133 | slice_from("o"); 134 | break; 135 | case 5: 136 | // (, line 53 137 | // <-, line 53 138 | slice_from("u"); 139 | break; 140 | case 6: 141 | // (, line 54 142 | // next, line 54 143 | if (cursor >= limit) 144 | { 145 | break lab1; 146 | } 147 | cursor++; 148 | break; 149 | } 150 | continue replab0; 151 | } while (false); 152 | cursor = v_2; 153 | break replab0; 154 | } 155 | cursor = v_1; 156 | // try, line 57 157 | v_3 = cursor; 158 | lab2: do { 159 | // (, line 57 160 | // [, line 57 161 | bra = cursor; 162 | // literal, line 57 163 | if (!(eq_s(1, "y"))) 164 | { 165 | cursor = v_3; 166 | break lab2; 167 | } 168 | // ], line 57 169 | ket = cursor; 170 | // <-, line 57 171 | slice_from("Y"); 172 | } while (false); 173 | // repeat, line 58 174 | replab3: while(true) 175 | { 176 | v_4 = cursor; 177 | lab4: do { 178 | // goto, line 58 179 | golab5: while(true) 180 | { 181 | v_5 = cursor; 182 | lab6: do { 183 | // (, line 58 184 | if (!(in_grouping(g_v, 97, 232))) 185 | { 186 | break lab6; 187 | } 188 | // [, line 59 189 | bra = cursor; 190 | // or, line 59 191 | lab7: do { 192 | v_6 = cursor; 193 | lab8: do { 194 | // (, line 59 195 | // literal, line 59 196 | if (!(eq_s(1, "i"))) 197 | { 198 | break lab8; 199 | } 200 | // ], line 59 201 | ket = cursor; 202 | if (!(in_grouping(g_v, 97, 232))) 203 | { 204 | break lab8; 205 | } 206 | // <-, line 59 207 | slice_from("I"); 208 | break lab7; 209 | } while (false); 210 | cursor = v_6; 211 | // (, line 60 212 | // literal, line 60 213 | if (!(eq_s(1, "y"))) 214 | { 215 | break lab6; 216 | } 217 | // ], line 60 218 | ket = cursor; 219 | // <-, line 60 220 | slice_from("Y"); 221 | } while (false); 222 | cursor = v_5; 223 | break golab5; 224 | } while (false); 225 | cursor = v_5; 226 | if (cursor >= limit) 227 | { 228 | break lab4; 229 | } 230 | cursor++; 231 | } 232 | continue replab3; 233 | } while (false); 234 | cursor = v_4; 235 | break replab3; 236 | } 237 | return true; 238 | } 239 | 240 | private boolean r_mark_regions() { 241 | // (, line 64 242 | I_p1 = limit; 243 | I_p2 = limit; 244 | // gopast, line 69 245 | golab0: while(true) 246 | { 247 | lab1: do { 248 | if (!(in_grouping(g_v, 97, 232))) 249 | { 250 | break lab1; 251 | } 252 | break golab0; 253 | } while (false); 254 | if (cursor >= limit) 255 | { 256 | return false; 257 | } 258 | cursor++; 259 | } 260 | // gopast, line 69 261 | golab2: while(true) 262 | { 263 | lab3: do { 264 | if (!(out_grouping(g_v, 97, 232))) 265 | { 266 | break lab3; 267 | } 268 | break golab2; 269 | } while (false); 270 | if (cursor >= limit) 271 | { 272 | return false; 273 | } 274 | cursor++; 275 | } 276 | // setmark p1, line 69 277 | I_p1 = cursor; 278 | // try, line 70 279 | lab4: do { 280 | // (, line 70 281 | if (!(I_p1 < 3)) 282 | { 283 | break lab4; 284 | } 285 | I_p1 = 3; 286 | } while (false); 287 | // gopast, line 71 288 | golab5: while(true) 289 | { 290 | lab6: do { 291 | if (!(in_grouping(g_v, 97, 232))) 292 | { 293 | break lab6; 294 | } 295 | break golab5; 296 | } while (false); 297 | if (cursor >= limit) 298 | { 299 | return false; 300 | } 301 | cursor++; 302 | } 303 | // gopast, line 71 304 | golab7: while(true) 305 | { 306 | lab8: do { 307 | if (!(out_grouping(g_v, 97, 232))) 308 | { 309 | break lab8; 310 | } 311 | break golab7; 312 | } while (false); 313 | if (cursor >= limit) 314 | { 315 | return false; 316 | } 317 | cursor++; 318 | } 319 | // setmark p2, line 71 320 | I_p2 = cursor; 321 | return true; 322 | } 323 | 324 | private boolean r_postlude() { 325 | int among_var; 326 | int v_1; 327 | // repeat, line 75 328 | replab0: while(true) 329 | { 330 | v_1 = cursor; 331 | lab1: do { 332 | // (, line 75 333 | // [, line 77 334 | bra = cursor; 335 | // substring, line 77 336 | among_var = find_among(a_1, 3); 337 | if (among_var == 0) 338 | { 339 | break lab1; 340 | } 341 | // ], line 77 342 | ket = cursor; 343 | switch(among_var) { 344 | case 0: 345 | break lab1; 346 | case 1: 347 | // (, line 78 348 | // <-, line 78 349 | slice_from("y"); 350 | break; 351 | case 2: 352 | // (, line 79 353 | // <-, line 79 354 | slice_from("i"); 355 | break; 356 | case 3: 357 | // (, line 80 358 | // next, line 80 359 | if (cursor >= limit) 360 | { 361 | break lab1; 362 | } 363 | cursor++; 364 | break; 365 | } 366 | continue replab0; 367 | } while (false); 368 | cursor = v_1; 369 | break replab0; 370 | } 371 | return true; 372 | } 373 | 374 | private boolean r_R1() { 375 | if (!(I_p1 <= cursor)) 376 | { 377 | return false; 378 | } 379 | return true; 380 | } 381 | 382 | private boolean r_R2() { 383 | if (!(I_p2 <= cursor)) 384 | { 385 | return false; 386 | } 387 | return true; 388 | } 389 | 390 | private boolean r_undouble() { 391 | int v_1; 392 | // (, line 90 393 | // test, line 91 394 | v_1 = limit - cursor; 395 | // among, line 91 396 | if (find_among_b(a_2, 3) == 0) 397 | { 398 | return false; 399 | } 400 | cursor = limit - v_1; 401 | // [, line 91 402 | ket = cursor; 403 | // next, line 91 404 | if (cursor <= limit_backward) 405 | { 406 | return false; 407 | } 408 | cursor--; 409 | // ], line 91 410 | bra = cursor; 411 | // delete, line 91 412 | slice_del(); 413 | return true; 414 | } 415 | 416 | private boolean r_e_ending() { 417 | int v_1; 418 | // (, line 94 419 | // unset e_found, line 95 420 | B_e_found = false; 421 | // [, line 96 422 | ket = cursor; 423 | // literal, line 96 424 | if (!(eq_s_b(1, "e"))) 425 | { 426 | return false; 427 | } 428 | // ], line 96 429 | bra = cursor; 430 | // call R1, line 96 431 | if (!r_R1()) 432 | { 433 | return false; 434 | } 435 | // test, line 96 436 | v_1 = limit - cursor; 437 | if (!(out_grouping_b(g_v, 97, 232))) 438 | { 439 | return false; 440 | } 441 | cursor = limit - v_1; 442 | // delete, line 96 443 | slice_del(); 444 | // set e_found, line 97 445 | B_e_found = true; 446 | // call undouble, line 98 447 | if (!r_undouble()) 448 | { 449 | return false; 450 | } 451 | return true; 452 | } 453 | 454 | private boolean r_en_ending() { 455 | int v_1; 456 | int v_2; 457 | // (, line 101 458 | // call R1, line 102 459 | if (!r_R1()) 460 | { 461 | return false; 462 | } 463 | // and, line 102 464 | v_1 = limit - cursor; 465 | if (!(out_grouping_b(g_v, 97, 232))) 466 | { 467 | return false; 468 | } 469 | cursor = limit - v_1; 470 | // not, line 102 471 | { 472 | v_2 = limit - cursor; 473 | lab0: do { 474 | // literal, line 102 475 | if (!(eq_s_b(3, "gem"))) 476 | { 477 | break lab0; 478 | } 479 | return false; 480 | } while (false); 481 | cursor = limit - v_2; 482 | } 483 | // delete, line 102 484 | slice_del(); 485 | // call undouble, line 103 486 | if (!r_undouble()) 487 | { 488 | return false; 489 | } 490 | return true; 491 | } 492 | 493 | private boolean r_standard_suffix() { 494 | int among_var; 495 | int v_1; 496 | int v_2; 497 | int v_3; 498 | int v_4; 499 | int v_5; 500 | int v_6; 501 | int v_7; 502 | int v_8; 503 | int v_9; 504 | int v_10; 505 | // (, line 106 506 | // do, line 107 507 | v_1 = limit - cursor; 508 | lab0: do { 509 | // (, line 107 510 | // [, line 108 511 | ket = cursor; 512 | // substring, line 108 513 | among_var = find_among_b(a_3, 5); 514 | if (among_var == 0) 515 | { 516 | break lab0; 517 | } 518 | // ], line 108 519 | bra = cursor; 520 | switch(among_var) { 521 | case 0: 522 | break lab0; 523 | case 1: 524 | // (, line 110 525 | // call R1, line 110 526 | if (!r_R1()) 527 | { 528 | break lab0; 529 | } 530 | // <-, line 110 531 | slice_from("heid"); 532 | break; 533 | case 2: 534 | // (, line 113 535 | // call en_ending, line 113 536 | if (!r_en_ending()) 537 | { 538 | break lab0; 539 | } 540 | break; 541 | case 3: 542 | // (, line 116 543 | // call R1, line 116 544 | if (!r_R1()) 545 | { 546 | break lab0; 547 | } 548 | if (!(out_grouping_b(g_v_j, 97, 232))) 549 | { 550 | break lab0; 551 | } 552 | // delete, line 116 553 | slice_del(); 554 | break; 555 | } 556 | } while (false); 557 | cursor = limit - v_1; 558 | // do, line 120 559 | v_2 = limit - cursor; 560 | lab1: do { 561 | // call e_ending, line 120 562 | if (!r_e_ending()) 563 | { 564 | break lab1; 565 | } 566 | } while (false); 567 | cursor = limit - v_2; 568 | // do, line 122 569 | v_3 = limit - cursor; 570 | lab2: do { 571 | // (, line 122 572 | // [, line 122 573 | ket = cursor; 574 | // literal, line 122 575 | if (!(eq_s_b(4, "heid"))) 576 | { 577 | break lab2; 578 | } 579 | // ], line 122 580 | bra = cursor; 581 | // call R2, line 122 582 | if (!r_R2()) 583 | { 584 | break lab2; 585 | } 586 | // not, line 122 587 | { 588 | v_4 = limit - cursor; 589 | lab3: do { 590 | // literal, line 122 591 | if (!(eq_s_b(1, "c"))) 592 | { 593 | break lab3; 594 | } 595 | break lab2; 596 | } while (false); 597 | cursor = limit - v_4; 598 | } 599 | // delete, line 122 600 | slice_del(); 601 | // [, line 123 602 | ket = cursor; 603 | // literal, line 123 604 | if (!(eq_s_b(2, "en"))) 605 | { 606 | break lab2; 607 | } 608 | // ], line 123 609 | bra = cursor; 610 | // call en_ending, line 123 611 | if (!r_en_ending()) 612 | { 613 | break lab2; 614 | } 615 | } while (false); 616 | cursor = limit - v_3; 617 | // do, line 126 618 | v_5 = limit - cursor; 619 | lab4: do { 620 | // (, line 126 621 | // [, line 127 622 | ket = cursor; 623 | // substring, line 127 624 | among_var = find_among_b(a_4, 6); 625 | if (among_var == 0) 626 | { 627 | break lab4; 628 | } 629 | // ], line 127 630 | bra = cursor; 631 | switch(among_var) { 632 | case 0: 633 | break lab4; 634 | case 1: 635 | // (, line 129 636 | // call R2, line 129 637 | if (!r_R2()) 638 | { 639 | break lab4; 640 | } 641 | // delete, line 129 642 | slice_del(); 643 | // or, line 130 644 | lab5: do { 645 | v_6 = limit - cursor; 646 | lab6: do { 647 | // (, line 130 648 | // [, line 130 649 | ket = cursor; 650 | // literal, line 130 651 | if (!(eq_s_b(2, "ig"))) 652 | { 653 | break lab6; 654 | } 655 | // ], line 130 656 | bra = cursor; 657 | // call R2, line 130 658 | if (!r_R2()) 659 | { 660 | break lab6; 661 | } 662 | // not, line 130 663 | { 664 | v_7 = limit - cursor; 665 | lab7: do { 666 | // literal, line 130 667 | if (!(eq_s_b(1, "e"))) 668 | { 669 | break lab7; 670 | } 671 | break lab6; 672 | } while (false); 673 | cursor = limit - v_7; 674 | } 675 | // delete, line 130 676 | slice_del(); 677 | break lab5; 678 | } while (false); 679 | cursor = limit - v_6; 680 | // call undouble, line 130 681 | if (!r_undouble()) 682 | { 683 | break lab4; 684 | } 685 | } while (false); 686 | break; 687 | case 2: 688 | // (, line 133 689 | // call R2, line 133 690 | if (!r_R2()) 691 | { 692 | break lab4; 693 | } 694 | // not, line 133 695 | { 696 | v_8 = limit - cursor; 697 | lab8: do { 698 | // literal, line 133 699 | if (!(eq_s_b(1, "e"))) 700 | { 701 | break lab8; 702 | } 703 | break lab4; 704 | } while (false); 705 | cursor = limit - v_8; 706 | } 707 | // delete, line 133 708 | slice_del(); 709 | break; 710 | case 3: 711 | // (, line 136 712 | // call R2, line 136 713 | if (!r_R2()) 714 | { 715 | break lab4; 716 | } 717 | // delete, line 136 718 | slice_del(); 719 | // call e_ending, line 136 720 | if (!r_e_ending()) 721 | { 722 | break lab4; 723 | } 724 | break; 725 | case 4: 726 | // (, line 139 727 | // call R2, line 139 728 | if (!r_R2()) 729 | { 730 | break lab4; 731 | } 732 | // delete, line 139 733 | slice_del(); 734 | break; 735 | case 5: 736 | // (, line 142 737 | // call R2, line 142 738 | if (!r_R2()) 739 | { 740 | break lab4; 741 | } 742 | // Boolean test e_found, line 142 743 | if (!(B_e_found)) 744 | { 745 | break lab4; 746 | } 747 | // delete, line 142 748 | slice_del(); 749 | break; 750 | } 751 | } while (false); 752 | cursor = limit - v_5; 753 | // do, line 146 754 | v_9 = limit - cursor; 755 | lab9: do { 756 | // (, line 146 757 | if (!(out_grouping_b(g_v_I, 73, 232))) 758 | { 759 | break lab9; 760 | } 761 | // test, line 148 762 | v_10 = limit - cursor; 763 | // (, line 148 764 | // among, line 149 765 | if (find_among_b(a_5, 4) == 0) 766 | { 767 | break lab9; 768 | } 769 | if (!(out_grouping_b(g_v, 97, 232))) 770 | { 771 | break lab9; 772 | } 773 | cursor = limit - v_10; 774 | // [, line 152 775 | ket = cursor; 776 | // next, line 152 777 | if (cursor <= limit_backward) 778 | { 779 | break lab9; 780 | } 781 | cursor--; 782 | // ], line 152 783 | bra = cursor; 784 | // delete, line 152 785 | slice_del(); 786 | } while (false); 787 | cursor = limit - v_9; 788 | return true; 789 | } 790 | 791 | public boolean stem() { 792 | int v_1; 793 | int v_2; 794 | int v_3; 795 | int v_4; 796 | // (, line 157 797 | // do, line 159 798 | v_1 = cursor; 799 | lab0: do { 800 | // call prelude, line 159 801 | if (!r_prelude()) 802 | { 803 | break lab0; 804 | } 805 | } while (false); 806 | cursor = v_1; 807 | // do, line 160 808 | v_2 = cursor; 809 | lab1: do { 810 | // call mark_regions, line 160 811 | if (!r_mark_regions()) 812 | { 813 | break lab1; 814 | } 815 | } while (false); 816 | cursor = v_2; 817 | // backwards, line 161 818 | limit_backward = cursor; cursor = limit; 819 | // do, line 162 820 | v_3 = limit - cursor; 821 | lab2: do { 822 | // call standard_suffix, line 162 823 | if (!r_standard_suffix()) 824 | { 825 | break lab2; 826 | } 827 | } while (false); 828 | cursor = limit - v_3; 829 | cursor = limit_backward; // do, line 163 830 | v_4 = cursor; 831 | lab3: do { 832 | // call postlude, line 163 833 | if (!r_postlude()) 834 | { 835 | break lab3; 836 | } 837 | } while (false); 838 | cursor = v_4; 839 | return true; 840 | } 841 | 842 | public boolean equals( Object o ) { 843 | return o instanceof dutchStemmer; 844 | } 845 | 846 | public int hashCode() { 847 | return dutchStemmer.class.getName().hashCode(); 848 | } 849 | 850 | 851 | 852 | } 853 | 854 | -------------------------------------------------------------------------------- /src/main/java/org/tartarus/snowball/ext/porterStemmer.java: -------------------------------------------------------------------------------- 1 | // This file was generated automatically by the Snowball to Java compiler 2 | 3 | package org.tartarus.snowball.ext; 4 | 5 | import org.tartarus.snowball.Among; 6 | 7 | /** 8 | * This class was automatically generated by a Snowball to Java compiler 9 | * It implements the stemming algorithm defined by a snowball script. 10 | */ 11 | 12 | public class porterStemmer extends org.tartarus.snowball.SnowballStemmer { 13 | 14 | private static final long serialVersionUID = 1L; 15 | 16 | private final static porterStemmer methodObject = new porterStemmer (); 17 | 18 | private final static Among a_0[] = { 19 | new Among ( "s", -1, 3, "", methodObject ), 20 | new Among ( "ies", 0, 2, "", methodObject ), 21 | new Among ( "sses", 0, 1, "", methodObject ), 22 | new Among ( "ss", 0, -1, "", methodObject ) 23 | }; 24 | 25 | private final static Among a_1[] = { 26 | new Among ( "", -1, 3, "", methodObject ), 27 | new Among ( "bb", 0, 2, "", methodObject ), 28 | new Among ( "dd", 0, 2, "", methodObject ), 29 | new Among ( "ff", 0, 2, "", methodObject ), 30 | new Among ( "gg", 0, 2, "", methodObject ), 31 | new Among ( "bl", 0, 1, "", methodObject ), 32 | new Among ( "mm", 0, 2, "", methodObject ), 33 | new Among ( "nn", 0, 2, "", methodObject ), 34 | new Among ( "pp", 0, 2, "", methodObject ), 35 | new Among ( "rr", 0, 2, "", methodObject ), 36 | new Among ( "at", 0, 1, "", methodObject ), 37 | new Among ( "tt", 0, 2, "", methodObject ), 38 | new Among ( "iz", 0, 1, "", methodObject ) 39 | }; 40 | 41 | private final static Among a_2[] = { 42 | new Among ( "ed", -1, 2, "", methodObject ), 43 | new Among ( "eed", 0, 1, "", methodObject ), 44 | new Among ( "ing", -1, 2, "", methodObject ) 45 | }; 46 | 47 | private final static Among a_3[] = { 48 | new Among ( "anci", -1, 3, "", methodObject ), 49 | new Among ( "enci", -1, 2, "", methodObject ), 50 | new Among ( "abli", -1, 4, "", methodObject ), 51 | new Among ( "eli", -1, 6, "", methodObject ), 52 | new Among ( "alli", -1, 9, "", methodObject ), 53 | new Among ( "ousli", -1, 12, "", methodObject ), 54 | new Among ( "entli", -1, 5, "", methodObject ), 55 | new Among ( "aliti", -1, 10, "", methodObject ), 56 | new Among ( "biliti", -1, 14, "", methodObject ), 57 | new Among ( "iviti", -1, 13, "", methodObject ), 58 | new Among ( "tional", -1, 1, "", methodObject ), 59 | new Among ( "ational", 10, 8, "", methodObject ), 60 | new Among ( "alism", -1, 10, "", methodObject ), 61 | new Among ( "ation", -1, 8, "", methodObject ), 62 | new Among ( "ization", 13, 7, "", methodObject ), 63 | new Among ( "izer", -1, 7, "", methodObject ), 64 | new Among ( "ator", -1, 8, "", methodObject ), 65 | new Among ( "iveness", -1, 13, "", methodObject ), 66 | new Among ( "fulness", -1, 11, "", methodObject ), 67 | new Among ( "ousness", -1, 12, "", methodObject ) 68 | }; 69 | 70 | private final static Among a_4[] = { 71 | new Among ( "icate", -1, 2, "", methodObject ), 72 | new Among ( "ative", -1, 3, "", methodObject ), 73 | new Among ( "alize", -1, 1, "", methodObject ), 74 | new Among ( "iciti", -1, 2, "", methodObject ), 75 | new Among ( "ical", -1, 2, "", methodObject ), 76 | new Among ( "ful", -1, 3, "", methodObject ), 77 | new Among ( "ness", -1, 3, "", methodObject ) 78 | }; 79 | 80 | private final static Among a_5[] = { 81 | new Among ( "ic", -1, 1, "", methodObject ), 82 | new Among ( "ance", -1, 1, "", methodObject ), 83 | new Among ( "ence", -1, 1, "", methodObject ), 84 | new Among ( "able", -1, 1, "", methodObject ), 85 | new Among ( "ible", -1, 1, "", methodObject ), 86 | new Among ( "ate", -1, 1, "", methodObject ), 87 | new Among ( "ive", -1, 1, "", methodObject ), 88 | new Among ( "ize", -1, 1, "", methodObject ), 89 | new Among ( "iti", -1, 1, "", methodObject ), 90 | new Among ( "al", -1, 1, "", methodObject ), 91 | new Among ( "ism", -1, 1, "", methodObject ), 92 | new Among ( "ion", -1, 2, "", methodObject ), 93 | new Among ( "er", -1, 1, "", methodObject ), 94 | new Among ( "ous", -1, 1, "", methodObject ), 95 | new Among ( "ant", -1, 1, "", methodObject ), 96 | new Among ( "ent", -1, 1, "", methodObject ), 97 | new Among ( "ment", 15, 1, "", methodObject ), 98 | new Among ( "ement", 16, 1, "", methodObject ), 99 | new Among ( "ou", -1, 1, "", methodObject ) 100 | }; 101 | 102 | private static final char g_v[] = {17, 65, 16, 1 }; 103 | 104 | private static final char g_v_WXY[] = {1, 17, 65, 208, 1 }; 105 | 106 | private boolean B_Y_found; 107 | private int I_p2; 108 | private int I_p1; 109 | 110 | private void copy_from(porterStemmer other) { 111 | B_Y_found = other.B_Y_found; 112 | I_p2 = other.I_p2; 113 | I_p1 = other.I_p1; 114 | super.copy_from(other); 115 | } 116 | 117 | private boolean r_shortv() { 118 | // (, line 19 119 | if (!(out_grouping_b(g_v_WXY, 89, 121))) 120 | { 121 | return false; 122 | } 123 | if (!(in_grouping_b(g_v, 97, 121))) 124 | { 125 | return false; 126 | } 127 | if (!(out_grouping_b(g_v, 97, 121))) 128 | { 129 | return false; 130 | } 131 | return true; 132 | } 133 | 134 | private boolean r_R1() { 135 | if (!(I_p1 <= cursor)) 136 | { 137 | return false; 138 | } 139 | return true; 140 | } 141 | 142 | private boolean r_R2() { 143 | if (!(I_p2 <= cursor)) 144 | { 145 | return false; 146 | } 147 | return true; 148 | } 149 | 150 | private boolean r_Step_1a() { 151 | int among_var; 152 | // (, line 24 153 | // [, line 25 154 | ket = cursor; 155 | // substring, line 25 156 | among_var = find_among_b(a_0, 4); 157 | if (among_var == 0) 158 | { 159 | return false; 160 | } 161 | // ], line 25 162 | bra = cursor; 163 | switch(among_var) { 164 | case 0: 165 | return false; 166 | case 1: 167 | // (, line 26 168 | // <-, line 26 169 | slice_from("ss"); 170 | break; 171 | case 2: 172 | // (, line 27 173 | // <-, line 27 174 | slice_from("i"); 175 | break; 176 | case 3: 177 | // (, line 29 178 | // delete, line 29 179 | slice_del(); 180 | break; 181 | } 182 | return true; 183 | } 184 | 185 | private boolean r_Step_1b() { 186 | int among_var; 187 | int v_1; 188 | int v_3; 189 | int v_4; 190 | // (, line 33 191 | // [, line 34 192 | ket = cursor; 193 | // substring, line 34 194 | among_var = find_among_b(a_2, 3); 195 | if (among_var == 0) 196 | { 197 | return false; 198 | } 199 | // ], line 34 200 | bra = cursor; 201 | switch(among_var) { 202 | case 0: 203 | return false; 204 | case 1: 205 | // (, line 35 206 | // call R1, line 35 207 | if (!r_R1()) 208 | { 209 | return false; 210 | } 211 | // <-, line 35 212 | slice_from("ee"); 213 | break; 214 | case 2: 215 | // (, line 37 216 | // test, line 38 217 | v_1 = limit - cursor; 218 | // gopast, line 38 219 | golab0: while(true) 220 | { 221 | lab1: do { 222 | if (!(in_grouping_b(g_v, 97, 121))) 223 | { 224 | break lab1; 225 | } 226 | break golab0; 227 | } while (false); 228 | if (cursor <= limit_backward) 229 | { 230 | return false; 231 | } 232 | cursor--; 233 | } 234 | cursor = limit - v_1; 235 | // delete, line 38 236 | slice_del(); 237 | // test, line 39 238 | v_3 = limit - cursor; 239 | // substring, line 39 240 | among_var = find_among_b(a_1, 13); 241 | if (among_var == 0) 242 | { 243 | return false; 244 | } 245 | cursor = limit - v_3; 246 | switch(among_var) { 247 | case 0: 248 | return false; 249 | case 1: 250 | // (, line 41 251 | // <+, line 41 252 | { 253 | int c = cursor; 254 | insert(cursor, cursor, "e"); 255 | cursor = c; 256 | } 257 | break; 258 | case 2: 259 | // (, line 44 260 | // [, line 44 261 | ket = cursor; 262 | // next, line 44 263 | if (cursor <= limit_backward) 264 | { 265 | return false; 266 | } 267 | cursor--; 268 | // ], line 44 269 | bra = cursor; 270 | // delete, line 44 271 | slice_del(); 272 | break; 273 | case 3: 274 | // (, line 45 275 | // atmark, line 45 276 | if (cursor != I_p1) 277 | { 278 | return false; 279 | } 280 | // test, line 45 281 | v_4 = limit - cursor; 282 | // call shortv, line 45 283 | if (!r_shortv()) 284 | { 285 | return false; 286 | } 287 | cursor = limit - v_4; 288 | // <+, line 45 289 | { 290 | int c = cursor; 291 | insert(cursor, cursor, "e"); 292 | cursor = c; 293 | } 294 | break; 295 | } 296 | break; 297 | } 298 | return true; 299 | } 300 | 301 | private boolean r_Step_1c() { 302 | int v_1; 303 | // (, line 51 304 | // [, line 52 305 | ket = cursor; 306 | // or, line 52 307 | lab0: do { 308 | v_1 = limit - cursor; 309 | lab1: do { 310 | // literal, line 52 311 | if (!(eq_s_b(1, "y"))) 312 | { 313 | break lab1; 314 | } 315 | break lab0; 316 | } while (false); 317 | cursor = limit - v_1; 318 | // literal, line 52 319 | if (!(eq_s_b(1, "Y"))) 320 | { 321 | return false; 322 | } 323 | } while (false); 324 | // ], line 52 325 | bra = cursor; 326 | // gopast, line 53 327 | golab2: while(true) 328 | { 329 | lab3: do { 330 | if (!(in_grouping_b(g_v, 97, 121))) 331 | { 332 | break lab3; 333 | } 334 | break golab2; 335 | } while (false); 336 | if (cursor <= limit_backward) 337 | { 338 | return false; 339 | } 340 | cursor--; 341 | } 342 | // <-, line 54 343 | slice_from("i"); 344 | return true; 345 | } 346 | 347 | private boolean r_Step_2() { 348 | int among_var; 349 | // (, line 57 350 | // [, line 58 351 | ket = cursor; 352 | // substring, line 58 353 | among_var = find_among_b(a_3, 20); 354 | if (among_var == 0) 355 | { 356 | return false; 357 | } 358 | // ], line 58 359 | bra = cursor; 360 | // call R1, line 58 361 | if (!r_R1()) 362 | { 363 | return false; 364 | } 365 | switch(among_var) { 366 | case 0: 367 | return false; 368 | case 1: 369 | // (, line 59 370 | // <-, line 59 371 | slice_from("tion"); 372 | break; 373 | case 2: 374 | // (, line 60 375 | // <-, line 60 376 | slice_from("ence"); 377 | break; 378 | case 3: 379 | // (, line 61 380 | // <-, line 61 381 | slice_from("ance"); 382 | break; 383 | case 4: 384 | // (, line 62 385 | // <-, line 62 386 | slice_from("able"); 387 | break; 388 | case 5: 389 | // (, line 63 390 | // <-, line 63 391 | slice_from("ent"); 392 | break; 393 | case 6: 394 | // (, line 64 395 | // <-, line 64 396 | slice_from("e"); 397 | break; 398 | case 7: 399 | // (, line 66 400 | // <-, line 66 401 | slice_from("ize"); 402 | break; 403 | case 8: 404 | // (, line 68 405 | // <-, line 68 406 | slice_from("ate"); 407 | break; 408 | case 9: 409 | // (, line 69 410 | // <-, line 69 411 | slice_from("al"); 412 | break; 413 | case 10: 414 | // (, line 71 415 | // <-, line 71 416 | slice_from("al"); 417 | break; 418 | case 11: 419 | // (, line 72 420 | // <-, line 72 421 | slice_from("ful"); 422 | break; 423 | case 12: 424 | // (, line 74 425 | // <-, line 74 426 | slice_from("ous"); 427 | break; 428 | case 13: 429 | // (, line 76 430 | // <-, line 76 431 | slice_from("ive"); 432 | break; 433 | case 14: 434 | // (, line 77 435 | // <-, line 77 436 | slice_from("ble"); 437 | break; 438 | } 439 | return true; 440 | } 441 | 442 | private boolean r_Step_3() { 443 | int among_var; 444 | // (, line 81 445 | // [, line 82 446 | ket = cursor; 447 | // substring, line 82 448 | among_var = find_among_b(a_4, 7); 449 | if (among_var == 0) 450 | { 451 | return false; 452 | } 453 | // ], line 82 454 | bra = cursor; 455 | // call R1, line 82 456 | if (!r_R1()) 457 | { 458 | return false; 459 | } 460 | switch(among_var) { 461 | case 0: 462 | return false; 463 | case 1: 464 | // (, line 83 465 | // <-, line 83 466 | slice_from("al"); 467 | break; 468 | case 2: 469 | // (, line 85 470 | // <-, line 85 471 | slice_from("ic"); 472 | break; 473 | case 3: 474 | // (, line 87 475 | // delete, line 87 476 | slice_del(); 477 | break; 478 | } 479 | return true; 480 | } 481 | 482 | private boolean r_Step_4() { 483 | int among_var; 484 | int v_1; 485 | // (, line 91 486 | // [, line 92 487 | ket = cursor; 488 | // substring, line 92 489 | among_var = find_among_b(a_5, 19); 490 | if (among_var == 0) 491 | { 492 | return false; 493 | } 494 | // ], line 92 495 | bra = cursor; 496 | // call R2, line 92 497 | if (!r_R2()) 498 | { 499 | return false; 500 | } 501 | switch(among_var) { 502 | case 0: 503 | return false; 504 | case 1: 505 | // (, line 95 506 | // delete, line 95 507 | slice_del(); 508 | break; 509 | case 2: 510 | // (, line 96 511 | // or, line 96 512 | lab0: do { 513 | v_1 = limit - cursor; 514 | lab1: do { 515 | // literal, line 96 516 | if (!(eq_s_b(1, "s"))) 517 | { 518 | break lab1; 519 | } 520 | break lab0; 521 | } while (false); 522 | cursor = limit - v_1; 523 | // literal, line 96 524 | if (!(eq_s_b(1, "t"))) 525 | { 526 | return false; 527 | } 528 | } while (false); 529 | // delete, line 96 530 | slice_del(); 531 | break; 532 | } 533 | return true; 534 | } 535 | 536 | private boolean r_Step_5a() { 537 | int v_1; 538 | int v_2; 539 | // (, line 100 540 | // [, line 101 541 | ket = cursor; 542 | // literal, line 101 543 | if (!(eq_s_b(1, "e"))) 544 | { 545 | return false; 546 | } 547 | // ], line 101 548 | bra = cursor; 549 | // or, line 102 550 | lab0: do { 551 | v_1 = limit - cursor; 552 | lab1: do { 553 | // call R2, line 102 554 | if (!r_R2()) 555 | { 556 | break lab1; 557 | } 558 | break lab0; 559 | } while (false); 560 | cursor = limit - v_1; 561 | // (, line 102 562 | // call R1, line 102 563 | if (!r_R1()) 564 | { 565 | return false; 566 | } 567 | // not, line 102 568 | { 569 | v_2 = limit - cursor; 570 | lab2: do { 571 | // call shortv, line 102 572 | if (!r_shortv()) 573 | { 574 | break lab2; 575 | } 576 | return false; 577 | } while (false); 578 | cursor = limit - v_2; 579 | } 580 | } while (false); 581 | // delete, line 103 582 | slice_del(); 583 | return true; 584 | } 585 | 586 | private boolean r_Step_5b() { 587 | // (, line 106 588 | // [, line 107 589 | ket = cursor; 590 | // literal, line 107 591 | if (!(eq_s_b(1, "l"))) 592 | { 593 | return false; 594 | } 595 | // ], line 107 596 | bra = cursor; 597 | // call R2, line 108 598 | if (!r_R2()) 599 | { 600 | return false; 601 | } 602 | // literal, line 108 603 | if (!(eq_s_b(1, "l"))) 604 | { 605 | return false; 606 | } 607 | // delete, line 109 608 | slice_del(); 609 | return true; 610 | } 611 | 612 | public boolean stem() { 613 | int v_1; 614 | int v_2; 615 | int v_3; 616 | int v_4; 617 | int v_5; 618 | int v_10; 619 | int v_11; 620 | int v_12; 621 | int v_13; 622 | int v_14; 623 | int v_15; 624 | int v_16; 625 | int v_17; 626 | int v_18; 627 | int v_19; 628 | int v_20; 629 | // (, line 113 630 | // unset Y_found, line 115 631 | B_Y_found = false; 632 | // do, line 116 633 | v_1 = cursor; 634 | lab0: do { 635 | // (, line 116 636 | // [, line 116 637 | bra = cursor; 638 | // literal, line 116 639 | if (!(eq_s(1, "y"))) 640 | { 641 | break lab0; 642 | } 643 | // ], line 116 644 | ket = cursor; 645 | // <-, line 116 646 | slice_from("Y"); 647 | // set Y_found, line 116 648 | B_Y_found = true; 649 | } while (false); 650 | cursor = v_1; 651 | // do, line 117 652 | v_2 = cursor; 653 | lab1: do { 654 | // repeat, line 117 655 | replab2: while(true) 656 | { 657 | v_3 = cursor; 658 | lab3: do { 659 | // (, line 117 660 | // goto, line 117 661 | golab4: while(true) 662 | { 663 | v_4 = cursor; 664 | lab5: do { 665 | // (, line 117 666 | if (!(in_grouping(g_v, 97, 121))) 667 | { 668 | break lab5; 669 | } 670 | // [, line 117 671 | bra = cursor; 672 | // literal, line 117 673 | if (!(eq_s(1, "y"))) 674 | { 675 | break lab5; 676 | } 677 | // ], line 117 678 | ket = cursor; 679 | cursor = v_4; 680 | break golab4; 681 | } while (false); 682 | cursor = v_4; 683 | if (cursor >= limit) 684 | { 685 | break lab3; 686 | } 687 | cursor++; 688 | } 689 | // <-, line 117 690 | slice_from("Y"); 691 | // set Y_found, line 117 692 | B_Y_found = true; 693 | continue replab2; 694 | } while (false); 695 | cursor = v_3; 696 | break replab2; 697 | } 698 | } while (false); 699 | cursor = v_2; 700 | I_p1 = limit; 701 | I_p2 = limit; 702 | // do, line 121 703 | v_5 = cursor; 704 | lab6: do { 705 | // (, line 121 706 | // gopast, line 122 707 | golab7: while(true) 708 | { 709 | lab8: do { 710 | if (!(in_grouping(g_v, 97, 121))) 711 | { 712 | break lab8; 713 | } 714 | break golab7; 715 | } while (false); 716 | if (cursor >= limit) 717 | { 718 | break lab6; 719 | } 720 | cursor++; 721 | } 722 | // gopast, line 122 723 | golab9: while(true) 724 | { 725 | lab10: do { 726 | if (!(out_grouping(g_v, 97, 121))) 727 | { 728 | break lab10; 729 | } 730 | break golab9; 731 | } while (false); 732 | if (cursor >= limit) 733 | { 734 | break lab6; 735 | } 736 | cursor++; 737 | } 738 | // setmark p1, line 122 739 | I_p1 = cursor; 740 | // gopast, line 123 741 | golab11: while(true) 742 | { 743 | lab12: do { 744 | if (!(in_grouping(g_v, 97, 121))) 745 | { 746 | break lab12; 747 | } 748 | break golab11; 749 | } while (false); 750 | if (cursor >= limit) 751 | { 752 | break lab6; 753 | } 754 | cursor++; 755 | } 756 | // gopast, line 123 757 | golab13: while(true) 758 | { 759 | lab14: do { 760 | if (!(out_grouping(g_v, 97, 121))) 761 | { 762 | break lab14; 763 | } 764 | break golab13; 765 | } while (false); 766 | if (cursor >= limit) 767 | { 768 | break lab6; 769 | } 770 | cursor++; 771 | } 772 | // setmark p2, line 123 773 | I_p2 = cursor; 774 | } while (false); 775 | cursor = v_5; 776 | // backwards, line 126 777 | limit_backward = cursor; cursor = limit; 778 | // (, line 126 779 | // do, line 127 780 | v_10 = limit - cursor; 781 | lab15: do { 782 | // call Step_1a, line 127 783 | if (!r_Step_1a()) 784 | { 785 | break lab15; 786 | } 787 | } while (false); 788 | cursor = limit - v_10; 789 | // do, line 128 790 | v_11 = limit - cursor; 791 | lab16: do { 792 | // call Step_1b, line 128 793 | if (!r_Step_1b()) 794 | { 795 | break lab16; 796 | } 797 | } while (false); 798 | cursor = limit - v_11; 799 | // do, line 129 800 | v_12 = limit - cursor; 801 | lab17: do { 802 | // call Step_1c, line 129 803 | if (!r_Step_1c()) 804 | { 805 | break lab17; 806 | } 807 | } while (false); 808 | cursor = limit - v_12; 809 | // do, line 130 810 | v_13 = limit - cursor; 811 | lab18: do { 812 | // call Step_2, line 130 813 | if (!r_Step_2()) 814 | { 815 | break lab18; 816 | } 817 | } while (false); 818 | cursor = limit - v_13; 819 | // do, line 131 820 | v_14 = limit - cursor; 821 | lab19: do { 822 | // call Step_3, line 131 823 | if (!r_Step_3()) 824 | { 825 | break lab19; 826 | } 827 | } while (false); 828 | cursor = limit - v_14; 829 | // do, line 132 830 | v_15 = limit - cursor; 831 | lab20: do { 832 | // call Step_4, line 132 833 | if (!r_Step_4()) 834 | { 835 | break lab20; 836 | } 837 | } while (false); 838 | cursor = limit - v_15; 839 | // do, line 133 840 | v_16 = limit - cursor; 841 | lab21: do { 842 | // call Step_5a, line 133 843 | if (!r_Step_5a()) 844 | { 845 | break lab21; 846 | } 847 | } while (false); 848 | cursor = limit - v_16; 849 | // do, line 134 850 | v_17 = limit - cursor; 851 | lab22: do { 852 | // call Step_5b, line 134 853 | if (!r_Step_5b()) 854 | { 855 | break lab22; 856 | } 857 | } while (false); 858 | cursor = limit - v_17; 859 | cursor = limit_backward; // do, line 137 860 | v_18 = cursor; 861 | lab23: do { 862 | // (, line 137 863 | // Boolean test Y_found, line 137 864 | if (!(B_Y_found)) 865 | { 866 | break lab23; 867 | } 868 | // repeat, line 137 869 | replab24: while(true) 870 | { 871 | v_19 = cursor; 872 | lab25: do { 873 | // (, line 137 874 | // goto, line 137 875 | golab26: while(true) 876 | { 877 | v_20 = cursor; 878 | lab27: do { 879 | // (, line 137 880 | // [, line 137 881 | bra = cursor; 882 | // literal, line 137 883 | if (!(eq_s(1, "Y"))) 884 | { 885 | break lab27; 886 | } 887 | // ], line 137 888 | ket = cursor; 889 | cursor = v_20; 890 | break golab26; 891 | } while (false); 892 | cursor = v_20; 893 | if (cursor >= limit) 894 | { 895 | break lab25; 896 | } 897 | cursor++; 898 | } 899 | // <-, line 137 900 | slice_from("y"); 901 | continue replab24; 902 | } while (false); 903 | cursor = v_19; 904 | break replab24; 905 | } 906 | } while (false); 907 | cursor = v_18; 908 | return true; 909 | } 910 | 911 | public boolean equals( Object o ) { 912 | return o instanceof porterStemmer; 913 | } 914 | 915 | public int hashCode() { 916 | return porterStemmer.class.getName().hashCode(); 917 | } 918 | 919 | 920 | 921 | } 922 | 923 | --------------------------------------------------------------------------------