Lemmatization and selection of specific types
Important prerequisities: download the file at the following link, create a directory and decompress its content in it.
This example creates a data set in which for each sentence there will be the final sentiment that was evaluated by considering a specific procedure that takes into account negations and multipliers.
The first step (dictionary dict=dictionary.Dizionario_sentiment_it_base; run;) permits to access an ADaMSoft data set that was created on another PC.
The second step (Proc sentiment;...run;) evaluates the sum of the weights for each negative or positive term.
The last step (Dataset;...run;) evaluates the sentiment as the ratio between: (the sum of the weight of the positive and of the negations of the negative terms)/(sum of the weights of the positive and of the negative terms, plus of their negations).
In order to run this example just paste the following statements in the Command area and press the button: EXECUTE. To view the content of the resulting data set go in the PATH tab and refer to the one named totals_Sentiment_sentences.
Important prerequisities: download the file at the following link, create a directory and decompress its content in it.
This example creates a data set in which for each sentence there will be the final sentiment that was evaluated by considering a specific procedure that takes into account negations and multipliers.
The first step (dictionary dict=dictionary.Dizionario_sentiment_it_base; run;) permits to access an ADaMSoft data set that was created on another PC.
The second step (Proc sentiment;...run;) evaluates the sum of the weights for each negative or positive term.
The last step (Dataset;...run;) evaluates the sentiment as the ratio between: (the sum of the weight of the positive and of the negations of the negative terms)/(sum of the weights of the positive and of the negative terms, plus of their negations).
In order to run this example just paste the following statements in the Command area and press the button: EXECUTE. To view the content of the resulting data set go in the PATH tab and refer to the one named totals_Sentiment_sentences.
define directory_treetagger=WRITE HERE THE PATH OF THE DIRECTORY WHERE THE PREREQUISITIES FILES WERE EXTRACTED, BY USING THE CHARACTER "/" INSTEAD OF "\"; path dictionary=&directory_treetagger; dictionary dict=dictionary.Dizionario_sentiment_it_base; changedatapath dictionary; run; Proc Sentiment dict=Selected_Lemmas_sentences dictsentiment=dictionary.Dizionario_sentiment_it_base out=sentiment_sentences; varphrase sentence; varrefterm lemma; varrefweight weight; varrefpolarity polarity; negations non tuttavia peraltro anzi eppure però bensì né mai nemmeno neppure senza mica neanche; term_multiplier verbo_condizionale=0.8=0:1; term_multiplier abbastanza=0.7=2:2; term_multiplier almeno=0.7=2:2; term_multiplier appena=0.7=2:0; term_multiplier po'=0.7=2:0; term_multiplier pochissimo=0.6=2:0; term_multiplier quasi=0.7=2:0; term_multiplier poco=0.6=2:0; term_multiplier meno=0.7=2:0; term_multiplier potenzialmente=0.8=2:0; term_multiplier limitatamente=0.8=2:0; term_multiplier lentamente=0.7=2:2; term_multiplier leggermente=0.7=2:2; term_multiplier marginalmente=0.6=2:2; term_multiplier moderatamente=0.7=2:2; term_multiplier parzialmente=0.7=2:2; term_multiplier lieve=0.6=2:2; term_multiplier lievemente=0.6=2:2; term_multiplier alquanto=1.1=2:2; term_multiplier estremamente=1.2=2:2; term_multiplier palesemente=1.2=2:0; term_multiplier piuttosto=1.1=2:0; term_multiplier specialmente=1.1=2:2; term_multiplier veramente=1.1=2:0; term_multiplier molto=1.2=3:2; term_multiplier più=1.1=2:0; term_multiplier maggiormente=1.1=2:2; term_multiplier oltre=1.2=2:1; term_multiplier largamente=1.2=2:1; term_multiplier ulteriormente=1.2=2:1; term_multiplier particolarmente=1.1=2:1; term_multiplier considerevolmente=1.1=2:1; term_multiplier principalmente=1.1=2:1; term_multiplier ampiamente=1.2=2:1; term_multiplier altamente=1.2=2:1; term_multiplier decisamente=1.2=2:1; term_multiplier definitivamente=1.2=2:1; term_multiplier eccessivamente=1.1=2:1; term_multiplier fortemente=1.2=2:1; term_multiplier prevalentemente=1.1=2:1; term_multiplier significativamente=1.1=2:1; term_multiplier notevolmente=1.2=2:1; term_multiplier ma=-0.7=0:2; term_multiplier affatto=-0.7=2:2; term_multiplier malgrado=-0.5=0:2; term_multiplier difficilmente=-0.7=2:1; term_multiplier malapena=-0.8=2:1; term_multiplier minimamente=-0.8=2:1; run; dataset dict=Sentiment_sentences out=totals_Sentiment_sentences; newvar sentiment=num; sentiment=100*(polarity_2+polarity_1_neg)/(polarity_1+polarity_2+polarity_1_neg+polarity_2_neg); if (polarity_1+polarity_2+polarity_1_neg+polarity_2_neg>0) output; keep vardescriptor sentiment; run; |