Changeset 33800 for other-projects/maori-lang-detection/src
- Timestamp:
- 2019-12-12T18:04:10+13:00 (4 years ago)
- Location:
- other-projects/maori-lang-detection/src/org/greenstone/atea
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
other-projects/maori-lang-detection/src/org/greenstone/atea/CountryCodeCountsMapData.java
r33799 r33800 248 248 } 249 249 250 251 250 // create rectangular "histogram" for each country code 252 251 private Geometry toPolygon(JsonObject json, int count, int HISTOGRAM_WIDTH) { … … 337 336 Writer writer = new BufferedWriter(new FileWriter(outFile)); 338 337 ) { 339 340 341 //multiPointGeojsonString = multiPointGeojsonString.replace("[[", "\n[\n\t[");342 //multiPointGeojsonString = multiPointGeojsonString.replace("],[", "],\n\t[");343 //multiPointGeojsonString = multiPointGeojsonString.replace("]]", "]\n]");344 338 345 339 writer.write(featuresGeojsonString + "\n"); … … 356 350 357 351 352 public int getTotalCount() { 353 int total = 0; 354 for(JsonElement obj : this.countryCountsJsonArray) { 355 JsonObject json = obj.getAsJsonObject(); 356 int count = json.get("count").getAsInt(); 357 total += count; 358 } 359 return total; 360 } 361 362 358 363 // Unfinished and unused 359 364 public void parseCSVFile(String filename) throws Exception { … … 381 386 CountryCodeCountsMapData mapData = new CountryCodeCountsMapData(args[0], args[1]); 382 387 383 //Geometry geometry = mapData.toMultiPointGeoJSON();384 //String multiPointGeojsonString = FeatureConverter.toStringValue(geometry);385 //System.err.println("geometry: " + multiPointGeojsonString);386 387 388 String multipointOutFileName = mapData.writeMultiPointGeoJsonToFile(parentFolder); 388 389 String featuresOutFileName = mapData.writeFeaturesGeoJsonToFile(parentFolder); 390 389 391 System.err.println("***********\nWrote mapdata to files " + multipointOutFileName 390 392 + " and " + featuresOutFileName); … … 392 394 + "editor at http://geojson.tools/ to see the data arranged on a world map"); 393 395 396 System.err.println("Total count for query: " + mapData.getTotalCount()); 397 394 398 } catch(Exception e) { 395 399 logger.error(e.getMessage(), e); -
other-projects/maori-lang-detection/src/org/greenstone/atea/NutchTextDumpToMongoDB.java
r33698 r33800 291 291 File geoLiteCityDatFile = new File(this.getClass().getClassLoader().getResource("GeoLiteCity.dat").getFile()); 292 292 try { 293 if(this.domainOfSite.equals("UNKNOWN")) { 293 if(this.domainOfSite.equals("UNKNOWN")) { // for sites that had 0 webpages downloaded, we have no domain 294 294 this.geoLocationCountryCode = "UNKNOWN"; 295 295 } else { … … 298 298 } catch(Exception e) { 299 299 logger.error("*** For SiteID " + siteID + ", got exception: " + e.getMessage(), e); 300 this.geoLocationCountryCode = null;300 this.geoLocationCountryCode = "UNKNOWN"; // couldn't get the country code, so should also be UNKNOWN not null 301 301 } 302 302
Note:
See TracChangeset
for help on using the changeset viewer.