Index: branches/lucene-search-2.1/test/org/wikimedia/lsearch/analyzers/WordNetTest.java |
— | — | @@ -0,0 +1,23 @@ |
| 2 | +package org.wikimedia.lsearch.analyzers; |
| 3 | + |
| 4 | +import java.util.ArrayList; |
| 5 | + |
| 6 | +import org.wikimedia.lsearch.test.WikiTestCase; |
| 7 | + |
| 8 | +public class WordNetTest extends WikiTestCase { |
| 9 | + |
| 10 | + protected ArrayList<String> list(String[] strs){ |
| 11 | + ArrayList<String> l = new ArrayList<String>(); |
| 12 | + for( String s : strs ) |
| 13 | + l.add(s); |
| 14 | + return l; |
| 15 | + } |
| 16 | + public void testWordNet(){ |
| 17 | + assertEquals("[[ten]]", WordNet.replaceOne(list(new String[]{"10"}),"en").toString()); |
| 18 | + assertEquals("[[ten, riders]]", WordNet.replaceOne(list(new String[]{"10", "riders"}),"en").toString()); |
| 19 | + assertEquals("[[in, united, kingdom]]", WordNet.replaceOne(list(new String[]{"in", "uk"}),"en").toString()); |
| 20 | + assertEquals("[]",WordNet.replaceOne(list(new String[]{"in", "us"}),"en").toString()); |
| 21 | + assertEquals("[[in, the, united, states]]",WordNet.replaceOne(list(new String[]{"in", "the", "us"}),"en").toString()); |
| 22 | + } |
| 23 | + |
| 24 | +} |
Index: branches/lucene-search-2.1/src/org/wikimedia/lsearch/analyzers/WikiQueryParser.java |
— | — | @@ -1661,7 +1661,7 @@ |
1662 | 1662 | |
1663 | 1663 | Query sections = makeSectionsQuery(noStopWords,SECTIONS_BOOST); |
1664 | 1664 | // wordnet synonyms |
1665 | | - ArrayList<ArrayList<String>> wordnet = WordNet.replaceOne(noStopWords.extractFirst(),iid.getLangCode()); |
| 1665 | + ArrayList<ArrayList<String>> wordnet = WordNet.replaceOne(words.extractFirst(),iid.getLangCode()); |
1666 | 1666 | |
1667 | 1667 | BooleanQuery combined = new BooleanQuery(true); |
1668 | 1668 | // combined various queries into mainphrase |
Index: branches/lucene-search-2.1/resources/dict/wordnet-en.txt.gz |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |