Repository: tika Updated Branches: refs/heads/master c93ff3e1c -> c9bc910c5
Grobid Quantities parser extracts types Project: http://git-wip-us.apache.org/repos/asf/tika/repo Commit: http://git-wip-us.apache.org/repos/asf/tika/commit/e2e10f9a Tree: http://git-wip-us.apache.org/repos/asf/tika/tree/e2e10f9a Diff: http://git-wip-us.apache.org/repos/asf/tika/diff/e2e10f9a Branch: refs/heads/master Commit: e2e10f9ac76bd0566a33dae71a666bb2f7746f24 Parents: 9f09a55 Author: cmenekse <[email protected]> Authored: Mon May 2 10:28:24 2016 -0700 Committer: cmenekse <[email protected]> Committed: Mon May 2 10:28:24 2016 -0700 ---------------------------------------------------------------------- .../apache/tika/parser/ner/grobid/GrobidNERecogniser.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tika/blob/e2e10f9a/tika-parsers/src/main/java/org/apache/tika/parser/ner/grobid/GrobidNERecogniser.java ---------------------------------------------------------------------- diff --git a/tika-parsers/src/main/java/org/apache/tika/parser/ner/grobid/GrobidNERecogniser.java b/tika-parsers/src/main/java/org/apache/tika/parser/ner/grobid/GrobidNERecogniser.java index d2e0bc4..945bbb5 100644 --- a/tika-parsers/src/main/java/org/apache/tika/parser/ner/grobid/GrobidNERecogniser.java +++ b/tika-parsers/src/main/java/org/apache/tika/parser/ner/grobid/GrobidNERecogniser.java @@ -28,6 +28,7 @@ public class GrobidNERecogniser implements NERecogniser{ add("MEASUREMENT_UNITS"); add("MEASUREMENTS"); add("NORMALIZED_MEASUREMENTS"); + add("MEASUREMENT_TYPES"); }}; @@ -140,6 +141,7 @@ public class GrobidNERecogniser implements NERecogniser{ Set<String> unitSet = new HashSet<String>(); Set<String> measurementSet = new HashSet<String>(); Set<String> normalizedMeasurementSet = new HashSet<String>(); + Set<String> measurementTypeSet = new HashSet<String>(); try { String url = restHostUrlStr + readRestEndpoint(); @@ -169,9 +171,12 @@ public class GrobidNERecogniser implements NERecogniser{ normalizedMeasurementString.append(normalizedMeasurementNumber); normalizedMeasurementString.append(" "); } + if (quantity.containsKey("type")) { + String measurementType = (String) convertToJSONObject(quantity.toString()).get("type"); + measurementTypeSet.add(measurementType); + } JSONObject jsonObj = (JSONObject) convertToJSONObject(quantity.toString()); - if (jsonObj.containsKey("rawUnit")) { JSONObject rawUnit = (JSONObject) jsonObj.get("rawUnit"); String unitName = (String) convertToJSONObject(rawUnit.toString()).get("name"); @@ -195,10 +200,12 @@ public class GrobidNERecogniser implements NERecogniser{ } } + entities.put("MEASUREMENT_NUMBERS",measurementNumberSet); entities.put("MEASUREMENT_UNITS",unitSet); entities.put("MEASUREMENTS",measurementSet); entities.put("NORMALIZED_MEASUREMENTS",normalizedMeasurementSet); + entities.put("MEASUREMENT_TYPES",measurementTypeSet); } }
