Search in sources :

Example 1 with PlaceCount

use of org.opensextant.extractors.geo.PlaceCount in project Xponents by OpenSextant.

the class ProvinceAssociationRule method setProvinces.

public void setProvinces(Collection<PlaceCount> p) {
    if (p == null) {
        return;
    }
    for (PlaceCount count : p) {
        Place adm1 = count.place;
        relevantProvinceID.put(adm1.getHierarchicalPath(), adm1);
    }
}
Also used : PlaceCount(org.opensextant.extractors.geo.PlaceCount) Place(org.opensextant.data.Place)

Example 2 with PlaceCount

use of org.opensextant.extractors.geo.PlaceCount in project Xponents by OpenSextant.

the class LocationChooserRule method debuggingHistograms.

/**
     * What can we learn from assembling better stats at the document level?
     * Evidence breaks down into concrete locations vs. inferred.
     * 
     * @param names
     */
private void debuggingHistograms(List<PlaceCandidate> names) {
    /*
         * TODO:  Is this histogram helpful.?
         * 
         * Uniqueness or popularity of a given name.
         */
    for (PlaceCandidate name : names) {
        if (name.isFilteredOut()) {
            continue;
        }
        PlaceCount x = namespace.get(name.getTextnorm());
        if (x == null) {
            x = new PlaceCount();
            x.place = new Place(name.getTextnorm(), name.getTextnorm());
            x.total = names.size();
            namespace.put(name.getTextnorm(), x);
        } else {
            ++x.count;
        }
    }
    for (String cc : countryContext.keySet()) {
        CountryCount count = countryContext.get(cc);
        //log.debug("Country: {}/{} ({})", cc, count.country, count.count);
        log.debug("Country: {}", count);
    }
    for (PlaceCount count : boundaryContext.values()) {
        //log.debug("Boundary: {} ({})", count.place, count.count);
        log.debug("Boundary: {}", count);
        String cc = count.place.getCountryCode();
        CountryCount Ccnt = inferredCountries.get(cc);
        if (Ccnt == null) {
            Ccnt = new CountryCount();
            Ccnt.country = new Country(cc, cc);
            inferredCountries.put(cc, Ccnt);
        } else {
            ++Ccnt.count;
        }
    }
    log.debug("Places: {}/{}", namespace.size(), namespace);
}
Also used : PlaceCount(org.opensextant.extractors.geo.PlaceCount) CountryCount(org.opensextant.extractors.geo.CountryCount) Country(org.opensextant.data.Country) Place(org.opensextant.data.Place) PlaceCandidate(org.opensextant.extractors.geo.PlaceCandidate)

Aggregations

Place (org.opensextant.data.Place)2 PlaceCount (org.opensextant.extractors.geo.PlaceCount)2 Country (org.opensextant.data.Country)1 CountryCount (org.opensextant.extractors.geo.CountryCount)1 PlaceCandidate (org.opensextant.extractors.geo.PlaceCandidate)1