Class OpenNLPNERecogniser
- java.lang.Object
-
- org.apache.tika.parser.ner.opennlp.OpenNLPNERecogniser
-
- All Implemented Interfaces:
NERecogniser
public class OpenNLPNERecogniser extends java.lang.Object implements NERecogniser
This implementation ofNERecogniser
chains an array ofOpenNLPNameFinder
s for which NER models are available in classpath. The following models are scanned during initialization via class loader.:- See Also:
NamedEntityParser.DEFAULT_NER_IMPL
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DATE_FILE
static java.util.Map<java.lang.String,java.lang.String>
DEFAULT_MODELS
static java.lang.String
LOCATION_FILE
static java.lang.String
MODELS_DIR
static java.lang.String
MONEY_FILE
static java.lang.String
NER_DATE_MODEL
static java.lang.String
NER_LOCATION_MODEL
static java.lang.String
NER_MONEY_MODEL
static java.lang.String
NER_ORGANIZATION_MODEL
static java.lang.String
NER_PERCENT_MODEL
static java.lang.String
NER_PERSON_MODEL
static java.lang.String
NER_TIME_MODEL
static java.lang.String
ORGANIZATION_FILE
static java.lang.String
PERCENT_FILE
static java.lang.String
PERSON_FILE
static java.lang.String
TIME_FILE
-
Fields inherited from interface org.apache.tika.parser.ner.NERecogniser
DATE, LOCATION, MISCELLANEOUS, MONEY, ORGANIZATION, PERCENT, PERSON, TIME
-
-
Constructor Summary
Constructors Constructor Description OpenNLPNERecogniser()
Creates a default chain of Name finders using default OpenNLP recognizersOpenNLPNERecogniser(java.util.Map<java.lang.String,java.lang.String> models)
Creates a chain of Named Entity recognisers
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Set<java.lang.String>
getEntityTypes()
gets a set of entity types whose names are recognisable by thisboolean
isAvailable()
checks if this Named Entity recogniser is available for servicejava.util.Map<java.lang.String,java.util.Set<java.lang.String>>
recognise(java.lang.String text)
call for name recognition action from text
-
-
-
Field Detail
-
MODELS_DIR
public static final java.lang.String MODELS_DIR
-
PERSON_FILE
public static final java.lang.String PERSON_FILE
- See Also:
- Constant Field Values
-
LOCATION_FILE
public static final java.lang.String LOCATION_FILE
- See Also:
- Constant Field Values
-
ORGANIZATION_FILE
public static final java.lang.String ORGANIZATION_FILE
- See Also:
- Constant Field Values
-
TIME_FILE
public static final java.lang.String TIME_FILE
- See Also:
- Constant Field Values
-
DATE_FILE
public static final java.lang.String DATE_FILE
- See Also:
- Constant Field Values
-
PERCENT_FILE
public static final java.lang.String PERCENT_FILE
- See Also:
- Constant Field Values
-
MONEY_FILE
public static final java.lang.String MONEY_FILE
- See Also:
- Constant Field Values
-
NER_PERSON_MODEL
public static final java.lang.String NER_PERSON_MODEL
-
NER_LOCATION_MODEL
public static final java.lang.String NER_LOCATION_MODEL
-
NER_ORGANIZATION_MODEL
public static final java.lang.String NER_ORGANIZATION_MODEL
-
NER_TIME_MODEL
public static final java.lang.String NER_TIME_MODEL
-
NER_DATE_MODEL
public static final java.lang.String NER_DATE_MODEL
-
NER_PERCENT_MODEL
public static final java.lang.String NER_PERCENT_MODEL
-
NER_MONEY_MODEL
public static final java.lang.String NER_MONEY_MODEL
-
DEFAULT_MODELS
public static final java.util.Map<java.lang.String,java.lang.String> DEFAULT_MODELS
-
-
Constructor Detail
-
OpenNLPNERecogniser
public OpenNLPNERecogniser()
Creates a default chain of Name finders using default OpenNLP recognizers
-
OpenNLPNERecogniser
public OpenNLPNERecogniser(java.util.Map<java.lang.String,java.lang.String> models)
Creates a chain of Named Entity recognisers- Parameters:
models
- map of entityType -> model path NOTE: the model path should be known to class loader.
-
-
Method Detail
-
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 this recogniser is ready to recognise, false otherwise
-
getEntityTypes
public java.util.Set<java.lang.String> getEntityTypes()
Description copied from interface:NERecogniser
gets a set of entity types whose names are recognisable by this- Specified by:
getEntityTypes
in interfaceNERecogniser
- Returns:
- set of entity types/classes
-
recognise
public java.util.Map<java.lang.String,java.util.Set<java.lang.String>> recognise(java.lang.String text)
Description copied from interface:NERecogniser
call for name recognition action from text- Specified by:
recognise
in interfaceNERecogniser
- Parameters:
text
- text with possibly contains names- Returns:
- map of entityType -> set of names
-
-