# Segmentation for sentiment analysis

**URL:** <https://discuss.huggingface.co/t/segmentation-for-sentiment-analysis/16130>\
**Category:** Beginners\
**Created:** [March 27, 2022, 4:05pm UTC](https://discuss.huggingface.co/t/segmentation-for-sentiment-analysis/16130 "2022-03-27T16:05:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![MahdiA](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/mahdia/32/2700_2.png) [@MahdiA](https://discuss.huggingface.co/u/MahdiA)\
**Post date:** [March 27, 2022, 4:05pm UTC](https://discuss.huggingface.co/t/segmentation-for-sentiment-analysis/16130/1 "2022-03-27T16:05:23Z")

</div>

I have fine-tuned a model for on sentiment analysis task. If we are doing Sentiment Analysis on a long text which includes more than one sentence, should we feed the whole text to model or each sentence of the text separately to model and then make a decision about the whole sentiment?

---

<div class="post-metadata">

**Author:** ![merve](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/merve/32/49809_2.png) [@merve](https://discuss.huggingface.co/u/merve)\
**Post date:** [March 28, 2022, 11:10am UTC](https://discuss.huggingface.co/t/segmentation-for-sentiment-analysis/16130/2 "2022-03-28T11:10:08Z")

</div>

Hello,  
You can simply do

```auto
from transformers import pipeline
pipe = pipeline("text-classification", your_model)
pipe("I was very happy that day. It felt like a dream.")

```

It works on any document, including paragraphs.

---

<div class="post-metadata">

**Author:** ![MahdiA](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/mahdia/32/2700_2.png) [@MahdiA](https://discuss.huggingface.co/u/MahdiA)\
**Post date:** [March 28, 2022, 11:36am UTC](https://discuss.huggingface.co/t/segmentation-for-sentiment-analysis/16130/3 "2022-03-28T11:36:39Z")

</div>

That is true,  
What I mean by that was, if I have two sentences, how can I know the sentiment of the whole text.  
In your example, both sentences are positive, but what will happen when we have one positive and one negative sentence. Is it able to determine the whole sentiment of text or should we divide it to some sentences and calculate each one’s sentiment and then make a decision somehow based on those two results.
