1 6 7 package org.contineo.core.text.analyze.de; 8 9 import java.text.BreakIterator ; 10 11 import org.contineo.core.text.analyze.AnalyseResult; 12 import org.contineo.core.text.analyze.Analyzer; 13 import org.contineo.core.text.analyze.Stemmer; 14 import org.contineo.core.text.analyze.StopTable; 15 import org.contineo.core.text.analyze.Stopwords; 16 import org.contineo.core.text.analyze.WordRanker; 17 import org.contineo.core.text.analyze.WordTable; 18 23 public class GermanAnalyzer extends WordRanker implements Analyzer { 24 25 private String [] germanStopwords; 26 27 30 public GermanAnalyzer() { 31 germanStopwords = Stopwords.getStopwords("de"); 32 stoptable = StopTable.setStopWords(germanStopwords); 33 } 34 35 39 public GermanAnalyzer(String stopwords[]) { 40 stoptable = StopTable.setStopWords(stopwords); 41 } 42 43 47 public GermanAnalyzer(int len) { 48 minlen = len; 49 germanStopwords = Stopwords.getStopwords("de"); 50 stoptable = StopTable.setStopWords(germanStopwords); 51 } 52 53 57 public void analyze(String text) { 58 BreakIterator boundary = BreakIterator.getWordInstance(); 59 boundary.setText(text); 60 Stemmer stemmer = new GermanStemmer(); 61 AnalyseResult result = WordTable.fillWordTable(boundary, new StringBuffer (text), stoptable, minlen, stemmer); 62 wordcount = result.getWordCount(); 63 wordtable = result.getWordTable(); 64 } 65 } 66 | Popular Tags |