public class CoreNLPNERecogniser extends Object implements NERecogniser
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.NERecogniser
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_MODEL_PATH
default Model path
|
static Set<String> |
ENTITY_TYPES |
static String |
MODEL_PROP_NAME |
static String |
NER_3CLASS_MODEL |
static String |
NER_4CLASS_MODEL |
static String |
NER_7CLASS_MODEL |
DATE, LOCATION, MISCELLANEOUS, MONEY, ORGANIZATION, PERCENT, PERSON, TIME
Constructor and Description |
---|
CoreNLPNERecogniser() |
CoreNLPNERecogniser(String modelPath)
Creates a NERecogniser by loading model from given path
|
Modifier and Type | Method and Description |
---|---|
Set<String> |
getEntityTypes()
Gets set of entity types recognised by this recogniser
|
boolean |
isAvailable()
checks if this Named Entity recogniser is available for service
|
static void |
main(String[] args) |
Map<String,Set<String>> |
recognise(String text)
recognises names of entities in the text
|
public static final String NER_3CLASS_MODEL
public static final String NER_4CLASS_MODEL
public static final String NER_7CLASS_MODEL
public static final String DEFAULT_MODEL_PATH
public static final String MODEL_PROP_NAME
public CoreNLPNERecogniser()
public CoreNLPNERecogniser(String modelPath)
modelPath
- path to NER model filepublic static void main(String[] args) throws IOException, com.github.openjson.JSONException
IOException
com.github.openjson.JSONException
public boolean isAvailable()
NERecogniser
isAvailable
in interface NERecogniser
true
if model was available, valid and was able to initialise the classifier.
returns false
when this recogniser is not available for service.public Set<String> getEntityTypes()
getEntityTypes
in interface NERecogniser
Copyright © 2007–2023 The Apache Software Foundation. All rights reserved.