@Override public void init(Map<String, String> args) { super.init(args); String maxArg = args.get("maxGramSize"); maxGramSize = (maxArg != null ? Integer.parseInt(maxArg) : EdgeNGramTokenizer.DEFAULT_MAX_GRAM_SIZE); String minArg = args.get("minGramSize"); minGramSize = (minArg != null ? Integer.parseInt(minArg) : EdgeNGramTokenizer.DEFAULT_MIN_GRAM_SIZE); side = args.get("side"); if (side == null) { side = EdgeNGramTokenizer.Side.FRONT.getLabel(); } }
/** * Creates EdgeNGramTokenizer that can generate n-grams in the sizes of the given range * * @param input {@link Reader} holding the input to be tokenized * @param sideLabel the name of the {@link Side} from which to chop off an n-gram * @param minGram the smallest n-gram to generate * @param maxGram the largest n-gram to generate */ public EdgeNGramTokenizer(Reader input, String sideLabel, int minGram, int maxGram) { this(input, Side.getSide(sideLabel), minGram, maxGram); }
/** * Creates EdgeNGramTokenizer that can generate n-grams in the sizes of the given range * * @param factory {@link org.apache.lucene.util.AttributeSource.AttributeFactory} to use * @param input {@link Reader} holding the input to be tokenized * @param sideLabel the name of the {@link Side} from which to chop off an n-gram * @param minGram the smallest n-gram to generate * @param maxGram the largest n-gram to generate */ public EdgeNGramTokenizer(AttributeFactory factory, Reader input, String sideLabel, int minGram, int maxGram) { this(factory, input, Side.getSide(sideLabel), minGram, maxGram); }
/** * Creates EdgeNGramTokenizer that can generate n-grams in the sizes of the given range * * @param source {@link AttributeSource} to use * @param input {@link Reader} holding the input to be tokenized * @param sideLabel the name of the {@link Side} from which to chop off an n-gram * @param minGram the smallest n-gram to generate * @param maxGram the largest n-gram to generate */ public EdgeNGramTokenizer(AttributeSource source, Reader input, String sideLabel, int minGram, int maxGram) { this(source, input, Side.getSide(sideLabel), minGram, maxGram); }