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


Java AttributeSource.getAttribute方法代碼示例

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


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

示例1: setAttributeSource

import org.apache.lucene.util.AttributeSource; //導入方法依賴的package包/類
/**
 * Sets attributeSource to a new instance.
 */
void setAttributeSource(AttributeSource attributeSource) {
  if (this.attributeSource != attributeSource) {
    this.attributeSource = attributeSource;
    termAttribute = attributeSource.getAttribute(TermToBytesRefAttribute.class);
    posIncrAttribute = attributeSource.addAttribute(PositionIncrementAttribute.class);
    offsetAttribute = attributeSource.addAttribute(OffsetAttribute.class);
    payloadAttribute = attributeSource.getAttribute(PayloadAttribute.class);
  }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:13,代碼來源:FieldInvertState.java

示例2: match

import org.apache.lucene.util.AttributeSource; //導入方法依賴的package包/類
private SlowSynonymMap match(SlowSynonymMap map) throws IOException {
  SlowSynonymMap result = null;

  if (map.submap != null) {
    AttributeSource tok = nextTok();
    if (tok != null) {
      // clone ourselves.
      if (tok == this)
        tok = cloneAttributes();
      // check for positionIncrement!=1?  if>1, should not match, if==0, check multiple at this level?
      CharTermAttribute termAtt = tok.getAttribute(CharTermAttribute.class);
      SlowSynonymMap subMap = map.submap.get(termAtt.buffer(), 0, termAtt.length());

      if (subMap != null) {
        // recurse
        result = match(subMap);
      }

      if (result != null) {
        matched.addFirst(tok);
      } else {
        // push back unmatched token
        pushTok(tok);
      }
    }
  }

  // if no longer sequence matched, so if this node has synonyms, it's the match.
  if (result==null && map.synonyms!=null) {
    result = map;
  }

  return result;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:35,代碼來源:SlowSynonymFilter.java

示例3: appendPayloads

import org.apache.lucene.util.AttributeSource; //導入方法依賴的package包/類
private void appendPayloads(String[] tags, int length) {
    for (int i = 0; i < length; i++) {
        AttributeSource attrs = tokenAttrs.get(i);
        if (tags[i] != null) {
            try {
                PayloadAttribute payloadAtt = attrs.hasAttribute(PayloadAttribute.class) ? attrs.getAttribute(PayloadAttribute.class) : attrs.addAttribute(PayloadAttribute.class);
                BytesRef bytesRef = new BytesRef(tags[i].toUpperCase(Locale.getDefault()).getBytes("UTF-8"));
                payloadAtt.setPayload(bytesRef);
            } catch (UnsupportedEncodingException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
 
開發者ID:jprante,項目名稱:elasticsearch-analysis-opennlp,代碼行數:15,代碼來源:OpenNLPTokenFilter.java

示例4: InputWindowToken

import org.apache.lucene.util.AttributeSource; //導入方法依賴的package包/類
public InputWindowToken(AttributeSource attSource) {
  this.attSource = attSource;
  this.termAtt = attSource.getAttribute(CharTermAttribute.class);
  this.offsetAtt = attSource.getAttribute(OffsetAttribute.class);
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:6,代碼來源:ShingleFilter.java

示例5: accept

import org.apache.lucene.util.AttributeSource; //導入方法依賴的package包/類
@Override
public boolean accept(AttributeSource a) {
  CharTermAttribute termAtt = a.getAttribute(CharTermAttribute.class);
  return termAtt.toString().equalsIgnoreCase("The");
}
 
開發者ID:europeana,項目名稱:search,代碼行數:6,代碼來源:TestTeeSinkTokenFilter.java

示例6: InputWindowToken

import org.apache.lucene.util.AttributeSource; //導入方法依賴的package包/類
public InputWindowToken(AttributeSource attSource) {
    this.attSource = attSource;
    this.termAtt = attSource.getAttribute(CharTermAttribute.class);
    this.offsetAtt = attSource.getAttribute(OffsetAttribute.class);
    this.sentenceContext = attSource.getAttribute(PayloadAttribute.class);
}
 
開發者ID:ziqizhang,項目名稱:jate,代碼行數:7,代碼來源:ComplexShingleFilter.java


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