public class DatasetDao extends Object
Modifier and Type | Class and Description |
---|---|
static class |
DatasetDao.Info
Information about a particular dataset
|
static class |
DatasetDao.Provider |
Modifier and Type | Field and Description |
---|---|
static String |
RESOURCE_DATASET_INFO |
static String |
RESOURCE_DATSET |
Constructor and Description |
---|
DatasetDao()
Creates a new dataset dao with particular configuration information.
|
DatasetDao(Collection<DatasetDao.Info> info)
Creates a new dataset dao with particular configuration information.
|
Modifier and Type | Method and Description |
---|---|
Dataset |
get(Language language,
String name)
Reads a dataset from the classpath with a particular name.
|
List<Dataset> |
getAllInLanguage(Language lang) |
List<Dataset> |
getDatasetOrGroup(Language language,
String name) |
List<Dataset> |
getGroup(Language language,
String name)
Return all the member datasets in the specified group.
|
DatasetDao.Info |
getInfo(String name) |
boolean |
isGroup(String name)
Returns true if the name is the name of a group of datasets
|
Dataset |
read(Language language,
File path)
Reads a dataset from the classpath with a particular name.
|
protected Dataset |
read(String name,
Language language,
BufferedReader reader)
Reads a dataset from a buffered reader.
|
static Collection<DatasetDao.Info> |
readInfos()
Read the embedded info.tsv file in the classpath.
|
static Collection<DatasetDao.Info> |
readInfos(BufferedReader reader)
Returns information about datasets in a reader.
|
void |
setDisambiguator(Disambiguator dab)
Sets the internal disambiguator AND marks resolve phrases to true.
|
void |
setGroups(Map<String,List<String>> groups) |
void |
setNormalize(boolean normalize)
If true, all datasets will be "normalized" to [0,1] scores.
|
void |
setResolvePhrases(boolean resolvePhrases) |
void |
write(Dataset dataset,
File path)
Writes a dataset out to a particular path
|
public static final String RESOURCE_DATSET
public static final String RESOURCE_DATASET_INFO
public DatasetDao()
public DatasetDao(Collection<DatasetDao.Info> info)
info
- public void setNormalize(boolean normalize)
normalize
- public List<Dataset> getAllInLanguage(Language lang) throws DaoException
DaoException
public Dataset read(Language language, File path) throws DaoException
language
- The desired languagepath
- The path to the dataset.DaoException
public Dataset get(Language language, String name) throws DaoException
language
- The desired languagename
- The name of the dataset.DaoException
public boolean isGroup(String name)
name
- public List<Dataset> getGroup(Language language, String name) throws DaoException
language
- name
- DaoException
public List<Dataset> getDatasetOrGroup(Language language, String name) throws DaoException
DaoException
public DatasetDao.Info getInfo(String name)
name
- public void setDisambiguator(Disambiguator dab)
dab
- public void setResolvePhrases(boolean resolvePhrases)
resolvePhrases
- If true, phrases are resolved to local page ids
The disambiguator MUST be set as well.protected Dataset read(String name, Language language, BufferedReader reader) throws DaoException
name
- Name of the dataset, must end with csv for comma separated files.language
- Language of the dataset.reader
- The inputsource of the dataset.DaoException
public void write(Dataset dataset, File path) throws DaoException
dataset
- path
- DaoException
public static Collection<DatasetDao.Info> readInfos() throws DaoException
DaoException
public static Collection<DatasetDao.Info> readInfos(BufferedReader reader) throws DaoException
reader
- DaoException
Copyright © 2014. All rights reserved.