public Map<String, Set<String>> recognise(String text) {
        Map<String, Set<String>> names = new HashMap<>();

        try {

            Class<?> stringVectorClass = Class.forName("edu.mit.ll.mitie.StringVector");
            Class<?> entityMentionVectorClass =
                    Class.forName("edu.mit.ll.mitie.EntityMentionVector");
            Class<?> entityMentionClass = Class.forName("edu.mit.ll.mitie.EntityMention");
            Object entityMentionObject = null;
            Class<?> globalClass = Class.forName("edu.mit.ll.mitie.global");
            Object stringVectorObject = extractorInstance.getClass().getMethod("getPossibleNerTags")
                    .invoke(extractorInstance);
            long size = (Long) stringVectorClass.getMethod("size").invoke(stringVectorObject);
            ArrayList<String> possibleTags = new ArrayList<>();
            for (long i = 0; i < size; i++) {
                String t = (String) stringVectorClass.getMethod("get", Integer.TYPE)
                        .invoke(stringVectorObject, (int) i);
                possibleTags.add(t);
            }
            Method tokenize = globalClass.getMethod("tokenize", String.class);
            stringVectorObject = tokenize.invoke(globalClass, text);

            ArrayList<String> stringVector = new ArrayList<>();
            size = (Long) stringVectorClass.getMethod("size").invoke(stringVectorObject);
            for (long i = 0; i < size; i++) {
                String t = (String) stringVectorClass.getMethod("get", Integer.TYPE)
                        .invoke(stringVectorObject, (int) i);
                stringVector.add(t);
            }
            Method extractEntities =
                    extractorInstance.getClass().getMethod("extractEntities", stringVectorClass);
            Object entities = extractEntities.invoke(extractorInstance, stringVectorObject);
            size = (Long) entityMentionVectorClass.getMethod("size").invoke(entities);
            for (long i = 0; i < size; i++) {
                entityMentionObject = entityMentionVectorClass.getMethod("get", Integer.TYPE)
                        .invoke(entities, (int) i);
                int tag_index = (Integer) entityMentionClass.getMethod("getTag")
                        .invoke(entityMentionObject);
                String tag = possibleTags.get(tag_index);
                Set<String> x = new HashSet<>();
                if (names.containsKey(tag)) {
                    x = names.get(tag);
                } else {
                    names.put(tag, x);
                }
                int start = (Integer) entityMentionClass.getMethod("getStart")
                        .invoke(entityMentionObject);
                int end = (Integer) entityMentionClass.getMethod("getEnd")
                        .invoke(entityMentionObject);
                StringBuilder match = new StringBuilder();
                while (start < end) {
                    match.append(stringVector.get(start)).append(" ");
                    start++;
                }
                x.add(match.toString().trim());
            }

        } catch (Exception e) {

            LOG.debug(e.getMessage(), e);
        }
        return names;
    }
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/mitie/MITIENERecogniser.java