Class CoreNLPNERecogniser
- java.lang.Object
-
- org.apache.tika.parser.ner.corenlp.CoreNLPNERecogniser
-
- All Implemented Interfaces:
NERecogniser
public class CoreNLPNERecogniser extends Object implements NERecogniser
This class offers an implementation ofNERecogniserbased 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:
NERecogniser
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_MODEL_PATHdefault Model pathstatic Set<String>ENTITY_TYPESstatic StringMODEL_PROP_NAMEstatic StringNER_3CLASS_MODELstatic StringNER_4CLASS_MODELstatic StringNER_7CLASS_MODEL-
Fields inherited from interface org.apache.tika.parser.ner.NERecogniser
DATE, LOCATION, MISCELLANEOUS, MONEY, ORGANIZATION, PERCENT, PERSON, TIME
-
-
Constructor Summary
Constructors Constructor Description CoreNLPNERecogniser()CoreNLPNERecogniser(String modelPath)Creates a NERecogniser by loading model from given path
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Set<String>getEntityTypes()Gets set of entity types recognised by this recogniserbooleanisAvailable()checks if this Named Entity recogniser is available for servicestatic voidmain(String[] args)Map<String,Set<String>>recognise(String text)recognises names of entities in the text
-
-
-
Field Detail
-
NER_3CLASS_MODEL
public static final String NER_3CLASS_MODEL
- See Also:
- Constant Field Values
-
NER_4CLASS_MODEL
public static final String NER_4CLASS_MODEL
- See Also:
- Constant Field Values
-
NER_7CLASS_MODEL
public static final String NER_7CLASS_MODEL
- See Also:
- Constant Field Values
-
DEFAULT_MODEL_PATH
public static final String DEFAULT_MODEL_PATH
default Model path- See Also:
- Constant Field Values
-
MODEL_PROP_NAME
public static final String MODEL_PROP_NAME
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CoreNLPNERecogniser
public CoreNLPNERecogniser()
-
CoreNLPNERecogniser
public CoreNLPNERecogniser(String modelPath)
Creates a NERecogniser by loading model from given path- Parameters:
modelPath- path to NER model file
-
-
Method Detail
-
main
public static void main(String[] args) throws IOException, com.github.openjson.JSONException
- Throws:
IOExceptioncom.github.openjson.JSONException
-
isAvailable
public boolean isAvailable()
Description copied from interface:NERecogniserchecks if this Named Entity recogniser is available for service- Specified by:
isAvailablein interfaceNERecogniser- Returns:
trueif model was available, valid and was able to initialise the classifier. returnsfalsewhen this recogniser is not available for service.
-
getEntityTypes
public Set<String> getEntityTypes()
Gets set of entity types recognised by this recogniser- Specified by:
getEntityTypesin interfaceNERecogniser- Returns:
- set of entity classes/types
-
-