Skip to content

Commit

Permalink
Remove dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
nlpist committed Mar 17, 2015
1 parent 392e0a0 commit 3111da9
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions test/classifiersTest/NeuralWithSpellCheckerTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
*/

var should = require('should');
var _ = require('underscore')._;
var classifiers = require('../../classifiers');
var ftrs = require('../../features');
var natural = require('natural');


var RegexpTokenizer = function(options) {
Expand All @@ -18,7 +18,8 @@ var RegexpTokenizer = function(options) {


RegexpTokenizer.prototype.tokenize = function(s) {
return s.match(this._pattern);
var results = s.split(this._pattern)
return _.without(results,'',' ')
};


Expand Down Expand Up @@ -53,7 +54,7 @@ describe('classifier with spell-checker', function() {
var spamClassifier = new classifiers.EnhancedClassifier({
classifierType: classifiers.NeuralNetwork,
featureExtractor: ftrs.NGramsOfWords(1),
tokenizer: new natural.RegexpTokenizer({pattern: /[^a-zA-Z0-9%'$,]+/}),
tokenizer: new RegexpTokenizer({pattern: /[^a-zA-Z0-9%'$,]+/}),
spellChecker: [wordsworth.getInstance(), wordsworth.getInstance()]
});

Expand All @@ -67,3 +68,6 @@ describe('classifier with spell-checker', function() {
spamClassifier.classify("expensive clocks").should.be.below(0.4); // (not spam)
}: null)
});


exports.RegexpTokenizer = RegexpTokenizer;

0 comments on commit 3111da9

Please sign in to comment.