public abstract class BasePhraseAnalyzer extends Object implements PhraseAnalyzer
Modifier and Type | Class and Description |
---|---|
static class |
BasePhraseAnalyzer.Entry
An entry in the phrase corpus.
|
Modifier and Type | Field and Description |
---|---|
protected org.wikibrain.core.dao.LocalPageDao |
pageDao |
protected PhraseAnalyzerDao |
phraseDao |
Constructor and Description |
---|
BasePhraseAnalyzer(PhraseAnalyzerDao phraseDao,
org.wikibrain.core.dao.LocalPageDao pageDao,
PrunedCounts.Pruner<String> phrasePruner,
PrunedCounts.Pruner<Integer> pagePruner) |
Modifier and Type | Method and Description |
---|---|
LinkedHashMap<String,Float> |
describe(org.wikibrain.core.lang.Language language,
org.wikibrain.core.model.LocalPage page,
int maxPhrases)
Returns the most descriptive phrases for a wikipedia page.
|
protected abstract Iterable<BasePhraseAnalyzer.Entry> |
getCorpus(org.wikibrain.core.lang.LanguageSet langs)
Concrete implementations must override this method to determine what phrases
are stored.
|
PhraseAnalyzerDao |
getDao() |
int |
loadCorpus(org.wikibrain.core.lang.LanguageSet langs)
Loads a specific corpus into the dao.
|
protected void |
loadFromFile(org.wikibrain.phrases.BasePhraseAnalyzer.RecordType ltype,
File input,
PrunedCounts.Pruner pruner) |
LinkedHashMap<org.wikibrain.core.lang.LocalId,Float> |
resolve(org.wikibrain.core.lang.Language language,
String phrase,
int maxPages)
Returns the most likely wikipedia pages for a phrase.
|
protected void |
writePage(List<BasePhraseAnalyzer.Entry> pageCounts,
PrunedCounts.Pruner pruner) |
protected void |
writePhrase(List<BasePhraseAnalyzer.Entry> pageCounts,
PrunedCounts.Pruner pruner) |
protected final PhraseAnalyzerDao phraseDao
protected final org.wikibrain.core.dao.LocalPageDao pageDao
public BasePhraseAnalyzer(PhraseAnalyzerDao phraseDao, org.wikibrain.core.dao.LocalPageDao pageDao, PrunedCounts.Pruner<String> phrasePruner, PrunedCounts.Pruner<Integer> pagePruner)
protected abstract Iterable<BasePhraseAnalyzer.Entry> getCorpus(org.wikibrain.core.lang.LanguageSet langs) throws IOException, org.wikibrain.core.dao.DaoException
IOException
org.wikibrain.core.dao.DaoException
public int loadCorpus(org.wikibrain.core.lang.LanguageSet langs) throws org.wikibrain.core.dao.DaoException, IOException
loadCorpus
in interface PhraseAnalyzer
org.wikibrain.core.dao.DaoException
IOException
protected void loadFromFile(org.wikibrain.phrases.BasePhraseAnalyzer.RecordType ltype, File input, PrunedCounts.Pruner pruner) throws IOException, org.wikibrain.core.dao.DaoException
IOException
org.wikibrain.core.dao.DaoException
protected void writePage(List<BasePhraseAnalyzer.Entry> pageCounts, PrunedCounts.Pruner pruner) throws org.wikibrain.core.dao.DaoException
org.wikibrain.core.dao.DaoException
protected void writePhrase(List<BasePhraseAnalyzer.Entry> pageCounts, PrunedCounts.Pruner pruner) throws org.wikibrain.core.dao.DaoException
org.wikibrain.core.dao.DaoException
public LinkedHashMap<String,Float> describe(org.wikibrain.core.lang.Language language, org.wikibrain.core.model.LocalPage page, int maxPhrases) throws org.wikibrain.core.dao.DaoException
PhraseAnalyzer
describe
in interface PhraseAnalyzer
language
- The language for the phrase and the returned LocalPages.page
- The page to be described.maxPhrases
- The maximum number of phrases to be returned.org.wikibrain.core.dao.DaoException
public LinkedHashMap<org.wikibrain.core.lang.LocalId,Float> resolve(org.wikibrain.core.lang.Language language, String phrase, int maxPages) throws org.wikibrain.core.dao.DaoException
PhraseAnalyzer
resolve
in interface PhraseAnalyzer
language
- The language for the phrase and the returned LocalPages.phrase
- The phrase to be resolved.maxPages
- The maximum number of pages to be returned.org.wikibrain.core.dao.DaoException
public PhraseAnalyzerDao getDao()
Copyright © 2018. All rights reserved.