use of org.opensextant.extractors.geo.ScoredPlace in project Xponents by OpenSextant.
the class TestGazMatcher method summarizeFindings.
public static void summarizeFindings(List<TextMatch> matches) {
Set<String> placeNames = new TreeSet<>();
Set<String> countryNames = new TreeSet<>();
Set<String> coordinates = new TreeSet<>();
System.out.println("MENTIONS ALL == " + matches.size());
for (TextMatch tm : matches) {
printGeoTags(tm);
if (tm instanceof PlaceCandidate) {
PlaceCandidate p = (PlaceCandidate) tm;
if (tm.isFilteredOut()) {
print("Filtered Out. Rules = " + p.getRules());
continue;
}
if (!p.getRules().isEmpty()) {
print("Rules = " + p.getRules());
}
if (p.isCountry) {
countryNames.add(p.getText());
} else if (p.getChosen() != null) {
print(String.format("\tgeocoded @ %s with conf=%d", p.getChosen(), p.getConfidence()));
ScoredPlace alt = p.getSecondChoice();
if (alt != null) {
print(String.format("\tgeocoded @ %s second place", alt));
}
placeNames.add(p.getText());
} else {
placeNames.add(p.getText());
}
} else if (tm.isFilteredOut()) {
System.out.println("\t(filtered out: " + tm.getText() + ")");
continue;
}
if (tm instanceof GeocoordMatch) {
GeocoordMatch geo = (GeocoordMatch) tm;
coordinates.add(geo.getText());
if (geo.getRelatedPlace() != null) {
System.out.println("Coordinate at place named " + geo.getRelatedPlace());
}
}
}
System.out.println("MENTIONS DISTINCT PLACES == " + placeNames.size());
System.out.println(placeNames);
System.out.println("MENTIONS COUNTRIES == " + countryNames.size());
System.out.println(countryNames);
System.out.println("MENTIONS COORDINATES == " + coordinates.size());
System.out.println(coordinates);
}
Aggregations