public Map<String, Set<String>> recognise(String text) {

        Map<String, Set<String>> entities = new HashMap<>();
        Set<String> measurementNumberSet = new HashSet<>();
        Set<String> unitSet = new HashSet<>();
        Set<String> measurementSet = new HashSet<>();
        Set<String> normalizedMeasurementSet = new HashSet<>();
        Set<String> measurementTypeSet = new HashSet<>();

        try {
            String url = restHostUrlStr + readRestEndpoint();
            try (Response response =
                    WebClient.create(url).accept(MediaType.APPLICATION_JSON)
                            .post("text=" + text)) {
                int responseCode = response.getStatus();

                if (responseCode == 200) {
                    String result = response.readEntity(String.class);
                    JSONObject jsonObject = convertToJSONObject(result);
                    JSONArray measurements = convertToJSONArray(jsonObject, "measurements");
                    for (Object measurement : measurements) {

                        StringBuilder measurementString = new StringBuilder();
                        StringBuilder normalizedMeasurementString = new StringBuilder();

                        JSONObject quantity = (JSONObject) convertToJSONObject(measurement.toString())
                                .get("quantity");
                        if (quantity != null) {
                            if (quantity.containsKey("rawValue")) {
                                String measurementNumber =
                                        (String) convertToJSONObject(quantity.toString())
                                                .get("rawValue");
                                measurementString.append(measurementNumber);
                                measurementString.append(" ");
                                measurementNumberSet.add(measurementNumber);
                            }

                            if (quantity.containsKey("normalizedQuantity")) {
                                String normalizedMeasurementNumber =
                                        convertToJSONObject(quantity.toString())
                                                .get("normalizedQuantity").toString();
                                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");
                                unitSet.add(unitName);
                                measurementString.append(unitName);
                            }

                            if (jsonObj.containsKey("normalizedUnit")) {
                                JSONObject normalizedUnit = (JSONObject) jsonObj.get("normalizedUnit");
                                String normalizedUnitName =
                                        (String) convertToJSONObject(normalizedUnit.toString())
                                                .get("name");
                                normalizedMeasurementString.append(normalizedUnitName);
                            }

                            if (!measurementString.toString().equals("")) {
                                measurementSet.add(measurementString.toString());
                            }

                            if (!normalizedMeasurementString.toString().equals("")) {
                                normalizedMeasurementSet.add(normalizedMeasurementString.toString());
                            }
                        }

                    }

                    entities.put("MEASUREMENT_NUMBERS", measurementNumberSet);
                    entities.put("MEASUREMENT_UNITS", unitSet);
                    entities.put("MEASUREMENTS", measurementSet);
                    entities.put("NORMALIZED_MEASUREMENTS", normalizedMeasurementSet);
                    entities.put("MEASUREMENT_TYPES", measurementTypeSet);

                }
            }
        } catch (Exception e) {
            LOG.info(e.getMessage(), e);

        }
        ENTITY_TYPES.clear();
        ENTITY_TYPES.addAll(entities.keySet());
        return entities;
    }
recognises names of entities in the text

@param text text which possibly contains names
@return map of entity type -&gt; set of names
tika-parsers/tika-parsers-ml/tika-parser-nlp-module/src/main/java/org/apache/tika/parser/ner/grobid/GrobidNERecogniser.java