tag2ts problem
When will this condition be satisfied,since it's impossible for the sentiments list to be bigger than one in this condition?
elif pos == 'B': beg = i if len(sentiments) > 1: # remove the effect of the noisy I-{POS,NEG,NEU} #print(sentiments) sentiments = [sentiments[-1]]
Sorry for the late reply.
When tagging_schema is BIEOS, the sentiment tag list (i.e., the variable sentiments) will be emptied if and only if the current boundary tag is "S" or "E".
In the ideal case, we will not meet the next "B-POS/NEG/NEU" until the previous span is completed (i.e., encounter "S-POS/NEG/NEU" or "E-POS/NEG/NEU"), however, this is not guaranteed in the testing phase. Considering the example that the current prediction is "B-POS" and the previous predictions are {"I-NEG", "I-NEG", "I-NEG", "I-POS"}. Since the sentiments will accumulate the noisy sentiment tags, we need to remove them and start from the sentiment tag associated with the current "B".
Oh now I get it. Thank you