ScalaConsultants / Aspect-Based-Sentiment-Analysis

đŸ’­ Aspect-Based-Sentiment-Analysis: Transformer & Explainable ML (TensorFlow)
Apache License 2.0
543 stars 90 forks source link

Asaad fix reference recognizer #64

Open xesaad opened 2 years ago

xesaad commented 2 years ago

Context and description of issue

In this issue (part 2) I identified an issue with the BasicReferenceRecognizer. Namely, when no reference to an aspect is detected, the auxiliary model overrides the prediction from ABSA with neutral sentiment and with scores = [0, 0, 0]. Notable, the entries in scores are of type int.

The problem is that, further down the pipeline in the preprocessing step, scores is required to be an array of type float in order to be normalised. If we pass [0, 0, 0] to the postprocessing step, the following error will be raised:

TypeError: ufunc 'true_divide' output (typecode 'd') could not be coerced to provided output parameter (typecode 'l') according to the casting rule ''same_kind''

Main contribution

This PR does two things to ensure that scores can be successfully normalised: