r55512 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r55511‎ | r55512 | r55513 >
Date:23:47, 22 August 2009
Author:rainman
Status:deferred
Tags:
Comment:
Put in some test cases for synonyms and split handling of uk/us synonyms.
Modified paths:
  • /branches/lucene-search-2.1/resources/dict/wordnet-en.txt.gz (modified) (history)
  • /branches/lucene-search-2.1/src/org/wikimedia/lsearch/analyzers/WikiQueryParser.java (modified) (history)
  • /branches/lucene-search-2.1/test/org/wikimedia/lsearch/analyzers/WordNetTest.java (added) (history)

Diff [purge]

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 @@
16621662
16631663 Query sections = makeSectionsQuery(noStopWords,SECTIONS_BOOST);
16641664 // wordnet synonyms
1665 - ArrayList<ArrayList<String>> wordnet = WordNet.replaceOne(noStopWords.extractFirst(),iid.getLangCode());
 1665+ ArrayList<ArrayList<String>> wordnet = WordNet.replaceOne(words.extractFirst(),iid.getLangCode());
16661666
16671667 BooleanQuery combined = new BooleanQuery(true);
16681668 // 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

Status & tagging log