Package com.github.le11.nls.lucene.payloads

Examples of com.github.le11.nls.lucene.payloads.UIMATypeBasedSimilarity


    return stopWords;
  }

  @Override
  public TokenStream create(TokenStream input) {
    TypeAwareStopFilter stopFilter = new TypeAwareStopFilter(luceneMatchVersion, input, stopWords, ignoreCase);
    stopFilter.setEnablePositionIncrements(enablePositionIncrements);
    return stopFilter;
  }
View Full Code Here


  private boolean ignoreCase;

  public TokenStream create(TokenStream input) {
    // if the fst is null, it means there's actually no synonyms... just return the original stream
    // as there is nothing to do here.
    return map.fst == null ? input : new TypeAwareSynonymFilter(input, map, ignoreCase);
  }
View Full Code Here

  private final String[] entitiesAnnTypes = new String[]{"opennlp.uima.Person", "opennlp.uima.Location", "opennlp.uima.Organization"};

  public NLSQueryAnalyzer(CAS cas) {
    this.cas = cas;
    this.threshold = 0f;
    this.scoreMap = new TypeScoreMap();
  }
View Full Code Here

  }

  public NLSQueryAnalyzer(CAS cas, Float threshold) {
    this.cas = cas;
    this.threshold = threshold;
    this.scoreMap = new TypeScoreMap();
  }
View Full Code Here

  private static final long serialVersionUID = 1L;

  private TypeScoreMap scoreMap;

  public UIMATypeBasedSimilarity() {
    this.scoreMap = new TypeScoreMap();
  }
View Full Code Here

* @author tommaso
*/
public class StandardUIMATypeAwareTokenizerFactory extends BaseTokenizerFactory {
  @Override
  public Tokenizer create(Reader input) {
    return new UIMATypeAwareTokenizer("/HmmTaggerAggregate.xml", "org.apache.uima.TokenAnnotation", "posTag", input);
  }
View Full Code Here

    this.descriptorPath = descriptorPath;
  }

  @Override
  public final TokenStream tokenStream(String fieldName, Reader reader) {
    return new TypeAsPayloadTokenFilter(new UIMATypeAwareTokenizer(descriptorPath,
            "org.apache.uima.TokenAnnotation", "posTag", reader));
  }
View Full Code Here


  @Before
  public void setUp() throws Exception {
    dir = new RAMDirectory();
    analyzer = new UIMAPayloadsAnalyzer("/HmmTaggerAggregate.xml");
    writer = new IndexWriter(dir, new IndexWriterConfig(Version.LUCENE_33, analyzer));

    Document doc = new Document();
    doc.add(new Field("title", "this is a dummy title containing an entity for London", Field.Store.YES,
            Field.Index.ANALYZED));
View Full Code Here

  private RAMDirectory dir;

  @Before
  public void setUp() throws Exception {
    dir = new RAMDirectory();
    analyzer = new UIMAPayloadsAnalyzer("/HmmTaggerAggregate.xml");
    writer = new IndexWriter(dir, new IndexWriterConfig(Version.LUCENE_33, analyzer));
  }
View Full Code Here

  @Test
  public void baseSimilarityTest() {
    try {
      IndexSearcher searcher = new IndexSearcher(dir, true);
      Similarity payloadSimilarity = new UIMATypeBasedSimilarity();
      searcher.setSimilarity(payloadSimilarity);
//      BooleanQuery booleanQuery = new BooleanQuery();
//      booleanQuery.add(new PayloadTermQuery(new Term("title", "London"), new MaxPayloadFunction()), BooleanClause.Occur.SHOULD);
//      booleanQuery.add(new PayloadTermQuery(new Term("title", "English"), new MaxPayloadFunction()), BooleanClause.Occur.SHOULD);
//      SpanQuery[] clauses = new SpanQuery[]{new PayloadTermQuery(new Term("title","London"),new MaxPayloadFunction()),
View Full Code Here

TOP

Related Classes of com.github.le11.nls.lucene.payloads.UIMATypeBasedSimilarity

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.