simple_ner#
- class besser.bot.nlp.ner.simple_ner.SimpleNER(nlp_engine, bot)[source]#
Bases:
NER
A simple NER.
It can find an entity value in a user message only with exact matching (i.e. slight variations on an entity value within a user message will make the NER fail)
- Parameters:
- _abc_impl = <_abc._abc_data object>#
- besser.bot.nlp.ner.simple_ner.base_entity_ner(sentence, entity_name, nlp_engine)[source]#
Do NER with a base entity.
Given a sentence and a base entity, look for a value of the base entity in the sentence.
- Parameters:
- Returns:
- the sentence (that can be modified), the matched fragment,
and the extra info. If no value has been found, return None
- Return type:
- besser.bot.nlp.ner.simple_ner.get_custom_entity_values_dict(intent, processed_values=False)[source]#
Get a dictionary containing, for each entity value v (including synonyms) among all paramters in an intent, a tuple with: 1 - the intent parameters where v could be a match and 2 - the main value of v (if v is not a synonym and it is the main value, it will be duplicated):
{value/synonym: ([intent_parameters], value)}