0

i have developed a rasa intent clasification model which is showing correct intents and entities from training data but in addition it is also showing intent ranking with all the other intents and i dont want that to be shown can anyone help me in removing that from my output thanks for the help....... code for the model is.......

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

# from rasa_nlu.converters import load_data
from rasa_nlu.training_data import load_data

from rasa_nlu.config import RasaNLUModelConfig
#from rasa_nlu.config import RasaNLUConfig
from rasa_nlu.model import Trainer, Metadata, Interpreter
from rasa_nlu import config

def train (data, config_file, model_dir):
     training_data = load_data(data)
     configuration = config.load(config_file)
     trainer = Trainer(configuration)
     trainer.train(training_data)
     model_directory = trainer.persist(model_dir, fixed_model_name = 'chat')

def run():
    interpreter = Interpreter.load('./models/nlu/default/chat')
    print(interpreter.parse('buy a pendrive from amazon'))
    #print(interpreter.parse(u'What is the reivew for the movie Die Hard?'))

if __name__ == '__main__':
     #train('./data/testData.json', './config/config.yml', './models/nlu')
     run()

for tainning the data remove comment before train and comment run() and to for running vice versa output after running

just want to remove intent ranking

1 Answers1

0

maybe try:

def run():
    interpreter = Interpreter.load('./models/nlu/default/chat')
    parseResult = interpreter.parse('buy a pendrive from amazon')
    parseResult.pop("intent_ranking", None)
    print(parseResult)
    #print(interpreter.parse(u'What is the reivew for the movie Die Hard?'))

That's untested, but should remove that key from he dict. http://docs.python.org/library/stdtypes.html#dict.pop

Caleb Keller
  • 2,151
  • 17
  • 26