1 |
|
2 | var mocha = require("mocha");
|
3 | var should = require("should");
|
4 | var norm = require("../index");
|
5 |
|
6 | describe('Normalizer', function(){
|
7 |
|
8 | before(function(done){
|
9 | norm.loadData(function(){
|
10 | done();
|
11 | });
|
12 | });
|
13 |
|
14 | describe('Should clean input', function() {
|
15 |
|
16 | it("should replace subsitutes", function() {
|
17 | norm.clean("Nov 1st I weighed 90 kgs. total").should.eql("November 1st I weighed 90 kilograms total");
|
18 | norm.clean("I shared it on FB w/ friends, ie: you").should.eql("I shared it on Facebook with friends, for example : you");
|
19 | });
|
20 |
|
21 | it("should expand contractions", function() {
|
22 | norm.clean("I'm on the yelow zebra").should.eql("I am on the yellow zebra");
|
23 | norm.clean("I'll listen to y'all").should.eql("I will listen to you all");
|
24 | norm.clean("do n't make it right").should.eql("do not make it right");
|
25 | norm.clean("it's all good").should.eql("it is all good");
|
26 | });
|
27 |
|
28 | it("should swap british / canadian words", function() {
|
29 | norm.clean("armour axe coloured gold").should.eql("armor ax colored gold");
|
30 | });
|
31 |
|
32 | it("should fix spelling", function() {
|
33 | norm.clean("are we sceduled thrsday for teh restraunt").should.eql("are we scheduled Thursday for the restaurant");
|
34 | });
|
35 |
|
36 | it("should expand txt speak", function() {
|
37 | norm.clean("n").should.eql("~no");
|
38 | norm.clean("lol").should.eql("~emolaugh");
|
39 | norm.clean("haha").should.eql("~emolaugh");
|
40 | norm.clean(":)").should.eql("~emohappy");
|
41 | });
|
42 |
|
43 | it("should not remove +", function() {
|
44 | norm.clean("3+4=7").should.eql("3+4=7");
|
45 | });
|
46 |
|
47 | it("should remove extra spaces", function() {
|
48 | norm.clean("this is spaced out").should.eql("this is spaced out");
|
49 | });
|
50 |
|
51 | it("should remove punct", function() {
|
52 | norm.clean("why do i care?").should.eql("why do I care");
|
53 | });
|
54 |
|
55 | it("Fix numbers", function() {
|
56 | norm.clean("how much is 1,000.00").should.eql("how much is 1000.00");
|
57 | });
|
58 |
|
59 |
|
60 | });
|
61 | }); |
\ | No newline at end of file |