-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Abstracted out settings to a settings file. For now, some of the R co…
…de lives while I debat where it should live.
- Loading branch information
1 parent
995e317
commit f4bd470
Showing
2 changed files
with
52 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
### Server Settings ############################################################ | ||
# The host and port to bind the server to | ||
host = "192.168.1.3" | ||
port = 8348 | ||
|
||
### Application Settings ####################################################### | ||
# The path to save images in | ||
imagePath = "images/" | ||
|
||
# The default search to display in the textbox | ||
defaultImage = "happy, sad" | ||
# The default image to display when the showing the page with no query | ||
defaultSearch = "images/example.png" | ||
|
||
# The file containing the html template for the app | ||
mainTemplate = "twitter-sentiment-query.html" | ||
|
||
|
||
### R Code & Settings ########################################################### | ||
# R file containing the setup code (load libraries and define score.sentiment) | ||
r_setup = "R-setup.R" | ||
|
||
# The R code for creating the list of sentiment scores from the tweets | ||
r_calculate_sentiment = """\ | ||
%(var)s.text <- %(tweet_text)s | ||
%(var)s.scores <- score.sentiment(%(var)s.text, pos.words, neg.words) | ||
%(var)s.scores$Project = "%(search)s" | ||
""" | ||
|
||
# The R code for creating the histogram of the resulting scores | ||
r_generate_graph = """\ | ||
allscores <- rbind(%(variables.scores)s) | ||
ggplot(data=allscores) + geom_bar(mapping=aes(x=score, fill=Project),\ | ||
binwidth=1) + facet_grid(Project~.) + theme_bw()\ | ||
+ scale_fill_brewer() | ||
ggsave(file="%(path)s") | ||
dev.off() | ||
""" |