lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From o...@apache.org
Subject svn commit: r657281 - /lucene/java/trunk/contrib/analyzers/src/java/org/apache/lucene/analysis/shingle/ShingleAnalyzerWrapper.java
Date Sat, 17 May 2008 01:57:32 GMT
Author: otis
Date: Fri May 16 18:57:32 2008
New Revision: 657281

URL: http://svn.apache.org/viewvc?rev=657281&view=rev
Log:
- Fixed messed up indentation/tabs

Modified:
    lucene/java/trunk/contrib/analyzers/src/java/org/apache/lucene/analysis/shingle/ShingleAnalyzerWrapper.java

Modified: lucene/java/trunk/contrib/analyzers/src/java/org/apache/lucene/analysis/shingle/ShingleAnalyzerWrapper.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/analyzers/src/java/org/apache/lucene/analysis/shingle/ShingleAnalyzerWrapper.java?rev=657281&r1=657280&r2=657281&view=diff
==============================================================================
--- lucene/java/trunk/contrib/analyzers/src/java/org/apache/lucene/analysis/shingle/ShingleAnalyzerWrapper.java
(original)
+++ lucene/java/trunk/contrib/analyzers/src/java/org/apache/lucene/analysis/shingle/ShingleAnalyzerWrapper.java
Fri May 16 18:57:32 2008
@@ -24,37 +24,41 @@
 import org.apache.lucene.analysis.standard.StandardAnalyzer;
 
 /**
- * A ShingleAnalyzerWrapper wraps a ShingleFilter around another analyzer.  A shingle is
another term for a token based
- * n-gram.
+ * A ShingleAnalyzerWrapper wraps a ShingleFilter around another analyzer. A
+ * shingle is another namefor a token based n-gram.
  */
 public class ShingleAnalyzerWrapper extends Analyzer {
 
-	protected Analyzer defaultAnalyzer;
-	protected int maxShingleSize = 2;
-	protected boolean outputUnigrams = true;
-
-	public ShingleAnalyzerWrapper(Analyzer defaultAnalyzer) {
-		super();
-		this.defaultAnalyzer = defaultAnalyzer;
-	}
-
-	public ShingleAnalyzerWrapper(Analyzer defaultAnalyzer, int maxShingleSize) {
-		this(defaultAnalyzer);
-		this.maxShingleSize = maxShingleSize;
-	}
-
-	public ShingleAnalyzerWrapper() {
-		super();
-		this.defaultAnalyzer = new StandardAnalyzer();
-	}
-
-	public ShingleAnalyzerWrapper(int nGramSize) {
-		this();
-		this.maxShingleSize = nGramSize;
-	}
+  protected Analyzer defaultAnalyzer;
+  protected int maxShingleSize = 2;
+  protected boolean outputUnigrams = true;
+
+  public ShingleAnalyzerWrapper(Analyzer defaultAnalyzer) {
+    super();
+    this.defaultAnalyzer = defaultAnalyzer;
+  }
+
+  public ShingleAnalyzerWrapper(Analyzer defaultAnalyzer, int maxShingleSize) {
+    this(defaultAnalyzer);
+    this.maxShingleSize = maxShingleSize;
+  }
+
+  /**
+   * Wraps {@link StandardAnalyzer}. 
+   */
+  public ShingleAnalyzerWrapper() {
+    super();
+    this.defaultAnalyzer = new StandardAnalyzer();
+  }
+
+  public ShingleAnalyzerWrapper(int nGramSize) {
+    this();
+    this.maxShingleSize = nGramSize;
+  }
 
   /**
    * The max shingle (ngram) size
+   * 
    * @return The max shingle (ngram) size
    */
   public int getMaxShingleSize() {
@@ -62,14 +66,13 @@
   }
 
   /**
-   * Set the maximum size of output shingles (default: 2)
-   *
+   * Set the maximum size of output shingles
+   * 
    * @param maxShingleSize max shingle size
    */
-	public void setMaxShingleSize(int maxShingleSize) {
-		this.maxShingleSize = maxShingleSize;
-	}
-
+  public void setMaxShingleSize(int maxShingleSize) {
+    this.maxShingleSize = maxShingleSize;
+  }
 
   public boolean isOutputUnigrams() {
     return outputUnigrams;
@@ -77,20 +80,20 @@
 
   /**
    * Shall the filter pass the original tokens (the "unigrams") to the output
-   * stream? (default: true)
-   *
+   * stream?
+   * 
    * @param outputUnigrams Whether or not the filter shall pass the original
-   *                       tokens to the output stream
+   *        tokens to the output stream
    */
-	public void setOutputUnigrams(boolean outputUnigrams) {
-		this.outputUnigrams = outputUnigrams;
-	}
-
-	public TokenStream tokenStream(String fieldName, Reader reader) {
-		ShingleFilter filter
-      = new ShingleFilter(defaultAnalyzer.tokenStream(fieldName, reader));
-		filter.setMaxShingleSize(maxShingleSize);
-	  filter.setOutputUnigrams(outputUnigrams);
+  public void setOutputUnigrams(boolean outputUnigrams) {
+    this.outputUnigrams = outputUnigrams;
+  }
+
+  public TokenStream tokenStream(String fieldName, Reader reader) {
+    ShingleFilter filter = new ShingleFilter(defaultAnalyzer.tokenStream(
+        fieldName, reader));
+    filter.setMaxShingleSize(maxShingleSize);
+    filter.setOutputUnigrams(outputUnigrams);
     return filter;
   }
 }



Mime
View raw message