Return-Path: Delivered-To: apmail-lucene-java-commits-archive@www.apache.org Received: (qmail 37533 invoked from network); 18 Jun 2006 05:33:18 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 18 Jun 2006 05:33:18 -0000 Received: (qmail 58089 invoked by uid 500); 18 Jun 2006 05:33:17 -0000 Delivered-To: apmail-lucene-java-commits-archive@lucene.apache.org Received: (qmail 58073 invoked by uid 500); 18 Jun 2006 05:33:17 -0000 Mailing-List: contact java-commits-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-dev@lucene.apache.org Delivered-To: mailing list java-commits@lucene.apache.org Received: (qmail 58060 invoked by uid 99); 18 Jun 2006 05:33:17 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 17 Jun 2006 22:33:17 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [140.211.166.113] (HELO eris.apache.org) (140.211.166.113) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 17 Jun 2006 22:33:16 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 569121A983A; Sat, 17 Jun 2006 22:32:56 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r415093 - in /lucene/java/trunk/contrib/spellchecker/src/java/org/apache/lucene/search/spell: Dictionary.java LuceneDictionary.java PlainTextDictionary.java SpellChecker.java SuggestWord.java SuggestWordQueue.java Date: Sun, 18 Jun 2006 05:32:55 -0000 To: java-commits@lucene.apache.org From: otis@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20060618053256.569121A983A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: otis Date: Sat Jun 17 22:32:54 2006 New Revision: 415093 URL: http://svn.apache.org/viewvc?rev=415093&view=rev Log: - Cosmetics Modified: lucene/java/trunk/contrib/spellchecker/src/java/org/apache/lucene/search/spell/Dictionary.java lucene/java/trunk/contrib/spellchecker/src/java/org/apache/lucene/search/spell/LuceneDictionary.java lucene/java/trunk/contrib/spellchecker/src/java/org/apache/lucene/search/spell/PlainTextDictionary.java lucene/java/trunk/contrib/spellchecker/src/java/org/apache/lucene/search/spell/SpellChecker.java lucene/java/trunk/contrib/spellchecker/src/java/org/apache/lucene/search/spell/SuggestWord.java lucene/java/trunk/contrib/spellchecker/src/java/org/apache/lucene/search/spell/SuggestWordQueue.java Modified: lucene/java/trunk/contrib/spellchecker/src/java/org/apache/lucene/search/spell/Dictionary.java URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/spellchecker/src/java/org/apache/lucene/search/spell/Dictionary.java?rev=415093&r1=415092&r2=415093&view=diff ============================================================================== --- lucene/java/trunk/contrib/spellchecker/src/java/org/apache/lucene/search/spell/Dictionary.java (original) +++ lucene/java/trunk/contrib/spellchecker/src/java/org/apache/lucene/search/spell/Dictionary.java Sat Jun 17 22:32:54 2006 @@ -24,10 +24,9 @@ */ public interface Dictionary { - /** - * return all the words present in the dictionnary - * @return Iterator - */ - public Iterator getWordsIterator(); - + /** + * Return all words present in the dictionary + * @return Iterator + */ + Iterator getWordsIterator(); } Modified: lucene/java/trunk/contrib/spellchecker/src/java/org/apache/lucene/search/spell/LuceneDictionary.java URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/spellchecker/src/java/org/apache/lucene/search/spell/LuceneDictionary.java?rev=415093&r1=415092&r2=415093&view=diff ============================================================================== --- lucene/java/trunk/contrib/spellchecker/src/java/org/apache/lucene/search/spell/LuceneDictionary.java (original) +++ lucene/java/trunk/contrib/spellchecker/src/java/org/apache/lucene/search/spell/LuceneDictionary.java Sat Jun 17 22:32:54 2006 @@ -47,7 +47,7 @@ final class LuceneIterator implements Iterator { private TermEnum termEnum; private Term actualTerm; - private boolean has_next_called; + private boolean hasNextCalled; public LuceneIterator() { try { @@ -59,16 +59,16 @@ public Object next() { - if (!has_next_called) { + if (!hasNextCalled) { hasNext(); } - has_next_called = false; + hasNextCalled = false; return (actualTerm != null) ? actualTerm.text() : null; } public boolean hasNext() { - has_next_called = true; + hasNextCalled = true; try { // if there is still words if (!termEnum.next()) { @@ -90,6 +90,6 @@ } public void remove() { - }; + } } } Modified: lucene/java/trunk/contrib/spellchecker/src/java/org/apache/lucene/search/spell/PlainTextDictionary.java URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/spellchecker/src/java/org/apache/lucene/search/spell/PlainTextDictionary.java?rev=415093&r1=415092&r2=415093&view=diff ============================================================================== --- lucene/java/trunk/contrib/spellchecker/src/java/org/apache/lucene/search/spell/PlainTextDictionary.java (original) +++ lucene/java/trunk/contrib/spellchecker/src/java/org/apache/lucene/search/spell/PlainTextDictionary.java Sat Jun 17 22:32:54 2006 @@ -27,10 +27,10 @@ /** * Dictionary represented by a file text. * - *

