Class CoreNLPNERecogniser
java.lang.Object
org.apache.tika.parser.ner.corenlp.CoreNLPNERecogniser
- All Implemented Interfaces:
NERecogniser
This class offers an implementation of
NERecogniser
based on
CRF classifiers from Stanford CoreNLP. This NER requires additional setup,
due to runtime binding to Stanford CoreNLP.
See
Tika NER Wiki for configuring this recogniser.- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
default Model pathstatic final String
static final String
static final String
static final String
Fields inherited from interface org.apache.tika.parser.ner.NERecogniser
DATE, LOCATION, MISCELLANEOUS, MONEY, ORGANIZATION, PERCENT, PERSON, TIME
-
Constructor Summary
ConstructorDescriptionCoreNLPNERecogniser
(String modelPath) Creates a NERecogniser by loading model from given path -
Method Summary
Modifier and TypeMethodDescriptionGets set of entity types recognised by this recogniserboolean
checks if this Named Entity recogniser is available for servicestatic void
recognises names of entities in the text
-
Field Details
-
NER_3CLASS_MODEL
- See Also:
-
NER_4CLASS_MODEL
- See Also:
-
NER_7CLASS_MODEL
- See Also:
-
DEFAULT_MODEL_PATH
default Model path- See Also:
-
MODEL_PROP_NAME
- See Also:
-
ENTITY_TYPES
-
-
Constructor Details
-
CoreNLPNERecogniser
public CoreNLPNERecogniser() -
CoreNLPNERecogniser
Creates a NERecogniser by loading model from given path- Parameters:
modelPath
- path to NER model file
-
-
Method Details
-
main
- Throws:
IOException
com.github.openjson.JSONException
-
isAvailable
public boolean isAvailable()Description copied from interface:NERecogniser
checks if this Named Entity recogniser is available for service- Specified by:
isAvailable
in interfaceNERecogniser
- Returns:
true
if model was available, valid and was able to initialise the classifier. returnsfalse
when this recogniser is not available for service.
-
getEntityTypes
Gets set of entity types recognised by this recogniser- Specified by:
getEntityTypes
in interfaceNERecogniser
- Returns:
- set of entity classes/types
-
recognise
recognises names of entities in the text- Specified by:
recognise
in interfaceNERecogniser
- Parameters:
text
- text which possibly contains names- Returns:
- map of entity type -> set of names
-