Skip to content

Commit

Permalink
Merge pull request #174 from evenkeeler/sentiment
Browse files Browse the repository at this point in the history
(feat) Add naive sentiment output
  • Loading branch information
jmg2107 authored Aug 25, 2016
2 parents e804564 + 714cef2 commit dfa701f
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
6 changes: 5 additions & 1 deletion server/network/network.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ var trainingSet = [
{
input: [0,1,0,0,0,0,0,0,0,0,0,0,0,0], //rush
output: [1,0,0,0,0,0,0] //stressed
}
},
{
input: [1,0,0,0,0,0,0,0,0,0,0,0,0,0], //deadline
output: [1,0,0,0,0,0,0] //stressed
Expand Down Expand Up @@ -174,6 +174,10 @@ var moodTranslator = function(input){
console.log("mood translated is: " + moodTranslator(dailyMood));
var currentMood = moodTranslator(dailyMood)

module.exports = {
normWeeklyKeywords: normWeeklyKeywords
};

//Input (keywords)
// var wordNorm = {
// love :[0,0,0,0,0,0,0,0,0,0,0,0,0,1],
Expand Down
4 changes: 4 additions & 0 deletions server/routes.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
var requestHandler = require('./requestHandler.js');
var postRequestHandler = require('./postsRequestHandler.js');
var mixtapeRequestHandler = require('./request-handlers/mixtape.js');
var sentimentRequestHandler = require('./sentimentRequestHandler.js');

module.exports = function (app, express){
app.get('/api/google/login', requestHandler.googleLogin);
Expand All @@ -24,6 +25,9 @@ module.exports = function (app, express){
app.post('/api/soundcloud-search', mixtapeRequestHandler.searchSoundCloud);
app.post('/api/delete-song', mixtapeRequestHandler.deleteSong);

/** sentiment **/
app.get('/api/sentiment', sentimentRequestHandler.sendBackData);

//tester routes
// app.post('/api/users', postRequestHandler.createUser);
// app.put('/api/users', postRequestHandler.updateUser);
Expand Down
19 changes: 19 additions & 0 deletions server/sentimentRequestHandler.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
var normWeeklyKeywords = require('./network/network.js').normWeeklyKeywords;

var dummyData = {
monday: ['ok', 'love', 'eager', 'fine', 'rush', 'hurray'],
tuesday: ['cry', 'sorry', 'sorry', 'frustrated', 'tired', 'tired', 'fine'],
wednesday: ['eager', 'fine', 'frustrated', 'fine', 'ok'],
thursday: ['eager', 'fine', 'rush', 'deadline', 'tired', 'ok', 'cry'],
friday: ['ok', 'cool', 'cool', 'relax', 'eager', 'good', 'love'],
saturday: ['love', 'love', 'eager', 'hurray', 'good', 'cool', 'fine'],
sunday: ['relax', 'cool', 'ok', 'fine', 'relax', 'tired', 'ok', 'hurray']
}


exports.sendBackData = function(req, res, next){
// console.log(normWeeklyKeywords(dummyData));
console.log(normWeeklyKeywords(dummyData));
res.status(200).send(normWeeklyKeywords(dummyData));
}

0 comments on commit dfa701f

Please sign in to comment.