shashank-gv / hugging

0 stars 0 forks source link

SENTIMENT: Feature request #6

Open gjwgit opened 2 years ago

gjwgit commented 2 years ago

A SENTIMENT command would be a useful addition.

$ ml sentiment hugging What a beautiful day it is today.
"What a beautiful day it is today.",positive
$ ml sentiment hugging samples.txt
"I really like the new content of your book.",positive
"I’m not sure if I like the new design.",negative
"The new design is awful.",negative
$ cat samples.txt | ml sentiment hugging
"I really like the new content of your book.",positive
"I’m not sure if I like the new design.",negative
"The new design is awful.",negative
shashank-gv commented 2 years ago

Have included a sentiment command. This should work for the first two cases (also have included sent_text.txt to be in the /.mlhub/ folder for testing purposes. Still need to fix some kinks with regard to stdin and the working directory.

gjwgit commented 2 years ago

Thanks. Looks good. It is often useful to also include examples in the issue here so others can see what to expect:

$ ml sentiment hugging sent_text.txt 
"I really like the new content of your book." , POSITIVE, 0.9998065829277039
"I’m not sure if I like the new design." , NEGATIVE, 0.9992893934249878
"The new design is awful." , NEGATIVE, 0.9998010993003845

This does not work for me though:

$ ml sentiment hugging What a beautiful day it is today.
usage: sentiment.py [-h] text
sentiment.py: error: unrecognized arguments: a beautiful day it is today.
shashank-gv commented 2 years ago

Ah this is an interesting error. It works with quotes for my python script. so,

user@hubert:~/hugging$ /usr/bin/python3 /home/user/hugging/sentiment.py "What a beautiful day it is today"
What a beautiful day it is today , POSITIVE, 0.9998657703399658

However it does not work with the ml sentiment hugging command. Will look into this.

gjwgit commented 2 years ago

Also the command should accept input from STDIN

$ ml summarize hugging https://www.abc.net.au/news/2022-09-22/nasa-releases-clearest-view-of-neptunes-rings-in-decades/101466864 | head -1 | ml sentiment hugging
shashank-gv commented 2 years ago

Should be accepting inputs from stdin now