@Test public void testGetUriCandidates() { System.out.println(UriDisambiguation.getUriCandidates("Leipzig", "en")); }
public static List<Resource> getUriCandidates(String label, String language) { SolrServer server = language.equals("en") ? SolrServerHolder.enSolrServer : language.equals("de") ? SolrServerHolder.deSolrServer : SolrServerHolder.enSolrServer; List<Resource> candidates = query(server, label); if ( label.endsWith("s") && candidates.isEmpty() ) candidates = query(server, label.replaceAll("s$", "")); if ( language.equals("de") && candidates.isEmpty() ) candidates = query(SolrServerHolder.enSolrServer, label); if ( language.equals("de") && candidates.isEmpty() && label.split(" ")[0].endsWith("n") ) candidates = query(SolrServerHolder.deSolrServer, label.replaceFirst("n ", " ")); if ( language.equals("de") && candidates.isEmpty() ) candidates = query(SolrServerHolder.deSolrServer, WordUtils.capitalize(label)); if ( language.equals("de") && candidates.isEmpty() ) candidates = query(SolrServerHolder.deSolrServer, label.replaceAll("n$", "")); labelToResources.put(label, candidates); return candidates; }
UriDisambiguation { public static List<Resource> getUriCandidates(String label, String language) { SolrServer server = language.equals("en") ? SolrServerHolder.enSolrServer : language.equals("de") ? SolrServerHolder.deSolrServer : SolrServerHolder.enSolrServer; List<Resource> candidates = query(server, label); if ( label.endsWith("s") && candidates.isEmpty() ) candidates = query(server, label.replaceAll("s$", "")); if ( language.equals("de") && candidates.isEmpty() ) candidates = query(SolrServerHolder.enSolrServer, label); if ( language.equals("de") && candidates.isEmpty() && label.split(" ")[0].endsWith("n") ) candidates = query(SolrServerHolder.deSolrServer, label.replaceFirst("n ", " ")); if ( language.equals("de") && candidates.isEmpty() ) candidates = query(SolrServerHolder.deSolrServer, WordUtils.capitalize(label)); if ( language.equals("de") && candidates.isEmpty() ) candidates = query(SolrServerHolder.deSolrServer, label.replaceAll("n$", "")); labelToResources.put(label, candidates); return candidates; } }
UriDisambiguation { public static List<Resource> getUriCandidates(String label, String language) { SolrServer server = language.equals("en") ? SolrServerHolder.enSolrServer : language.equals("de") ? SolrServerHolder.deSolrServer : SolrServerHolder.enSolrServer; List<Resource> candidates = query(server, label); if ( label.endsWith("s") && candidates.isEmpty() ) candidates = query(server, label.replaceAll("s$", "")); if ( language.equals("de") && candidates.isEmpty() ) candidates = query(SolrServerHolder.enSolrServer, label); if ( language.equals("de") && candidates.isEmpty() && label.split(" ")[0].endsWith("n") ) candidates = query(SolrServerHolder.deSolrServer, label.replaceFirst("n ", " ")); if ( language.equals("de") && candidates.isEmpty() ) candidates = query(SolrServerHolder.deSolrServer, WordUtils.capitalize(label)); if ( language.equals("de") && candidates.isEmpty() ) candidates = query(SolrServerHolder.deSolrServer, label.replaceAll("n$", "")); labelToResources.put(label, candidates); return candidates; }  }
UriDisambiguation { public static List<Resource> getUriCandidates(String label, String language) { SolrServer server = language.equals("en") ? SolrServerHolder.enSolrServer : language.equals("de") ? SolrServerHolder.deSolrServer : SolrServerHolder.enSolrServer; List<Resource> candidates = query(server, label); if ( label.endsWith("s") && candidates.isEmpty() ) candidates = query(server, label.replaceAll("s$", "")); if ( language.equals("de") && candidates.isEmpty() ) candidates = query(SolrServerHolder.enSolrServer, label); if ( language.equals("de") && candidates.isEmpty() && label.split(" ")[0].endsWith("n") ) candidates = query(SolrServerHolder.deSolrServer, label.replaceFirst("n ", " ")); if ( language.equals("de") && candidates.isEmpty() ) candidates = query(SolrServerHolder.deSolrServer, WordUtils.capitalize(label)); if ( language.equals("de") && candidates.isEmpty() ) candidates = query(SolrServerHolder.deSolrServer, label.replaceAll("n$", "")); labelToResources.put(label, candidates); return candidates; }  static void main(String[] args); static List<Resource> getTopUris(List<Resource> candidateResources, String label, String language); static List<Resource> getTopUris(List<Resource> candidateResources, String label, String language, int n); static List<Resource> getUri(Question q, Entity entity, String language); static List<Resource> getUriCandidates(String label, String language); static List<Resource> query(SolrServer server, String label); }
UriDisambiguation { public static List<Resource> getUriCandidates(String label, String language) { SolrServer server = language.equals("en") ? SolrServerHolder.enSolrServer : language.equals("de") ? SolrServerHolder.deSolrServer : SolrServerHolder.enSolrServer; List<Resource> candidates = query(server, label); if ( label.endsWith("s") && candidates.isEmpty() ) candidates = query(server, label.replaceAll("s$", "")); if ( language.equals("de") && candidates.isEmpty() ) candidates = query(SolrServerHolder.enSolrServer, label); if ( language.equals("de") && candidates.isEmpty() && label.split(" ")[0].endsWith("n") ) candidates = query(SolrServerHolder.deSolrServer, label.replaceFirst("n ", " ")); if ( language.equals("de") && candidates.isEmpty() ) candidates = query(SolrServerHolder.deSolrServer, WordUtils.capitalize(label)); if ( language.equals("de") && candidates.isEmpty() ) candidates = query(SolrServerHolder.deSolrServer, label.replaceAll("n$", "")); labelToResources.put(label, candidates); return candidates; }  static void main(String[] args); static List<Resource> getTopUris(List<Resource> candidateResources, String label, String language); static List<Resource> getTopUris(List<Resource> candidateResources, String label, String language, int n); static List<Resource> getUri(Question q, Entity entity, String language); static List<Resource> getUriCandidates(String label, String language); static List<Resource> query(SolrServer server, String label); static Double APRIORI_PARAMETER; static Double STRING_SIMILARTY_PARAMETER; static int BONUS; }