Format allowed: 1 word per line:
- * word1
- * word2
- * word3
+ *

Format allowed: 1 word per line:
+ * word1
+ * word2
+ * word3
* * @author Nicolas Maisonneuve */ @@ -38,7 +38,7 @@ private BufferedReader in; private String line; - private boolean has_next_called; + private boolean hasNextCalled; public PlainTextDictionary(File file) throws FileNotFoundException { in = new BufferedReader(new FileReader(file)); @@ -55,16 +55,16 @@ final class fileIterator implements Iterator { public Object next() { - if (!has_next_called) { + if (!hasNextCalled) { hasNext(); } - has_next_called = false; + hasNextCalled = false; return line; } public boolean hasNext() { - has_next_called = true; + hasNextCalled = true; try { line = in.readLine(); } catch (IOException ex) { @@ -77,7 +77,7 @@ public void remove() { - }; + } } } Modified: lucene/java/trunk/contrib/spellchecker/src/java/org/apache/lucene/search/spell/SpellChecker.java URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/spellchecker/src/java/org/apache/lucene/search/spell/SpellChecker.java?rev=415093&r1=415092&r2=415093&view=diff ============================================================================== --- lucene/java/trunk/contrib/spellchecker/src/java/org/apache/lucene/search/spell/SpellChecker.java (original) +++ lucene/java/trunk/contrib/spellchecker/src/java/org/apache/lucene/search/spell/SpellChecker.java Sat Jun 17 22:32:54 2006 @@ -38,8 +38,8 @@ /** *

- * Spell Checker class (Main class)
- * (initially inspired by the David Spencer code). + * Spell Checker class (Main class)
+ * (initially inspired by the David Spencer code). *

* *

Example Usage: @@ -351,7 +351,7 @@ } - protected void finalize () throws Throwable { + protected void finalize() throws Throwable { if (reader!=null) { reader.close(); } Modified: lucene/java/trunk/contrib/spellchecker/src/java/org/apache/lucene/search/spell/SuggestWord.java URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/spellchecker/src/java/org/apache/lucene/search/spell/SuggestWord.java?rev=415093&r1=415092&r2=415093&view=diff ============================================================================== --- lucene/java/trunk/contrib/spellchecker/src/java/org/apache/lucene/search/spell/SuggestWord.java (original) +++ lucene/java/trunk/contrib/spellchecker/src/java/org/apache/lucene/search/spell/SuggestWord.java Sat Jun 17 22:32:54 2006 @@ -18,47 +18,43 @@ */ /** - * SuggestWord Class, used in suggestSimilar method in SpellChecker class. + * SuggestWord, used in suggestSimilar method in SpellChecker class. * * @author Nicolas Maisonneuve */ - final class SuggestWord { - /** - * the score of the word - */ - public float score; - - - /** - * The freq of the word - */ - public int freq; - - - /** - * the suggested word - */ - public String string; - - - public final int compareTo (SuggestWord a) { - //first criteria: the edit distance - if (score>a.score) { - return 1; - } - if (scorea.freq) { - return 1; - } +final class SuggestWord { + /** + * the score of the word + */ + public float score; + + /** + * The freq of the word + */ + public int freq; + + /** + * the suggested word + */ + public String string; + + public final int compareTo (SuggestWord a) { + //first criteria: the edit distance + if (score > a.score) { + return 1; + } + if (score < a.score) { + return -1; + } - if (freq a.freq) { + return 1; + } - return 0; + if (freq < a.freq) { + return -1; } + return 0; + } } Modified: lucene/java/trunk/contrib/spellchecker/src/java/org/apache/lucene/search/spell/SuggestWordQueue.java URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/spellchecker/src/java/org/apache/lucene/search/spell/SuggestWordQueue.java?rev=415093&r1=415092&r2=415093&view=diff ============================================================================== --- lucene/java/trunk/contrib/spellchecker/src/java/org/apache/lucene/search/spell/SuggestWordQueue.java (original) +++ lucene/java/trunk/contrib/spellchecker/src/java/org/apache/lucene/search/spell/SuggestWordQueue.java Sat Jun 17 22:32:54 2006 @@ -17,25 +17,23 @@ * limitations under the License. */ -/** - * to sort SuggestWord - * @author Nicolas Maisonneuve - */ import org.apache.lucene.util.PriorityQueue; -final class SuggestWordQueue -extends PriorityQueue { - - SuggestWordQueue (int size) { - initialize(size); - } +/** + * Sorts SuggestWord instances + * @author Nicolas Maisonneuve + */ +final class SuggestWordQueue extends PriorityQueue { - protected final boolean lessThan (Object a, Object b) { - SuggestWord wa=(SuggestWord) a; - SuggestWord wb=(SuggestWord) b; - int val=wa.compareTo(wb); - return val<0; - } + SuggestWordQueue (int size) { + initialize(size); + } + protected final boolean lessThan (Object a, Object b) { + SuggestWord wa = (SuggestWord) a; + SuggestWord wb = (SuggestWord) b; + int val = wa.compareTo(wb); + return val < 0; + } }