Class SemanticContextIndex
- java.lang.Object
-
- de.julielab.jules.ae.genemapping.disambig.SemanticContextIndex
-
- All Implemented Interfaces:
SemanticIndex
public class SemanticContextIndex extends java.lang.Object implements SemanticIndex
-
-
Field Summary
Fields Modifier and Type Field Description org.apache.lucene.search.IndexSearchersearcher
-
Constructor Summary
Constructors Constructor Description SemanticContextIndex(java.io.File indexDir)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SynHitdoDisambiguation(java.util.List<SynHit> filteredCandidates, org.apache.lucene.search.Query query)does semantic disambiguation, takes best oneSynHitdoDisambiguation(java.util.List<SynHit> filteredCandidates, org.apache.lucene.search.Query query, double minContextScore)does semantic disambiguation, takes best one if its semantic score is above or equals minScore thresholdSynHitdoSeparateDisambiguation(java.util.ArrayList<SynHit> disambigList, java.lang.String context, double minContextScore)does semantic disambiguation on eachSynHitseparately, takes best one if its semantic score is above or equals minScore thresholdorg.apache.lucene.search.TopDocsgetContextForSynHits(java.util.List<SynHit> hits, java.util.Map<java.lang.String,SynHit> id2Hit, org.apache.lucene.search.Query query)org.apache.lucene.search.IndexSearchergetSemanticIndexSearcher()org.apache.lucene.search.BooleanQuerymakeContextQuery(java.lang.String context)org.apache.lucene.search.QuerymakeQuery(java.lang.String[] allowedIDs, org.apache.lucene.search.Query query)org.apache.lucene.search.BooleanQuerymakeQuery(java.lang.String allowedID, org.apache.lucene.search.BooleanQuery contextQuery)org.apache.lucene.search.BooleanQuerymakeSeparateQuery(java.lang.String id, java.lang.String context)generates a boolean query from the context and a single ids: the id has to match and the context is combined by OR.java.util.Map<java.lang.String,java.lang.String>retrieveGeneContexts(java.util.List<SynHit> candidates)
-
-
-
Method Detail
-
doDisambiguation
public SynHit doDisambiguation(java.util.List<SynHit> filteredCandidates, org.apache.lucene.search.Query query) throws java.io.IOException
does semantic disambiguation, takes best one- Throws:
java.io.IOException
-
doDisambiguation
public SynHit doDisambiguation(java.util.List<SynHit> filteredCandidates, org.apache.lucene.search.Query query, double minContextScore) throws java.io.IOException
does semantic disambiguation, takes best one if its semantic score is above or equals minScore threshold- Throws:
java.io.IOException
-
retrieveGeneContexts
public java.util.Map<java.lang.String,java.lang.String> retrieveGeneContexts(java.util.List<SynHit> candidates) throws java.io.IOException, org.apache.lucene.index.CorruptIndexException
- Throws:
java.io.IOExceptionorg.apache.lucene.index.CorruptIndexException
-
getContextForSynHits
public org.apache.lucene.search.TopDocs getContextForSynHits(java.util.List<SynHit> hits, java.util.Map<java.lang.String,SynHit> id2Hit, org.apache.lucene.search.Query query) throws java.io.IOException
- Throws:
java.io.IOException
-
makeContextQuery
public org.apache.lucene.search.BooleanQuery makeContextQuery(java.lang.String context) throws java.io.IOException- Throws:
java.io.IOException
-
makeQuery
public org.apache.lucene.search.Query makeQuery(java.lang.String[] allowedIDs, org.apache.lucene.search.Query query) throws java.io.IOException- Throws:
java.io.IOException
-
makeQuery
public org.apache.lucene.search.BooleanQuery makeQuery(java.lang.String allowedID, org.apache.lucene.search.BooleanQuery contextQuery) throws java.io.IOException- Parameters:
allowedID- -- only one id is passedcontextQuery- -- the context query- Returns:
- BooleanQuery
- Throws:
java.io.IOException
-
doSeparateDisambiguation
public SynHit doSeparateDisambiguation(java.util.ArrayList<SynHit> disambigList, java.lang.String context, double minContextScore) throws java.io.IOException
does semantic disambiguation on eachSynHitseparately, takes best one if its semantic score is above or equals minScore threshold- Throws:
java.io.IOException
-
makeSeparateQuery
public org.apache.lucene.search.BooleanQuery makeSeparateQuery(java.lang.String id, java.lang.String context) throws java.io.IOExceptiongenerates a boolean query from the context and a single ids: the id has to match and the context is combined by OR. TODO requires testing!- Throws:
java.io.IOException
-
getSemanticIndexSearcher
public org.apache.lucene.search.IndexSearcher getSemanticIndexSearcher()
-
-