01: package org.contineo.core.text.analyze;
02:
03: import junit.framework.TestCase;
04:
05: public class StemmerTest extends TestCase {
06:
07: public void testItalianStemmer() throws Exception {
08: Stemmer stemmer = new Stemmer("it");
09:
10: String source = "conoscenza";
11: String dest = stemmer.stem(source);
12: System.out.println(dest);
13: assertEquals("conoscent", dest);
14:
15: source = "proposti";
16: dest = stemmer.stem(source);
17: System.out.println(dest);
18: assertEquals("propost", dest);
19:
20: source = "possibile";
21: dest = stemmer.stem(source);
22: System.out.println(dest);
23: assertEquals("possibil", dest);
24:
25: source = "collettività";
26: dest = stemmer.stem(source);
27: System.out.println(dest);
28: assertEquals("collett", dest);
29:
30: source = "java";
31: dest = stemmer.stem(source);
32: System.out.println(dest);
33: assertEquals("jav", dest);
34: }
35:
36: public void testEnglishStemmer() throws Exception {
37: Stemmer stemmer = new Stemmer("en");
38:
39: String source = "designing";
40: String dest = stemmer.stem(source);
41: System.out.println(dest);
42: assertEquals("design", dest);
43:
44: source = "tables";
45: dest = stemmer.stem(source);
46: System.out.println(dest);
47: assertEquals("tabl", dest);
48:
49: source = "bulleted";
50: dest = stemmer.stem(source);
51: System.out.println(dest);
52: assertEquals("bullet", dest);
53:
54: source = "surprising";
55: dest = stemmer.stem(source);
56: System.out.println(dest);
57: assertEquals("surpris", dest);
58: }
59:
60: public void testSpanishStemmer() throws Exception {
61: Stemmer stemmer = new Stemmer("es");
62: // Nuestra misión: crear una relación de confianza entre propietarios e
63: // inquilinos que comparten las mismas ganas de tener el éxito en sus
64: // alquileres.
65:
66: String source = "Nuestra";
67: String dest = stemmer.stem(source);
68: System.out.println(dest);
69: assertEquals("nuestr", dest);
70:
71: source = "misión";
72: dest = stemmer.stem(source);
73: System.out.println(dest);
74: assertEquals("mision", dest);
75:
76: source = "relación";
77: dest = stemmer.stem(source);
78: System.out.println(dest);
79: assertEquals("relacion", dest);
80:
81: source = "confianza";
82: dest = stemmer.stem(source);
83: System.out.println(dest);
84: assertEquals("confianz", dest);
85: }
86:
87: }
|