Hello, I am trying to extract the entities and entity scores (using the ner_crf component) from sentences while a conversation is going on. I have described the things I have done to solve the issue, the error and code for more reference.
While I am providing key1 = tracker.latest_message.entities and, l_confidence_1 = tracker.latest_message.entities(confidence) in the actions.py file, it gives an empty list for any question I provide.
In addition, if I provide the lines as given below it shows errors “cannot accept strings”
key1 = tracker.latest_message.entities[“name”] l_confidence_1 = tracker.latest_message.entities[“confidence”]
I am providing the code for actions.py below for better understanding. It would be helpful if anybody could please help me identify the issue to solve the problem. Thanks in advance.
from future import absolute_import from future import division from future import print_function from future import unicode_literals
import argparse import logging import warnings
from rasa_core import utils from rasa_core.actions import Action from rasa_core.agent import Agent from rasa_core.trackers import DialogueStateTracker
with warnings.catch_warnings(): warnings.filterwarnings(“ignore”, category= DeprecationWarning)
lclass ActionTest(Action): def name(self): return ‘action_test’
def run(self, dispatcher, tracker, domain):
key1 = tracker.latest_message.entities
l_confidence_1 = tracker.latest_message.entities(confidence)
logger.info(key1)
logger.info(l_confidence_1)
if tracker:
print(tracker.current_state()) # or do other things
return []