Skip to content

Commit

Permalink
OPENNLP-1520 - Re-Generate Snowball Stemmer Java Code (#561)
Browse files Browse the repository at this point in the history
* OPENNLP-1520 - Re-Generate Snowball Stemmer Java Code.
Adds a test case for Finish Stemmer

* OPENNLP-1520 - Apply OpenNLP Formatting to all stemmer/* classes
  • Loading branch information
rzo1 authored Dec 8, 2023
1 parent 617d08f commit 63ba918
Show file tree
Hide file tree
Showing 27 changed files with 16,944 additions and 24,994 deletions.
508 changes: 345 additions & 163 deletions opennlp-tools/src/main/java/opennlp/tools/stemmer/PorterStemmer.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
package opennlp.tools.stemmer.snowball;

abstract class AbstractSnowballStemmer extends SnowballProgram {
public abstract boolean stem();
public abstract boolean stem();
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,34 +30,33 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
*/

// Generated by Snowball (build from 867c4ec70debd4daa7fb4d5a9f7759b47887d0b9)
package opennlp.tools.stemmer.snowball;

import java.lang.reflect.Method;

class Among {
public Among (String s, int substring_i, int result,
String methodname, SnowballProgram methodobject) {
this.s_size = s.length();
this.s = s.toCharArray();
this.substring_i = substring_i;
this.result = result;
this.methodobject = methodobject;
if (methodname.length() == 0) {
this.method = null;
} else {
try {
this.method = methodobject.getClass().
getDeclaredMethod(methodname, new Class[0]);
} catch (NoSuchMethodException e) {
throw new RuntimeException(e);
}
}
public class Among {
public final char[] s; /* search string */
public final int substring_i; /* index to longest matching substring */
public final int result; /* result of the lookup */
public final Method method; /* method to use if substring matches */

public Among(String s, int substring_i, int result) {
this.s = s.toCharArray();
this.substring_i = substring_i;
this.result = result;
this.method = null;
}

public Among(String s, int substring_i, int result, String methodname,
Class<? extends AbstractSnowballStemmer> programclass) {
this.s = s.toCharArray();
this.substring_i = substring_i;
this.result = result;
try {
this.method = programclass.getDeclaredMethod(methodname);
} catch (NoSuchMethodException e) {
throw new RuntimeException(e);
}

public final int s_size; /* search string */
public final char[] s; /* search string */
public final int substring_i; /* index to longest matching substring */
public final int result; /* result of the lookup */
public final Method method; /* method to use if substring matches */
public final SnowballProgram methodobject; /* object to invoke method on */
}
}
Loading

0 comments on commit 63ba918

Please sign in to comment.