This model is designed for texts written in English. Since the original collection reprsent non-english texts, the content has been automatically translated into English using [googletrans].
For the given input sentence and mentioned entity in it (target), this model predict author state by answering one of the following classes:
[positive, negaitive, neutral]
Video Overview
Model Description
Developed by: Reforged by nicolay-r, initial credits for implementation to scofield7419
1deftarget_sentiment_extraction(sentence, target):2# Setup labels.3 labels_list =['neutral','positive','negative']4# Setup Chain-of-Thought5 step1 =f"Given the sentence {sentence}, which specific aspect of {target} is possibly mentioned?"6 aspect = ask(step1)7 step2 =f"{step1}. The mentioned aspect is about {aspect}. Based on the common sense, what is the implicit opinion towards the mentioned aspect of {target}, and why?"8 opinion = ask(step2)9 step3 =f"{step2}. The opinion towards the mentioned aspect of {target} is {opinion}. Based on such opinion, what is the sentiment polarity towards {target}?"10 emotion_state = ask(step3)11 step4 =f"{step3}. The sentiment polarity is {emotion_state}. Based on these contexts, summarize and return the sentiment polarity only, "+"such as: {}.".format(", ".join(labels_list))12# Return the final response.13return ask(step4)
Finally, you can infer model results as follows:
python
1# Input sentence.2sentence ="Over the past 28 years, the leader has been working hard to achieve the release of Peltier and is a member of the Leonard Peltier Defense Committee."3# Input target.4target ="Peltier"5# output response6flant5_response = target_sentiment_extraction(sentence, target)7print(f"Author opinion towards `{target}` in `{sentence}` is:\n{flant5_response}")
The response of the model is as follows:
Author opinion towards "Peltier" in "Over ..." is: positive
Downstream Use
Please refer to the related section of the Reasoning-for-Sentiment-Analysis Framework
With this example it applies this model in the THoR mode to the validation data of the RuSentNE-2023 competition for evaluation.
This model represent a fine-tuned version of the Flan-T5 on RuSentNE-2023 dataset.
Since dataset represent three-scale output answers (positive, negative, neutral),
the behavior in general might be biased to this particular task.
Recommendations
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
We utilize train data which was automatically translated into English using GoogleTransAPI.
The initial source of the texts written in Russian, is from the following repository:
https://github.com/dialogue-evaluation/RuSentNE-evaluation