Sentiment polarity classification in Italian
This fork of SentITA has been tested with Tensorflow 2.0.0 and Spacy 2.3.2 with the models for Italian. Once installed Spacy it's necessary to run "python -m spacy download it_core_news_sm" to download the models for Italian.
- Dowload Sentita from this link
- Unzip the archive
- cd into the unzipped folder from the console
- type in the console "pip install ." to install the package locally
- Import the function to calculate the polarity scores with the following code:
from sentita import calculate_polarity
- Define your sentences as a list. e.g.:
sentences = ["il film era interessante",
"il cibo è davvero buono",
"il posto era davvero accogliente e i camerieri simpatici, consigliato!"]
- Estimate the sentence polarity by running:
results, polarities = calculate_polarity(sentences)
"results" is a list of strings with the sentence, the positive polarity score and the negative polarity scores. "polarities" is a list of lists with the positive and negative polarity score for each sentence, e.g.:
- polarities[0][0] contains the positive polarity score of the 1st sentence
- polarities[2][0] contains the positive polarity score of the 3rd sentence
- polarities[2][1] contains the negative polarity score of the 3rd sentence