mirror of https://github.com/apache/lucene.git
LUCENE-3902: start enforcing class javadocs for modules that don't have problems
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1332696 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a762414610
commit
5ede77e922
|
@ -21,6 +21,9 @@ import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstraction for loading resources (streams, files, and classes).
|
||||||
|
*/
|
||||||
public interface ResourceLoader {
|
public interface ResourceLoader {
|
||||||
|
|
||||||
public InputStream openResource(String resource) throws IOException;
|
public InputStream openResource(String resource) throws IOException;
|
||||||
|
|
|
@ -17,6 +17,12 @@
|
||||||
|
|
||||||
package org.apache.lucene.analysis.util;
|
package org.apache.lucene.analysis.util;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface for a component that needs to be initialized by
|
||||||
|
* an implementation of {@link ResourceLoader}.
|
||||||
|
*
|
||||||
|
* @see ResourceLoader
|
||||||
|
*/
|
||||||
public interface ResourceLoaderAware {
|
public interface ResourceLoaderAware {
|
||||||
|
|
||||||
void inform(ResourceLoader loader);
|
void inform(ResourceLoader loader);
|
||||||
|
|
|
@ -33,6 +33,15 @@ package org.tartarus.snowball;
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the rev 502 of the Snowball SVN trunk,
|
||||||
|
* but modified:
|
||||||
|
* made abstract and introduced abstract method stem to avoid expensive reflection in filter class.
|
||||||
|
* refactored StringBuffers to StringBuilder
|
||||||
|
* uses char[] as buffer instead of StringBuffer/StringBuilder
|
||||||
|
* eq_s,eq_s_b,insert,replace_s take CharSequence like eq_v and eq_v_b
|
||||||
|
* reflection calls (Lovins, etc) use EMPTY_ARGS/EMPTY_PARAMS
|
||||||
|
*/
|
||||||
public class Among {
|
public class Among {
|
||||||
private static final Class<?>[] EMPTY_PARAMS = new Class[0];
|
private static final Class<?>[] EMPTY_PARAMS = new Class[0];
|
||||||
public Among (String s, int substring_i, int result,
|
public Among (String s, int substring_i, int result,
|
||||||
|
|
|
@ -1,108 +0,0 @@
|
||||||
/*
|
|
||||||
|
|
||||||
Copyright (c) 2001, Dr Martin Porter
|
|
||||||
Copyright (c) 2002, Richard Boulton
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the following conditions are met:
|
|
||||||
|
|
||||||
* Redistributions of source code must retain the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* Neither the name of the copyright holders nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
|
||||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.tartarus.snowball;
|
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.io.Reader;
|
|
||||||
import java.io.Writer;
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.BufferedWriter;
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.io.OutputStreamWriter;
|
|
||||||
import java.io.OutputStream;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
|
|
||||||
public class TestApp {
|
|
||||||
private static void usage()
|
|
||||||
{
|
|
||||||
System.err.println("Usage: TestApp <algorithm> <input file> [-o <output file>]");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String [] args) throws Throwable {
|
|
||||||
if (args.length < 2) {
|
|
||||||
usage();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Class<? extends SnowballProgram> stemClass = Class.forName("org.tartarus.snowball.ext." +
|
|
||||||
args[0] + "Stemmer").asSubclass(SnowballProgram.class);
|
|
||||||
SnowballProgram stemmer = stemClass.newInstance();
|
|
||||||
Method stemMethod = stemClass.getMethod("stem", new Class[0]);
|
|
||||||
|
|
||||||
Reader reader;
|
|
||||||
reader = new InputStreamReader(new FileInputStream(args[1]));
|
|
||||||
reader = new BufferedReader(reader);
|
|
||||||
|
|
||||||
StringBuffer input = new StringBuffer();
|
|
||||||
|
|
||||||
OutputStream outstream;
|
|
||||||
|
|
||||||
if (args.length > 2) {
|
|
||||||
if (args.length == 4 && args[2].equals("-o")) {
|
|
||||||
outstream = new FileOutputStream(args[3]);
|
|
||||||
} else {
|
|
||||||
usage();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
outstream = System.out;
|
|
||||||
}
|
|
||||||
Writer output = new OutputStreamWriter(outstream);
|
|
||||||
output = new BufferedWriter(output);
|
|
||||||
|
|
||||||
int repeat = 1;
|
|
||||||
if (args.length > 4) {
|
|
||||||
repeat = Integer.parseInt(args[4]);
|
|
||||||
}
|
|
||||||
|
|
||||||
Object [] emptyArgs = new Object[0];
|
|
||||||
int character;
|
|
||||||
while ((character = reader.read()) != -1) {
|
|
||||||
char ch = (char) character;
|
|
||||||
if (Character.isWhitespace(ch)) {
|
|
||||||
if (input.length() > 0) {
|
|
||||||
stemmer.setCurrent(input.toString());
|
|
||||||
for (int i = repeat; i != 0; i--) {
|
|
||||||
stemMethod.invoke(stemmer, emptyArgs);
|
|
||||||
}
|
|
||||||
output.write(stemmer.getCurrent());
|
|
||||||
output.write('\n');
|
|
||||||
input.delete(0, input.length());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
input.append(Character.toLowerCase(ch));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
output.flush();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -100,9 +100,21 @@ public final class JapaneseTokenizer extends Tokenizer {
|
||||||
*/
|
*/
|
||||||
public static final Mode DEFAULT_MODE = Mode.SEARCH;
|
public static final Mode DEFAULT_MODE = Mode.SEARCH;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Token type reflecting the original source of this token
|
||||||
|
*/
|
||||||
public enum Type {
|
public enum Type {
|
||||||
|
/**
|
||||||
|
* Known words from the system dictionary.
|
||||||
|
*/
|
||||||
KNOWN,
|
KNOWN,
|
||||||
|
/**
|
||||||
|
* Unknown words (heuristically segmented).
|
||||||
|
*/
|
||||||
UNKNOWN,
|
UNKNOWN,
|
||||||
|
/**
|
||||||
|
* Known words from the user dictionary.
|
||||||
|
*/
|
||||||
USER
|
USER
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@ package org.apache.lucene.analysis.morfologik;
|
||||||
import org.apache.lucene.util.AttributeImpl;
|
import org.apache.lucene.util.AttributeImpl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Morphosyntactic annotations for surface forms.
|
||||||
* @see MorphosyntacticTagAttribute
|
* @see MorphosyntacticTagAttribute
|
||||||
*/
|
*/
|
||||||
public class MorphosyntacticTagAttributeImpl extends AttributeImpl
|
public class MorphosyntacticTagAttributeImpl extends AttributeImpl
|
||||||
|
|
|
@ -194,6 +194,34 @@
|
||||||
<check-broken-links dir="build/docs"/>
|
<check-broken-links dir="build/docs"/>
|
||||||
<!-- TODO: change this level=class -->
|
<!-- TODO: change this level=class -->
|
||||||
<check-missing-javadocs dir="build/docs" level="package"/>
|
<check-missing-javadocs dir="build/docs" level="package"/>
|
||||||
|
<!-- too many classes to fix overall to just enable
|
||||||
|
the above to be level="class" right now, but we
|
||||||
|
can prevent the modules that don't have problems
|
||||||
|
from getting any worse -->
|
||||||
|
<check-missing-javadocs dir="build/docs/analyzers-common" level="class"/>
|
||||||
|
<check-missing-javadocs dir="build/docs/analyzers-icu" level="class"/>
|
||||||
|
<check-missing-javadocs dir="build/docs/analyzers-kuromoji" level="class"/>
|
||||||
|
<check-missing-javadocs dir="build/docs/analyzers-kuromoji" level="class"/>
|
||||||
|
<check-missing-javadocs dir="build/docs/analyzers-morfologik" level="class"/>
|
||||||
|
<check-missing-javadocs dir="build/docs/analyzers-phonetic" level="class"/>
|
||||||
|
<check-missing-javadocs dir="build/docs/analyzers-smartcn" level="class"/>
|
||||||
|
<check-missing-javadocs dir="build/docs/analyzers-stempel" level="class"/>
|
||||||
|
<check-missing-javadocs dir="build/docs/analyzers-uima" level="class"/>
|
||||||
|
<!-- benchmark: problems -->
|
||||||
|
<!-- core: problems -->
|
||||||
|
<!-- demo: problems -->
|
||||||
|
<!-- facet: problems -->
|
||||||
|
<!-- grouping: problems -->
|
||||||
|
<!-- highlighter: problems -->
|
||||||
|
<check-missing-javadocs dir="build/docs/join" level="class"/>
|
||||||
|
<check-missing-javadocs dir="build/docs/memory" level="class"/>
|
||||||
|
<!-- misc: problems -->
|
||||||
|
<!-- queries: problems -->
|
||||||
|
<!-- queryparser: problems -->
|
||||||
|
<!-- sandbox: problems -->
|
||||||
|
<!-- spatial: problems -->
|
||||||
|
<!-- suggest: problems -->
|
||||||
|
<!-- test-framework: problems -->
|
||||||
</sequential>
|
</sequential>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue