當前位置: 首頁>>代碼示例>>Java>>正文


Java AttributeFactory類代碼示例

本文整理匯總了Java中org.apache.lucene.util.AttributeFactory的典型用法代碼示例。如果您正苦於以下問題:Java AttributeFactory類的具體用法?Java AttributeFactory怎麽用?Java AttributeFactory使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


AttributeFactory類屬於org.apache.lucene.util包,在下文中一共展示了AttributeFactory類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: super

import org.apache.lucene.util.AttributeFactory; //導入依賴的package包/類
public PathHierarchyTokenizer
    (AttributeFactory factory, Reader input, int bufferSize, char delimiter, char replacement, int skip) {
  super(factory, input);
  if (bufferSize < 0) {
    throw new IllegalArgumentException("bufferSize cannot be negative");
  }
  if (skip < 0) {
    throw new IllegalArgumentException("skip cannot be negative");
  }
  termAtt.resizeBuffer(bufferSize);

  this.delimiter = delimiter;
  this.replacement = replacement;
  this.skip = skip;
  resultToken = new StringBuilder(bufferSize);
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:17,代碼來源:PathHierarchyTokenizer.java

示例2: super

import org.apache.lucene.util.AttributeFactory; //導入依賴的package包/類
public ReversePathHierarchyTokenizer
    (AttributeFactory factory, Reader input, int bufferSize, char delimiter, char replacement, int skip) {
  super(factory, input);
  if (bufferSize < 0) {
    throw new IllegalArgumentException("bufferSize cannot be negative");
  }
  if (skip < 0) {
    throw new IllegalArgumentException("skip cannot be negative");
  }
  termAtt.resizeBuffer(bufferSize);
  this.delimiter = delimiter;
  this.replacement = replacement;
  this.skip = skip;
  resultToken = new StringBuilder(bufferSize);
  resultTokenBuffer = new char[bufferSize];
  delimiterPositions = new ArrayList<>(bufferSize/10);
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:18,代碼來源:ReversePathHierarchyTokenizer.java

示例3: IKTokenizer

import org.apache.lucene.util.AttributeFactory; //導入依賴的package包/類
public IKTokenizer(AttributeFactory factory, boolean useSmart){
	super(factory);
	offsetAtt = addAttribute(OffsetAttribute.class);
	termAtt = addAttribute(CharTermAttribute.class);
	typeAtt = addAttribute(TypeAttribute.class);
	_IKImplement = new IKSegmenter(input , useSmart);
}
 
開發者ID:navis87,項目名稱:IKAnalyzer,代碼行數:8,代碼來源:IKTokenizer.java

示例4: PatternTokenizer

import org.apache.lucene.util.AttributeFactory; //導入依賴的package包/類
/** creates a new PatternTokenizer returning tokens from group (-1 for split functionality) */
public PatternTokenizer(AttributeFactory factory, Reader input, Pattern pattern, int group) {
  super(factory, input);
  this.group = group;

  // Use "" instead of str so don't consume chars
  // (fillBuffer) from the input on throwing IAE below:
  matcher = pattern.matcher("");

  // confusingly group count depends ENTIRELY on the pattern but is only accessible via matcher
  if (group >= 0 && group > matcher.groupCount()) {
    throw new IllegalArgumentException("invalid group specified: pattern only has: " + matcher.groupCount() + " capturing groups");
  }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:15,代碼來源:PatternTokenizer.java

示例5: create

import org.apache.lucene.util.AttributeFactory; //導入依賴的package包/類
@Override
public Tokenizer create(AttributeFactory factory, Reader input) {
  if (luceneMatchVersion.onOrAfter(Version.LUCENE_4_4_0)) {
    if (!EdgeNGramTokenFilter.Side.FRONT.getLabel().equals(side)) {
      throw new IllegalArgumentException(EdgeNGramTokenizer.class.getSimpleName() + " does not support backward n-grams as of Lucene 4.4");
    }
    return new EdgeNGramTokenizer(input, minGramSize, maxGramSize);
  } else {
    return new Lucene43EdgeNGramTokenizer(luceneMatchVersion, input, side, minGramSize, maxGramSize);
  }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:12,代碼來源:EdgeNGramTokenizerFactory.java

示例6: create

import org.apache.lucene.util.AttributeFactory; //導入依賴的package包/類
/** Creates the {@link TokenStream} of n-grams from the given {@link Reader} and {@link AttributeFactory}. */
@Override
public Tokenizer create(AttributeFactory factory, Reader input) {
  if (luceneMatchVersion.onOrAfter(Version.LUCENE_4_4_0)) {
    return new NGramTokenizer(luceneMatchVersion, factory, input, minGramSize, maxGramSize);
  } else {
    return new Lucene43NGramTokenizer(factory, input, minGramSize, maxGramSize);
  }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:10,代碼來源:NGramTokenizerFactory.java

示例7: NumericTokenStream

import org.apache.lucene.util.AttributeFactory; //導入依賴的package包/類
/**
 * Expert: Creates a token stream for numeric values with the specified
 * <code>precisionStep</code> using the given
 * {@link org.apache.lucene.util.AttributeFactory}.
 * The stream is not yet initialized,
 * before using set a value using the various set<em>???</em>Value() methods.
 */
public NumericTokenStream(AttributeFactory factory, final int precisionStep) {
  super(new NumericAttributeFactory(factory));
  if (precisionStep < 1)
    throw new IllegalArgumentException("precisionStep must be >=1");
  this.precisionStep = precisionStep;
  numericAtt.setShift(-precisionStep);
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:15,代碼來源:NumericTokenStream.java

示例8: create

import org.apache.lucene.util.AttributeFactory; //導入依賴的package包/類
@Override
public StandardTokenizer create(AttributeFactory factory, Reader input) {
  StandardTokenizer tokenizer;
  if (luceneMatchVersion == null) {
    tokenizer = new StandardTokenizer(factory, input);
  } else {
    tokenizer = new StandardTokenizer(luceneMatchVersion, factory, input);
  }
  tokenizer.setMaxTokenLength(maxTokenLength);
  return tokenizer;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:12,代碼來源:StandardTokenizerFactory.java

示例9: create

import org.apache.lucene.util.AttributeFactory; //導入依賴的package包/類
@Override
public ClassicTokenizer create(AttributeFactory factory, Reader input) {
  ClassicTokenizer tokenizer;
  if (luceneMatchVersion == null) {
    tokenizer = new ClassicTokenizer(factory, input);
  } else {
    tokenizer = new ClassicTokenizer(luceneMatchVersion, factory, input);
  }
  tokenizer.setMaxTokenLength(maxTokenLength);
  return tokenizer;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:12,代碼來源:ClassicTokenizerFactory.java

示例10: create

import org.apache.lucene.util.AttributeFactory; //導入依賴的package包/類
@Override
public UAX29URLEmailTokenizer create(AttributeFactory factory, Reader input) {
  UAX29URLEmailTokenizer tokenizer;
  if (luceneMatchVersion == null) {
    tokenizer = new UAX29URLEmailTokenizer(factory, input);
  } else {
    tokenizer = new UAX29URLEmailTokenizer(luceneMatchVersion, factory, input);
  }
  tokenizer.setMaxTokenLength(maxTokenLength);
  return tokenizer;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:12,代碼來源:UAX29URLEmailTokenizerFactory.java

示例11: Tokenizer

import org.apache.lucene.util.AttributeFactory; //導入依賴的package包/類
/** Construct a token stream processing the given input using the given AttributeFactory. */
protected Tokenizer(AttributeFactory factory, Reader input) {
  super(factory);
  if (input == null) {
    throw new NullPointerException("input must not be null");
  }
  this.inputPending = input;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:9,代碼來源:Tokenizer.java

示例12: ThaiTokenizer

import org.apache.lucene.util.AttributeFactory; //導入依賴的package包/類
/** Creates a new ThaiTokenizer, supplying the AttributeFactory */
public ThaiTokenizer(AttributeFactory factory, Reader reader) {
  super(factory, reader, (BreakIterator)sentenceProto.clone());
  if (!DBBI_AVAILABLE) {
    throw new UnsupportedOperationException("This JRE does not have support for Thai segmentation");
  }
  wordBreaker = (BreakIterator)proto.clone();
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:9,代碼來源:ThaiTokenizer.java

示例13: CharTokenizer

import org.apache.lucene.util.AttributeFactory; //導入依賴的package包/類
/**
 * @deprecated Use {@link #CharTokenizer(AttributeFactory, Reader)}
 */
@Deprecated
public CharTokenizer(Version matchVersion, AttributeFactory factory,
    Reader input) {
  super(factory, input);
  charUtils = CharacterUtils.getInstance(matchVersion);
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:10,代碼來源:CharTokenizer.java

示例14: create

import org.apache.lucene.util.AttributeFactory; //導入依賴的package包/類
@Override
public WhitespaceTokenizer create(AttributeFactory factory, Reader input) {
  if (luceneMatchVersion == null) {
    return new WhitespaceTokenizer(factory, input);
  }
  return new WhitespaceTokenizer(luceneMatchVersion, factory, input);
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:8,代碼來源:WhitespaceTokenizerFactory.java

示例15: KeywordTokenizer

import org.apache.lucene.util.AttributeFactory; //導入依賴的package包/類
public KeywordTokenizer(AttributeFactory factory, Reader input, int bufferSize) {
  super(factory, input);
  if (bufferSize <= 0) {
    throw new IllegalArgumentException("bufferSize must be > 0");
  }
  termAtt.resizeBuffer(bufferSize);
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:8,代碼來源:KeywordTokenizer.java


注:本文中的org.apache.lucene.util.AttributeFactory類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。