Package de.julielab.genemapper.disambig
Class SemanticContextIndex
- java.lang.Object
-
- de.julielab.genemapper.disambig.SemanticContextIndex
-
- All Implemented Interfaces:
SemanticIndex
public class SemanticContextIndex extends Object implements SemanticIndex
-
-
Field Summary
Fields Modifier and Type Field Description org.apache.lucene.search.IndexSearchersearcher
-
Constructor Summary
Constructors Constructor Description SemanticContextIndex(File indexDir)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description de.julielab.geneexpbase.candidateretrieval.SynHitdoDisambiguation(List<de.julielab.geneexpbase.candidateretrieval.SynHit> filteredCandidates, org.apache.lucene.search.Query query)does semantic disambiguation, takes best onede.julielab.geneexpbase.candidateretrieval.SynHitdoDisambiguation(List<de.julielab.geneexpbase.candidateretrieval.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 thresholdde.julielab.geneexpbase.candidateretrieval.SynHitdoSeparateDisambiguation(ArrayList<de.julielab.geneexpbase.candidateretrieval.SynHit> disambigList, 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(List<de.julielab.geneexpbase.candidateretrieval.SynHit> hits, Map<String,de.julielab.geneexpbase.candidateretrieval.SynHit> id2Hit, org.apache.lucene.search.Query query)org.apache.lucene.search.IndexSearchergetSemanticIndexSearcher()org.apache.lucene.search.BooleanQuerymakeContextQuery(String context)org.apache.lucene.search.QuerymakeQuery(String[] allowedIDs, org.apache.lucene.search.Query query)org.apache.lucene.search.BooleanQuerymakeQuery(String allowedID, org.apache.lucene.search.BooleanQuery contextQuery)org.apache.lucene.search.BooleanQuerymakeSeparateQuery(String id, 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.Map<String,String>retrieveGeneContexts(List<de.julielab.geneexpbase.candidateretrieval.SynHit> candidates)
-
-
-
Constructor Detail
-
SemanticContextIndex
public SemanticContextIndex(File indexDir) throws IOException
- Throws:
IOException
-
-
Method Detail
-
doDisambiguation
public de.julielab.geneexpbase.candidateretrieval.SynHit doDisambiguation(List<de.julielab.geneexpbase.candidateretrieval.SynHit> filteredCandidates, org.apache.lucene.search.Query query) throws IOException
does semantic disambiguation, takes best one- Throws:
IOException
-
doDisambiguation
public de.julielab.geneexpbase.candidateretrieval.SynHit doDisambiguation(List<de.julielab.geneexpbase.candidateretrieval.SynHit> filteredCandidates, org.apache.lucene.search.Query query, double minContextScore) throws IOException
does semantic disambiguation, takes best one if its semantic score is above or equals minScore threshold- Throws:
IOException
-
retrieveGeneContexts
public Map<String,String> retrieveGeneContexts(List<de.julielab.geneexpbase.candidateretrieval.SynHit> candidates) throws IOException
- Throws:
IOException
-
getContextForSynHits
public org.apache.lucene.search.TopDocs getContextForSynHits(List<de.julielab.geneexpbase.candidateretrieval.SynHit> hits, Map<String,de.julielab.geneexpbase.candidateretrieval.SynHit> id2Hit, org.apache.lucene.search.Query query) throws IOException
- Throws:
IOException
-
makeContextQuery
public org.apache.lucene.search.BooleanQuery makeContextQuery(String context) throws IOException
- Throws:
IOException
-
makeQuery
public org.apache.lucene.search.Query makeQuery(String[] allowedIDs, org.apache.lucene.search.Query query) throws IOException
- Throws:
IOException
-
makeQuery
public org.apache.lucene.search.BooleanQuery makeQuery(String allowedID, org.apache.lucene.search.BooleanQuery contextQuery) throws IOException
- Parameters:
allowedID- -- only one id is passedcontextQuery- -- the context query- Returns:
- BooleanQuery
- Throws:
IOException
-
doSeparateDisambiguation
public de.julielab.geneexpbase.candidateretrieval.SynHit doSeparateDisambiguation(ArrayList<de.julielab.geneexpbase.candidateretrieval.SynHit> disambigList, String context, double minContextScore) throws IOException
does semantic disambiguation on eachSynHitseparately, takes best one if its semantic score is above or equals minScore threshold- Throws:
IOException
-
makeSeparateQuery
public org.apache.lucene.search.BooleanQuery makeSeparateQuery(String id, String context) throws IOException
generates 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:
IOException
-
getSemanticIndexSearcher
public org.apache.lucene.search.IndexSearcher getSemanticIndexSearcher()
-
-