public static void main(String args[]) throws ConfigurationException, DaoException, InterruptedException { Env env = EnvBuilder.envFromArgs(args); if (env == null) { return; } LoadedStats ls = new LoadedStats(env); Thread.currentThread().sleep(1000); ls.print(); } }
public static void main(String args[]) throws ConfigurationException, DaoException, InterruptedException { Env env = EnvBuilder.envFromArgs(args); if (env == null) { return; } LoadedStats ls = new LoadedStats(env); Thread.currentThread().sleep(1000); ls.print(); } }
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 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 static void main(String args[]) throws Exception { Env env = EnvBuilder.envFromArgs(args); ShapeFileMatcher matcher = new ShapeFileMatcher(env); matcher.match("earth", "marine", "naturalEarth"); } }
public static void main(String args[]) throws ConfigurationException, ParseException, IOException { Env env = EnvBuilder.envFromArgs(args); LoadTimeEstimator fitter = new LoadTimeEstimator(env); fitter.writeAllData("timings.csv"); } }
public static void printNonEarthLayer(String[] args){ try { // do basic setup Env env = EnvBuilder.envFromArgs(args); Configurator c = env.getConfigurator(); SpatialDataDao sdDao = c.get(SpatialDataDao.class); Map<Integer, Geometry> geoms = sdDao.getAllGeometriesInLayer(Layers.ELEMENTS, RefSys.PERIODIC_TABLE); for (Integer wdId : geoms.keySet()){ System.out.println("Found wikidata id = " + wdId); } }catch(Exception e){ e.printStackTrace(); } }
public static void main(String args[]) throws Exception { Env env = EnvBuilder.envFromArgs(args); ShapeFileMatcher matcher = new ShapeFileMatcher(env); matcher.match("earth", "marine", "naturalEarth"); } }
public static void printNonEarthLayer(String[] args){ try { // do basic setup Env env = EnvBuilder.envFromArgs(args); Configurator c = env.getConfigurator(); SpatialDataDao sdDao = c.get(SpatialDataDao.class); Map<Integer, Geometry> geoms = sdDao.getAllGeometriesInLayer(Layers.ELEMENTS, RefSys.PERIODIC_TABLE); for (Integer wdId : geoms.keySet()){ System.out.println("Found wikidata id = " + wdId); } }catch(Exception e){ e.printStackTrace(); } }
public static void main(String args[]) throws ConfigurationException, ParseException, IOException { Env env = EnvBuilder.envFromArgs(args); LoadTimeEstimator fitter = new LoadTimeEstimator(env); fitter.writeAllData("timings.csv"); } }
public static void main(String[] args) throws Exception { Env env = EnvBuilder.envFromArgs(args); SimpleToblersLawEvaluator eval = new SimpleToblersLawEvaluator(env); eval.retrieveLocations(); eval.evaluate(new File("toblers_eval.tsv"), NUM_SAMPLES); } }
public static void main(String[] args) throws Exception { Env env = EnvBuilder.envFromArgs(args); SimpleToblersLawEvaluator eval = new SimpleToblersLawEvaluator(env); eval.retrieveLocations(); eval.evaluate(new File("toblers_eval.tsv"), NUM_SAMPLES); } }
public static void main(String args[]) throws ConfigurationException, DaoException, IOException { Env env = EnvBuilder.envFromArgs(args); Configurator c = env.getConfigurator(); MilneWittenWikifier w = c.get(MilneWittenWikifier.class, "default", "language", "simple"); w.testWikify(); } }
public static void main(String args[]) throws ConfigurationException, DaoException { // The following ten-line dance to get an env is awkward and repeated over and over. // Figure out a good way to consolidate it. Env env = EnvBuilder.envFromArgs(args); Configurator configurator = env.getConfigurator(); LocalPageDao lpDao = configurator.get(LocalPageDao.class); LocalLinkDao sqlDao = configurator.get(LocalLinkDao.class, "sql"); Language simple = env.getLanguages().getDefaultLanguage(); LocalPage page = lpDao.getByTitle(new Title("List of Soundgarden band members", simple), NameSpace.ARTICLE); System.out.println("page is " + page); DaoFilter filter = new DaoFilter().setSourceIds(page.getLocalId()).setLanguages(simple); for (LocalLink link : sqlDao.get(filter)) { System.out.println("link is: " + link); } } }
public static void main(String args[]) throws ConfigurationException, DaoException { // The following ten-line dance to get an env is awkward and repeated over and over. // Figure out a good way to consolidate it. Env env = EnvBuilder.envFromArgs(args); Configurator configurator = env.getConfigurator(); LocalPageDao lpDao = configurator.get(LocalPageDao.class); LocalLinkDao sqlDao = configurator.get(LocalLinkDao.class, "sql"); Language simple = env.getLanguages().getDefaultLanguage(); LocalPage page = lpDao.getByTitle(new Title("List of Soundgarden band members", simple), NameSpace.ARTICLE); System.out.println("page is " + page); DaoFilter filter = new DaoFilter().setSourceIds(page.getLocalId()).setLanguages(simple); for (LocalLink link : sqlDao.get(filter)) { System.out.println("link is: " + link); } } }
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())); } } }
public static void main(String args[]) throws ConfigurationException, DaoException { // Setup environment Env env = EnvBuilder.envFromArgs(args); LocalPageDao pageDao = env.getConfigurator().get(LocalPageDao.class); UniversalPageDao conceptDao = env.getConfigurator().get(UniversalPageDao.class); // Get local and universal pages LocalPage page = pageDao.getByTitle(Language.EN, "Apple"); UniversalPage concept = conceptDao.getByLocalPage(page); // Translate to other languages. System.out.format("%s in other languages:\n", page.getTitle()); for (Language lang : concept.getLanguageSet()) { LocalPage page2 = pageDao.getById(lang, concept.getLocalId(lang)); System.out.format("%s: %s\n", lang.toString(), page2.getTitle().getCanonicalTitle()); } }
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())); } } }
public static void main(String args[]) throws ConfigurationException, DaoException { // Setup environment Env env = EnvBuilder.envFromArgs(args); LocalPageDao pageDao = env.getConfigurator().get(LocalPageDao.class); UniversalPageDao conceptDao = env.getConfigurator().get(UniversalPageDao.class); // Get local and universal pages LocalPage page = pageDao.getByTitle(Language.EN, "Apple"); UniversalPage concept = conceptDao.getByLocalPage(page); // Translate to other languages. System.out.format("%s in other languages:\n", page.getTitle()); for (Language lang : concept.getLanguageSet()) { LocalPage page2 = pageDao.getById(lang, concept.getLocalId(lang)); System.out.format("%s: %s\n", lang.toString(), page2.getTitle().getCanonicalTitle()); } }
public static void main(String args[]) throws ConfigurationException, DaoException, WikiBrainException { Env env = EnvBuilder.envFromArgs(args); SpatialDataDao spatialDao = env.getConfigurator().get(SpatialDataDao.class); LocalPageDao pageDao = env.getConfigurator().get(LocalPageDao.class); UniversalPageDao conceptDao = env.getConfigurator().get(UniversalPageDao.class); SphericalDistanceMetric spherical = new SphericalDistanceMetric(spatialDao); spherical.enableCache(true); GraphDistanceMetric graph = new GraphDistanceMetric(spatialDao, spherical); graph.enableCache(true); Point p = WikiBrainSpatialUtils.getPoint(44.916140, -93.266512); System.err.println("matches for " + p); for (SpatialDistanceMetric.Neighbor n : graph.getNeighbors(p, 100)) { UniversalPage page = conceptDao.getById(n.conceptId); Title title = page.getBestEnglishTitle(pageDao, true); System.err.println("neighbor " + title + " has distance " + n.distance); } } }