Closed MalteMagnussen closed 4 years ago
Would be cool to include the programs help in the readme using something like https://carbon.now.sh/
Example (Solarized Dark w/ bash):
Starting the server
cd
into the modules
folderpython
to run the flask_service.py
Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
in the terminal (this might take a while (~40 seconds) since the machine learning model is trained once every time the server is started)Using the endpoint
The server exposes a single endpoint /api/sentiment
where you have to make all your requests.
Use Postman or a similar tool to test the server at http://localhost:5000/api/sentiment
- we have not deployed the server. There is not UI for the server so every request has to be made in a tool like Postman.
(Showing examples from Postman)
Preview
and copy everything after Example:
. Paste it into the body of your request{ "hashtags": [ "trump", "biden" ], "start_date": "2020-5-17", "end_date": "2020-5-22", "plot_type": "line", "remove_sentiment": "Uncertain", "tweet_count": 300, "fresh_search": true }
Explanation of search options Data gathering
"hashtags": [ "trump", "biden" ]
hashtags
Data filtering
"start_date": "2020-5-17"
"end_date": "2020-5-22"
"plot_type": "line"
bar
, line
and pie
line
plot (the other types may not work)Positive
tweets or Negative
tweets or the ones with a mixed sentiment (Uncertain
)
"remove_sentiment": "Uncertain"
"tweet_amount": 300
"fresh_search": true
"search_for": { "mentions": "@JoeBiden" }
"search_for": { "hashtags": "#trump" }
mentions
or hashtags
. The value should match the key so if the key is mentions
then the value must begin with @
mentions
option) since it in most cases filters away all the data resulting in an empty plot or no plot at all"get_stats": "hashtags"
"hashtags"
and "mentions"
@realDonaldTrump
has been mentioned ten times then you can do a new search with these options:
{ "hashtags": [ "trump", "biden" ], "start_date": "2020-5-17", "end_date": "2020-5-22", "plot_type": "line", "search_for": { "mentions": "@realDonaldTrump" }, "tweet_count": 300, "fresh_search": false }
to find the sentiment of those tweets. Overall Recommendation
"trump"
and "biden"
"Uncertain"
sentiment"line"
as plot typeJSON: { "hashtags": [ "trump", "biden" ], "start_date": "2020-5-12", "remove_sentiment": "Uncertain", "end_date": "2020-5-22", "plot_type": "line", "tweet_amount": 300 }
How to use the Flask server
This is really good Asger!
CLI is in #28
Yes.
The whole README needs an overhaul I think
CLI is in #28
I just saw, that is also really looking good. Gj guys!
Desuden skal github repoet indeholde en README.md fil med følgende:
Det der skal afleveres på wiseflow er et link til github (sikkert i form af et dokument med et link på wiseflow). Github linket skal indeholde jeres løsning i form af .py filer (evt. en enkelt .ipynb fil til at starte programmet op fra, hvis man ønsker det).