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:
redefine scores = [0.0, 0.0, 0.0] in the Professor's review method to ensure it is of type List[float];
define the array scores to have entries of type float in the Pipeline static method postprocess.
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 withneutral
sentiment and withscores = [0, 0, 0]
. Notable, the entries inscores
are of typeint
.The problem is that, further down the pipeline in the preprocessing step,
scores
is required to be an array of typefloat
in order to be normalised. If we pass[0, 0, 0]
to the postprocessing step, the following error will be raised:Main contribution
This PR does two things to ensure that
scores
can be successfully normalised:scores = [0.0, 0.0, 0.0]
in theProfessor
'sreview
method to ensure it is of typeList[float]
;scores
to have entries of typefloat
in thePipeline
static methodpostprocess
.