1

when I enter this request:

{
  "text": "
Il sindaco pensa solo a far realizzare rotonde...non lo disturbate per le cavolate! ,Che schifo!
",
  "features": 
  {
  "sentiment": {
"targets": [
        "aggressione", "aggressioni", "agguati", "agguato", "furto", "furti", "lavoro nero", 
        "omicidi", "omicidio", "rapina", "rapine", "ricettazione", "ricettazioni", "rom", "zingari", "zingaro", 
        "scippo", "scippi", "spaccio", "scommesse"
      ]
    },
    "categories": {},
    "entities": {
      "emotion": true,
      "sentiment": true,
      "limit": 5
    },
    "keywords": {
      "emotion": true,
      "sentiment": true,
      "limit": 5
    }
  }
}

I get this response:

{
  "language": "it",
  "keywords": [
    {
      "text": ",Che schifo",
      "relevance": 0.768142
    }
  ],
  "entities": [],
  "categories": [
    {
      "score": 0.190673,
      "label": "/law, govt and politics/law enforcement/police"
    },
    {
      "score": 0.180499,
      "label": "/style and fashion/clothing/pants"
    },
    {
      "score": 0.160763,
      "label": "/society/crime"
    }
  ],
  "warnings": [
    "sentiment: cannot locate keyphrase"
  ]
}

Why I don't receive output for the document sentiment? if NLU does not find the key phrase it gives back this warning without the sentiment for the text! is this a NLU error to fix?

Gi4n57
  • 11
  • 1

1 Answers1

0

If NLU does not find any of the keyphrases you passed, then it would throw the warning "cannot locate keyphrase". It does return the doc sentiment even when one of the targets is present in the text. If you are not sure about the presence of target phrases in your text, make a separate API call just for sentiment without any targets for retrieving document sentiment. I would not say it as a bug on NLU Side but the service can be lenient instead of being strict if it did not find any target phrase in a given text.