Rasa: empty parsed text

Created on 13 Feb 2018  路  18Comments  路  Source: RasaHQ/rasa

Rasa NLU version : development

Used backend / pipeline (mitie, spacy_sklearn, ...): spacy_sklearn

Operating system (windows, osx, ...): windows

Issue:

With this example of current version:

http://nlu.rasa.ai/master/python.html

`from rasa_nlu.training_data import load_data
from rasa_nlu.config import RasaNLUConfig
from rasa_nlu.model import Trainer

training_data = load_data('data/examples/rasa/germ_test.json')
trainer = Trainer(RasaNLUConfig("sample_configs/config_spacy.json"))
trainer.train(training_data)
model_directory = trainer.persist('./projects/')  # Returns the directory the model is stored in

from rasa_nlu.model import Metadata, Interpreter

# where `model_directory points to the folder the model is persisted in
interpreter = Interpreter.load(model_directory, RasaNLUConfig("sample_configs/config_spacy.json"))

interpreter.parse(u"Wie viel Uhr ist es?")`

I receive this:

C:\Users\XXXX\Anaconda3\lib\site-packages\sklearn\preprocessing\label.py:151: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use array.size > 0 to check that an array is not empty.
if diff:

And the result of interpreter.parse seems to be empty.

What does this mean?

windows type

Most helpful comment

I think that this is a dependacy update issue see scikit-learn/scikit-learn/pull/9816

OS: macOS 10.13.3
pipeline: spacy_sklearn

All 18 comments

I want to update

I traced back this error until the update function for the output in the parse function of model.Interpreter.


`    def parse(self, text, time=None, only_output_properties=True):
        # type: (Text) -> Dict[Text, Any]
        """Parse the input text, classify it and return pipeline result.

        The pipeline result usually contains intent and entities."""

        if not text:
            # Not all components are able to handle empty strings. So we need
            # to prevent that... This default return will not contain all
            # output attributes of all components, but in the end, no one should
            # pass an empty string in the first place.
            output = self.default_output_attributes()
            output["text"] = ""
            return output

        message = Message(text, self.default_output_attributes(), time=time)

        for component in self.pipeline:
            component.process(message, **self.context) #here

        output = self.default_output_attributes()


        output.update(message.as_dict(only_output_properties=only_output_properties))
        #output is not printed as_dict works fine!! So it is the update function
        return output`


The return value of as_dict gives the proper dict back. So it works but the output.update seems to malfunction.

I have yet not looked at this update function.

I have the same issue:
OS: CentOS 7.0
pipeline: spacy_sklearn
Will share investigation findings if any soon.

Same Issue, macOS, spacy_sklearn

So the DeprecationWarning is normal (sklearn needs to update its internals to fix this, I looked into it). I don't think the "empty response" issue is related to this.

Can you provide more details on how to reproduce this?

I used the standard example, like I wrote and showed in the first post,

Is it because of some experimental changes due to developer version? I will try an older version soon.

And as I wrote in the 2nd post, the return value of as_dict is fine. So it seem to be the update function...

Same Issue, maybe it is about sklearn's version?

I don't think it is due to the update function, as this is just pythons dict update.

@MnHung which spacy version + model are you using?

As said, the deprecation warning itself is not an issue.

Hi @tmbo
I am using spacy-2.0.8
and thank you, I am sure that rasa_nlu works well.

I used now version 11.3 and still same. I cannot see output of entities and intents etc. if use it wih python. Just the depreciated warning...

Why is the dict not returned properly?

I think that this is a dependacy update issue see scikit-learn/scikit-learn/pull/9816

OS: macOS 10.13.3
pipeline: spacy_sklearn

OS: Ubuntu 16.04
pipeline: spacy_sklearn
spacy.__version__'2.0.9'
sklearn.__version__'0.19.1'

the same error
Use array.size > 0 to check that an array is not empty.
if diff:

scikit-learn/scikit-learn#9816 solved the issue.

But how do I get scikit-learn/scikit-learn#9816 ?
I've tried upgrading both rasa_core and rasa_nlu, but it didn't update _sklearn_

same error

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

same error

it's not really an error so much as a warning, if this is really something you have a problem with then please create a new issue :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lomarceau picture lomarceau  路  3Comments

N-Olbert picture N-Olbert  路  3Comments

anishrav picture anishrav  路  3Comments

karnigili picture karnigili  路  3Comments

nicolasfarina picture nicolasfarina  路  3Comments