Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/sentimental.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function negativity (phrase) {
adjectives.push(t);
};

var noPunctuation = phrase.replace(/[^a-zA-Z ]+/g, '').replace('/ {2,}/',' '),
var noPunctuation = phrase.replace(/[^a-zA-Z ]+/g, ' ').replace('/ {2,}/',' '),
tokens = noPunctuation.toLowerCase().split(" "),
hits = 0,
words = [],
Expand Down Expand Up @@ -79,7 +79,7 @@ function positivity (phrase) {
adjectives.push(t);
};

var noPunctuation = phrase.replace(/[^a-zA-Z ]+/g, '').replace('/ {2,}/',' '),
var noPunctuation = phrase.replace(/[^a-zA-Z ]+/g, ' ').replace('/ {2,}/',' '),
tokens = noPunctuation.toLowerCase().split(" "),
hits = 0,
words = [],
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
"name": "Sentimental",
"description": "Sentiment Analysis module",
"repository": "git://github.com/thinkroth/Sentimental",
"version": "0.0.2",
"version": "0.0.3",
"author": "Kevin M Roth",
"dependencies": {
},
"scripts": {
"test": "make test"
},
"devDependencies": {
"mocha": "0.10.0",
"should": "0.6.0"
"mocha": "1.9.0",
"should": "1.2.2"
}
}
}
12 changes: 12 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,12 @@ describe('Negativity', function () {
done();
});
});
describe('#negativeComparative', function () {
it('should properly handle punctuation', function (done) {
negativity("I'll be here till 5").score.should.equal(0);
done();
});
});
});


Expand Down Expand Up @@ -197,6 +203,12 @@ describe('Positivity', function () {
done();
});
});
describe('#positiveComparative', function () {
it('should properly handle punctuation', function (done) {
positivity("I'll be here till 5").score.should.equal(0);
done();
});
});
});

describe('Analyze', function () {
Expand Down