/** * @see #get(Class, String, java.util.Map) * @param klass * @param name * @param <T> * @return * @throws ConfigurationException */ public <T> T get(Class<T> klass, String name) throws ConfigurationException { return get(klass, name, null); }
/** * Get a specific named instance of the component with the specified class. * This method can only be used when there is exactly one instance of the component. * * @param klass The generic interface or superclass, not the specific implementation. * @return The requested component. */ public <T> T get(Class<T> klass) throws ConfigurationException { return get(klass, null); }
@Override public PostGISSpatialDataDao get(String name, Config config, Map<String, String> runtimeParams) throws ConfigurationException { return new PostGISSpatialDataDao( getConfigurator().get(PostGISDB.class, config.getString("dataSource")), getConfigurator().get(WikidataDao.class), getConfigurator().get(LocalPageDao.class)); } }
public SpatialDataLoader(Env env) throws ConfigurationException, WikiBrainException { this.env = env; this.langs = env.getLanguages(); this.spatialDao = env.getConfigurator().get(SpatialDataDao.class); this.metaDao = env.getConfigurator().get(MetaInfoDao.class); this.wdDao = env.getConfigurator().get(WikidataDao.class); }
public WikiBrainServer(Env env) throws ConfigurationException, DaoException { this.env = env; this.entityParser = new WebEntityParser(env); this.pageDao = env.getConfigurator().get(LocalPageDao.class); this.linkDao = env.getConfigurator().get(LocalLinkDao.class); this.catDao = env.getConfigurator().get(LocalCategoryMemberDao.class); }
@Override public Disambiguator get(String name, Config config, Map<String, String> runtimeParams) throws ConfigurationException{ if (!config.getString("type").equals("topResult")){ return null; } return new TopResultDisambiguator( getConfigurator().get(PhraseAnalyzer.class, config.getString("phraseAnalyzer")) ); } }
@Override public PhraseAnalyzer get(String name, Config config, Map<String, String> runtimeParams) throws ConfigurationException { if (!config.getString("type").equals("lucene")) { return null; } LocalPageDao localPageDao = getConfigurator().get(LocalPageDao.class, config.getString("localPageDao")); LanguageSet langs = getConfigurator().get(LanguageSet.class); LuceneSearcher searcher = new LuceneSearcher(langs, getConfigurator().get(LuceneOptions.class)); return new LucenePhraseAnalyzer(localPageDao, searcher); } }
public LoadTimeEstimator(Env env) throws ConfigurationException, ParseException { this.env = env; this.diagnostics = env.getConfigurator().get(DiagnosticDao.class).getAll(); System.out.println("read " + this.diagnostics.size() + " diagnostics"); }
@Override public ExplanationFormatter get(String name, Config config, Map<String, String> runtimeParams) throws ConfigurationException { return new ExplanationFormatter( getConfigurator().get( LocalPageDao.class, config.getString("localpagedao")) ); } }
@Override public PostGISSpatialNeighborDao get(String name, Config config, Map<String, String> runtimeParams) throws ConfigurationException { return new PostGISSpatialNeighborDao( getConfigurator().get(PostGISDB.class, config.getString("dataSource"))); } }
@Override public PostGISSpatialContainmentDao get(String name, Config config, Map<String, String> runtimeParams) throws ConfigurationException { return new PostGISSpatialContainmentDao( getConfigurator().get(PostGISDB.class, config.getString("dataSource"))); } }
public static void main(String[] args) throws Exception { Env env = EnvBuilder.envFromArgs(args); Configurator conf = env.getConfigurator(); KNNEvaluator evaluator = new KNNEvaluator(env, new LanguageSet("simple")); SpatialDataDao sdDao = conf.get(SpatialDataDao.class); Set<Integer> originSet = new HashSet<Integer>(); originSet.add(36091);originSet.add(956);originSet.add(64);originSet.add(258);originSet.add(60);originSet.add(65);originSet.add(90);originSet.add(84);originSet.add(1490); evaluator.evaluate(originSet, 100, 5, 1, 30, "test-topo.csv"); }
public MappedShapefileLoader(Env env) throws ConfigurationException, WikiBrainException { this.env = env; this.lang = env.getLanguages().getBestAvailableEnglishLang(false); this.pageDao = env.getConfigurator().get(LocalPageDao.class); this.conceptDao = env.getConfigurator().get(UniversalPageDao.class); this.metaDao = env.getConfigurator().get(MetaInfoDao.class); this.spatialDao = env.getConfigurator().get(SpatialDataDao.class); this.folder = new SpatialDataFolder( new File(env.getConfiguration().get().getString("spatial.dir"))); }
@Override public PhraseAnalyzer get(String name, Config config, Map<String, String> runtimeParams) throws ConfigurationException { if (!config.getString("type").equals("olucene")) { return null; } LocalPageDao localPageDao = getConfigurator().get(LocalPageDao.class, config.getString("localPageDao")); LuceneSearcher searcher = new LuceneSearcher( new LanguageSet("simple"), getConfigurator().get(LuceneOptions.class)); return new LucenePhraseAnalyzer(localPageDao, searcher); }
/** * Returns a default set of LuceneOptions. * * @return a default set of LuceneOptions */ public static LuceneOptions getDefaultOptions() { try { return new Configurator(new Configuration()).get(LuceneOptions.class, "plaintext"); } catch (ConfigurationException e) { throw new RuntimeException(e); } }
public DistanceMetrics() throws ConfigurationException{ env = new EnvBuilder().build(); c = env.getConfigurator(); snDao = c.get(SpatialNeighborDao.class); }
public UniversalWord2VecMain(Env env, Language lang) throws ConfigurationException, DaoException { this.env = env; this.lang = lang; UniversalPageDao univDao = env.getConfigurator().get(UniversalPageDao.class); this.pageDao = env.getComponent(LocalPageDao.class); Map<Language, TIntIntMap> allConcepts = univDao.getAllLocalToUnivIdsMap(new LanguageSet(lang)); this.concepts = allConcepts.containsKey(lang) ? allConcepts.get(lang) : new TIntIntHashMap(); }
public DistanceMetrics() throws ConfigurationException{ env = new EnvBuilder().build(); c = env.getConfigurator(); snDao = c.get(SpatialNeighborDao.class); }
public static void main(String args[]) throws ConfigurationException, DaoException { Env env = EnvBuilder.envFromArgs(args); LocalPageDao pageDao = env.getConfigurator().get(LocalPageDao.class); // Get the default wikifier in the default language. Wikifier wikifier = env.getConfigurator().get( Wikifier.class, "websail", "language", env.getDefaultLanguage().getLangCode()); for (LocalLink link : wikifier.wikify(CORPUS)) { System.out.println("link is " + link.getAnchorText() + " is for " + pageDao.getById(link.getLanguage(), link.getDestId())); } } }