Search in sources :

Example 11 with Country

use of org.opensextant.data.Country 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

Country (org.opensextant.data.Country)11 InputStreamReader (java.io.InputStreamReader)3 GeonamesUtility (org.opensextant.util.GeonamesUtility)3 IOException (java.io.IOException)2 InputStream (java.io.InputStream)2 Reader (java.io.Reader)2 Language (org.opensextant.data.Language)2 Place (org.opensextant.data.Place)2 CsvMapReader (org.supercsv.io.CsvMapReader)2 BufferedReader (java.io.BufferedReader)1 ParseException (java.text.ParseException)1 ArrayList (java.util.ArrayList)1 TreeMap (java.util.TreeMap)1 SolrServerException (org.apache.solr.client.solrj.SolrServerException)1 QueryResponse (org.apache.solr.client.solrj.response.QueryResponse)1 SolrDocument (org.apache.solr.common.SolrDocument)1 SolrDocumentList (org.apache.solr.common.SolrDocumentList)1 ModifiableSolrParams (org.apache.solr.common.params.ModifiableSolrParams)1 Test (org.junit.Test)1 CountryCount (org.opensextant.extractors.geo.CountryCount)1