Ner_crf case

Hi,

When I use ner_crf in the config file to rasa nlu model for extracting alphanumeric entities such as (A400343E9585F15) in sentences. The entity extracted after running the model is actually in lowercase (a400343e9585f15). I want to retain the entity value in uppercase itself. Could you tell me how I can do that?

This is what i get: {‘intent’: {‘name’: ‘fetch’, ‘confidence’: 0.8812866254260726}, ‘entities’: [{‘start’: 51, ‘end’: 66, ‘value’: ‘a400343e9585f15’, ‘entity’: ‘serial number’, ‘confidence’: 0.7016804162978962, ‘extractor’: ‘ner_crf’}

Thank you

@souvikg10 : Could you help me with this?

@akelad : Could you help me with this?

Hey Sagari!

I’ve faced the same problem with alphanumerics before and one solution was changing the case sensitive behaviour of Spacy in nlu pipeline. Since Spacy changes all tokens to lowercase by default, adding this will help recognizing those entities:

'- name: “nlp_spacy”
case_sensitive: true

Another solution was using in a custom action a function that converts the slot value to upper.

Hope it helps!

1 Like

Hi carla,

Thanks for responding to me with the solutions that worked for you. I tried the first solution case_sensitive:true in my pipeline but it did not work for me. My entity did not get extracted at all as below:

{‘intent’: {‘name’: ‘fetch_logs’, ‘confidence’: 0.9802921196153628}, ‘entities’: [{‘start’: 53, ‘end’: 89, ‘value’: ‘0040351a-74af-4b2c - a374-e0a474e44e28’, ‘entity’: ‘customer_id’, ‘confidence’: 0.545112275700203, ‘extractor’: ‘ner_crf’}], ‘intent_ranking’: [{‘name’: ‘fetch_logs’, ‘confidence’: 0.9802921196153628}, {‘name’: ‘goodbye’, ‘confidence’: 0.012288519495664223}, {‘name’: ‘greet’, ‘confidence’: 0.007419360888973045}], ‘text’: ‘Give me logs for AP A400236A99B251E with customer id 0040351a-74af-4b2c-a374-e0a474e44e28’}

Currently I’m doing the second solution and it works. But it would be great if you have any ideas about how to make the first solution work so that the entity gets extracted as is and I don’t have to do anything else in custom actions.

I added more training data and now the first solution works too. Thanks.

Hey Sagari, sorry I couldnt answer sooner! I’m really happy the first solution worked for you!

Regards :relaxed: