Skip to content
This repository

Fix test suite for Windows #84

Merged
merged 4 commits into from about 1 year ago

2 participants

Guillaume Cedric Marty Chris Umbel
Guillaume Cedric Marty

This PR contains 2 things:

  • An improved regexp escaping using code from Closure Library
  • A fix for test suites to work on Windows (tested on Windows 7 & Node v0.8.14). I fixed the require() and the line breaks in Italian stemmer tests.

Before merging, please make sure the test is passing on Linux or Mac. I can't test under these OS at the moment.

Chris Umbel
Owner

nice, i'll have a look within the next few days.

Chris Umbel chrisumbel merged commit fa53db6 into from March 06, 2013
Chris Umbel chrisumbel closed this March 06, 2013
Chris Umbel
Owner

thanks much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
234  lib/natural/util/utils.js
... ...
@@ -1,115 +1,119 @@
1  
-/*
2  
- Copyright (c) 2012, Guillaume Marty
3  
-
4  
- Permission is hereby granted, free of charge, to any person obtaining a copy
5  
- of this software and associated documentation files (the "Software"), to deal
6  
- in the Software without restriction, including without limitation the rights
7  
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8  
- copies of the Software, and to permit persons to whom the Software is
9  
- furnished to do so, subject to the following conditions:
10  
-
11  
- The above copyright notice and this permission notice shall be included in
12  
- all copies or substantial portions of the Software.
13  
-
14  
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17  
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19  
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20  
- THE SOFTWARE.
21  
- */
22  
-
23  
-
24  
-/**
25  
- * Generate a replacing function given a table of patterns. Inspired by:
26  
- * http://code.google.com/p/jslibs/wiki/JavascriptTips#String_converter
27  
- * The order of elements is significant. Longer elements should be listed first.
28  
- * @see Speed test http://jsperf.com/build-a-regexp-table
29  
- *
30  
- * @param {Object.<string, string>} translationTable The translation table of key value.
31  
- * @return {function(string): string} A translating function.
32  
- */
33  
-function replacer(translationTable) {
34  
-  /**
35  
-   * An array of translationTable keys.
36  
-   * @type {Array.<string>}
37  
-   */
38  
-  var pattern = [];
39  
-
40  
-  /**
41  
-   * The regular expression doing the replacement job.
42  
-   * @type {RegExp}
43  
-   */
44  
-  var regExp;
45  
-
46  
-  /**
47  
-   * Used to iterate over translationTable.
48  
-   * @type {string}
49  
-   */
50  
-  var key;
51  
-
52  
-  for (key in translationTable) {
53  
-    // Escaping regexp special chars.
54  
-    key = key.replace(/(\^|\$|\*|\+|\?|\.|\(|\)|\[|\]|\{|\}|\||\\|\/)/g, '\\\$1');
55  
-    pattern.push(key);
56  
-  }
57  
-
58  
-  regExp = new RegExp(pattern.join('|'), 'g');
59  
-
60  
-  /**
61  
-   * @param {string} str Input string.
62  
-   * @return {string} The string replaced.
63  
-   */
64  
-  return function(str) {
65  
-    return str.replace(regExp, function(str) {
66  
-      return translationTable[str];
67  
-    });
68  
-  };
69  
-}
70  
-
71  
-
72  
-/**
73  
- * Exchanges all keys with their associated values in an object.
74  
- *
75  
- * @param {Object.<string, string>} obj An object of strings.
76  
- * @return {Object.<string, string>} An object of strings.
77  
- */
78  
-function flip(obj) {
79  
-  var newObj = Object.create(null),
80  
-      key;
81  
-
82  
-  for (key in obj) {
83  
-    newObj[obj[key]] = key;
84  
-  }
85  
-
86  
-  return newObj;
87  
-}
88  
-
89  
-
90  
-/**
91  
- * Merge several objects. Properties from earlier objects are overwritten by
92  
- * laters's in case of conflict.
93  
- *
94  
- * @param {...Object.<string, string>} var_args One or more objects of strings.
95  
- * @return {!Object.<string, string>} An object of strings.
96  
- */
97  
-function merge(var_args) {
98  
-  var args = [].slice.call(arguments),
99  
-      newObj = Object.create(null),
100  
-      id = 0, key;
101  
-
102  
-  while (args[id]) {
103  
-    for (key in args[id]) {
104  
-      newObj[key] = args[id][key];
105  
-    }
106  
-
107  
-    id++;
108  
-  }
109  
-
110  
-  return newObj;
111  
-}
112  
-
113  
-exports.replacer = replacer;
114  
-exports.flip = flip;
115  
-exports.merge = merge;
  1
+/*
  2
+ Copyright (c) 2012, Guillaume Marty
  3
+
  4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
  5
+ of this software and associated documentation files (the "Software"), to deal
  6
+ in the Software without restriction, including without limitation the rights
  7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8
+ copies of the Software, and to permit persons to whom the Software is
  9
+ furnished to do so, subject to the following conditions:
  10
+
  11
+ The above copyright notice and this permission notice shall be included in
  12
+ all copies or substantial portions of the Software.
  13
+
  14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20
+ THE SOFTWARE.
  21
+ */
  22
+
  23
+
  24
+/**
  25
+ * Generate a replacing function given a table of patterns. Inspired by:
  26
+ * http://code.google.com/p/jslibs/wiki/JavascriptTips#String_converter
  27
+ * The order of elements is significant. Longer elements should be listed first.
  28
+ * @see Speed test http://jsperf.com/build-a-regexp-table
  29
+ *
  30
+ * @param {Object.<string, string>} translationTable The translation table of key value.
  31
+ * @return {function(string): string} A translating function.
  32
+ */
  33
+function replacer(translationTable) {
  34
+  /**
  35
+   * An array of translationTable keys.
  36
+   * @type {Array.<string>}
  37
+   */
  38
+  var pattern = [];
  39
+
  40
+  /**
  41
+   * The regular expression doing the replacement job.
  42
+   * @type {RegExp}
  43
+   */
  44
+  var regExp;
  45
+
  46
+  /**
  47
+   * Used to iterate over translationTable.
  48
+   * @type {string}
  49
+   */
  50
+  var key;
  51
+
  52
+  for (key in translationTable) {
  53
+    // Escaping regexp special chars.
  54
+    // @see Speed test for type casting to string http://jsperf.com/string-type-casting/2
  55
+    // @see http://closure-library.googlecode.com/svn/docs/closure_goog_string_string.js.source.html#line956
  56
+    key = ('' + key).replace(/([-()\[\]{}+?*.$\^|,:#<!\\\/])/g, '\\$1').
  57
+      replace(/\x08/g, '\\x08');
  58
+
  59
+    pattern.push(key);
  60
+  }
  61
+
  62
+  regExp = new RegExp(pattern.join('|'), 'g');
  63
+
  64
+  /**
  65
+   * @param {string} str Input string.
  66
+   * @return {string} The string replaced.
  67
+   */
  68
+  return function(str) {
  69
+    return str.replace(regExp, function(str) {
  70
+      return translationTable[str];
  71
+    });
  72
+  };
  73
+}
  74
+
  75
+
  76
+/**
  77
+ * Exchanges all keys with their associated values in an object.
  78
+ *
  79
+ * @param {Object.<string, string>} obj An object of strings.
  80
+ * @return {Object.<string, string>} An object of strings.
  81
+ */
  82
+function flip(obj) {
  83
+  var newObj = Object.create(null),
  84
+      key;
  85
+
  86
+  for (key in obj) {
  87
+    newObj[obj[key]] = key;
  88
+  }
  89
+
  90
+  return newObj;
  91
+}
  92
+
  93
+
  94
+/**
  95
+ * Merge several objects. Properties from earlier objects are overwritten by
  96
+ * laters's in case of conflict.
  97
+ *
  98
+ * @param {...Object.<string, string>} var_args One or more objects of strings.
  99
+ * @return {!Object.<string, string>} An object of strings.
  100
+ */
  101
+function merge(var_args) {
  102
+  var args = [].slice.call(arguments),
  103
+      newObj = Object.create(null),
  104
+      id = 0, key;
  105
+
  106
+  while (args[id]) {
  107
+    for (key in args[id]) {
  108
+      newObj[key] = args[id][key];
  109
+    }
  110
+
  111
+    id++;
  112
+  }
  113
+
  114
+  return newObj;
  115
+}
  116
+
  117
+exports.replacer = replacer;
  118
+exports.flip = flip;
  119
+exports.merge = merge;
2  spec/aggressive_tokenizer_spec.js
@@ -20,7 +20,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 20
 THE SOFTWARE.
21 21
 */
22 22
 
23  
-var Tokenizer = require('lib/natural/tokenizers/aggressive_tokenizer'),
  23
+var Tokenizer = require('../lib/natural/tokenizers/aggressive_tokenizer'),
24 24
     tokenizer = new Tokenizer();
25 25
 
26 26
 describe('aggressive_tokenizer', function() {
2  spec/bayes_classifier_spec.js
@@ -20,7 +20,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 20
 THE SOFTWARE.
21 21
 */
22 22
 
23  
-var natural = require('lib/natural');
  23
+var natural = require('../lib/natural');
24 24
 
25 25
 describe('bayes classifier', function() {
26 26
     describe('classifier', function() {
2  spec/count_inflector_fr_spec.js
@@ -20,7 +20,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 20
 THE SOFTWARE.
21 21
 */
22 22
 
23  
-var CountInflector = (require('lib/natural/inflectors/fr/count_inflector'));
  23
+var CountInflector = (require('../lib/natural/inflectors/fr/count_inflector'));
24 24
 
25 25
 describe('count_inflector', function() {
26 26
   it('should handle 1er cases', function() {
2  spec/count_inflector_spec.js
@@ -20,7 +20,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 20
 THE SOFTWARE.
21 21
 */
22 22
 
23  
-var CountInflector = (require('lib/natural/inflectors/count_inflector'));
  23
+var CountInflector = (require('../lib/natural/inflectors/count_inflector'));
24 24
 
25 25
 describe('count_inflector', function() {
26 26
     it('should handle 1st cases', function() {
2  spec/dice_coefficient_spec.js
... ...
@@ -1,4 +1,4 @@
1  
-var dice = require('lib/natural/distance/dice_coefficient');
  1
+var dice = require('../lib/natural/distance/dice_coefficient');
2 2
 
3 3
 describe('dice', function () {
4 4
 
2  spec/double_metaphone_spec.js
@@ -21,7 +21,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 21
 THE SOFTWARE.
22 22
 */
23 23
 
24  
-var doubleMetaphone = require('lib/natural/phonetics/double_metaphone');
  24
+var doubleMetaphone = require('../lib/natural/phonetics/double_metaphone');
25 25
 
26 26
 describe('double metaphone', function() {
27 27
     it('should drop initial silent consonants', function() {
2  spec/jaro-winkler_spec.js
@@ -20,7 +20,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 20
 THE SOFTWARE.
21 21
 */
22 22
 
23  
-var jaroWinklerDistance = require('lib/natural/distance/jaro-winkler_distance')
  23
+var jaroWinklerDistance = require('../lib/natural/distance/jaro-winkler_distance')
24 24
 
25 25
 Number.prototype.approxEql = function(val) {
26 26
     return Math.abs(this - val) < 1e-5;
2  spec/lancaster_stemmer_spec.js
@@ -21,7 +21,7 @@ THE SOFTWARE.
21 21
 */
22 22
 
23 23
 describe('lancaster_stemmer', function() {
24  
-    var stemmer = require('lib/natural/stemmers/lancaster_stemmer');
  24
+    var stemmer = require('../lib/natural/stemmers/lancaster_stemmer');
25 25
 
26 26
     it('should stem', function() {
27 27
 	stemmer.attach();
2  spec/levenshtein_spec.js
@@ -20,7 +20,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 20
 THE SOFTWARE.
21 21
 */
22 22
 
23  
-var levenshteinDistance = require('lib/natural/distance/levenshtein_distance')
  23
+var levenshteinDistance = require('../lib/natural/distance/levenshtein_distance')
24 24
 
25 25
 describe('levenshtein_distance', function() {
26 26
 	it('should replace 2', function() {
2  spec/logistic_regression_classifier_spec.js
@@ -20,7 +20,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 20
 THE SOFTWARE.
21 21
 */
22 22
 
23  
-var natural = new require('lib/natural'),
  23
+var natural = new require('../lib/natural'),
24 24
     LogisticRegressionClassifier = natural.LogisticRegressionClassifier;
25 25
 
26 26
 describe('logistic regression', function() {
2  spec/metaphone_spec.js
@@ -20,7 +20,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 20
 THE SOFTWARE.
21 21
 */
22 22
 
23  
-var metaphone = require('lib/natural/phonetics/metaphone');
  23
+var metaphone = require('../lib/natural/phonetics/metaphone');
24 24
 
25 25
 describe('metaphone', function() {    
26 26
     it('should drop duplicate adjacent letters, except C', function() {
2  spec/ngram_spec.js
@@ -20,7 +20,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 20
 THE SOFTWARE.
21 21
 */
22 22
 
23  
-var NGrams = require('lib/natural/ngrams/ngrams');
  23
+var NGrams = require('../lib/natural/ngrams/ngrams');
24 24
 
25 25
 describe('ngrams', function() {
26 26
     it('should bigram a string via ngrams', function() {
4  spec/normalizer_ja_spec.js
@@ -20,8 +20,8 @@
20 20
  THE SOFTWARE.
21 21
  */
22 22
 
23  
-var normalize_ja = require('lib/natural/normalizers/normalizer_ja').normalize_ja;
24  
-var converters = require('lib/natural/normalizers/normalizer_ja').converters;
  23
+var normalize_ja = require('../lib/natural/normalizers/normalizer_ja').normalize_ja;
  24
+var converters = require('../lib/natural/normalizers/normalizer_ja').converters;
25 25
 
26 26
 describe('normalize_ja', function() {
27 27
   it('should fix badly formed hiragana', function() {
2  spec/noun_inflector_fr_spec.js
@@ -20,7 +20,7 @@
20 20
  THE SOFTWARE.
21 21
  */
22 22
 
23  
-var NounInflector = require('lib/natural/inflectors/fr/noun_inflector'),
  23
+var NounInflector = require('../lib/natural/inflectors/fr/noun_inflector'),
24 24
     inflector = new NounInflector();
25 25
 
26 26
 describe('NounInflector', function() {
2  spec/noun_inflector_ja_spec.js
@@ -20,7 +20,7 @@
20 20
  THE SOFTWARE.
21 21
  */
22 22
 
23  
-var NounInflector = require('lib/natural/inflectors/ja/noun_inflector'),
  23
+var NounInflector = require('../lib/natural/inflectors/ja/noun_inflector'),
24 24
     inflector = new NounInflector();
25 25
 
26 26
 describe('NounInflector', function() {
2  spec/noun_inflector_spec.js
@@ -20,7 +20,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 20
 THE SOFTWARE.
21 21
 */
22 22
 
23  
-var NounInflector = require('lib/natural/inflectors/noun_inflector'),
  23
+var NounInflector = require('../lib/natural/inflectors/noun_inflector'),
24 24
     inflector = new NounInflector();
25 25
 
26 26
 describe('noun inflector', function() {
35  spec/porter_stemmer_it_spec.js
@@ -19,25 +19,26 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 19
 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 20
 THE SOFTWARE.
21 21
 */
  22
+
22 23
 var stemmer = require('lib/natural/stemmers/porter_stemmer_it');
23 24
 var fs = require('fs');
24 25
 
25 26
 describe('porter_stemmer_it', function() {
26  
-	it('should perform stem', function() {
27  
-		fs.readFileSync('spec/test_data/snowball_it.txt').toString().split('\n').forEach(
28  
-			function (line) { 
29  
-				if (line) {
30  
-					var fields = line.split(' -> ');
31  
-					var stemmed = stemmer.stem(fields[0]);	
32  
-					expect(stemmed).toEqual(fields[1]);
33  
-				}
34  
-			}
35  
-		);
36  
-	}),
37  
-	it('should tokenize and stem attached', function() {
38  
-		stemmer.attach();
  27
+  it('should perform stem', function() {
  28
+    fs.readFileSync('spec/test_data/snowball_it.txt').toString().replace(/\r/g, '\n').split('\n').forEach(
  29
+      function(line) {
  30
+        if (line) {
  31
+          var fields = line.split(' -> ');
  32
+          var stemmed = stemmer.stem(fields[0]);
  33
+          expect(stemmed).toEqual(fields[1]);
  34
+        }
  35
+      }
  36
+    );
  37
+  });
  38
+  it('should tokenize and stem attached', function() {
  39
+    stemmer.attach();
39 40
 
40  
-		expect('SOPRA la panca la capra CAMPA'.tokenizeAndStem()).toEqual([ 'sopr', 'panc', 'capr', 'camp' ]);
41  
-		expect('SOTTO la panca la capra CREPA'.tokenizeAndStem()).toEqual([ 'sott', 'panc', 'capr', 'crep' ]);
42  
-	});
43  
-});
  41
+    expect('SOPRA la panca la capra CAMPA'.tokenizeAndStem()).toEqual([ 'sopr', 'panc', 'capr', 'camp' ]);
  42
+    expect('SOTTO la panca la capra CREPA'.tokenizeAndStem()).toEqual([ 'sott', 'panc', 'capr', 'crep' ]);
  43
+  });
  44
+});
2  spec/porter_stemmer_ru_spec.js
@@ -19,7 +19,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 19
 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 20
 THE SOFTWARE.
21 21
 */
22  
-var stemmer = require('lib/natural/stemmers/porter_stemmer_ru');
  22
+var stemmer = require('../lib/natural/stemmers/porter_stemmer_ru');
23 23
 
24 24
 var test = [
25 25
 	'в', 'вавиловка', 'вагнера', 'вагон', 'вагона', 'вагоне', 'вагонов', 'вагоном', 'вагоны',
2  spec/porter_stemmer_spec.js
@@ -20,7 +20,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 20
 THE SOFTWARE.
21 21
 */
22 22
 
23  
-var stemmer = require('lib/natural/stemmers/porter_stemmer');
  23
+var stemmer = require('../lib/natural/stemmers/porter_stemmer');
24 24
 
25 25
 describe('porter_stemmer', function() {
26 26
 	it('should perform step 1a', function() {
2  spec/present_verb_inflector_spec.js
@@ -20,7 +20,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 20
 THE SOFTWARE.
21 21
 */
22 22
 
23  
-var VerbInflector = require('lib/natural/inflectors/present_verb_inflector'),
  23
+var VerbInflector = require('../lib/natural/inflectors/present_verb_inflector'),
24 24
     inflector = new VerbInflector ();
25 25
 
26 26
 describe('present verb inflector', function() {
2  spec/sentence_analyzer_spec.js
@@ -20,7 +20,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 20
 THE SOFTWARE.
21 21
 */
22 22
 
23  
-var SentenceAnalyzer = require('lib/natural/analyzers/sentence_analyzer');
  23
+var SentenceAnalyzer = require('../lib/natural/analyzers/sentence_analyzer');
24 24
 
25 25
 describe('sentence analyzer', function() {
26 26
     it('should load', function() {
2  spec/soundex_spec.js
@@ -20,7 +20,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 20
 THE SOFTWARE.
21 21
 */
22 22
 
23  
-var soundex = require('lib/natural/phonetics/soundex');
  23
+var soundex = require('../lib/natural/phonetics/soundex');
24 24
 
25 25
 describe('soundex', function() {   
26 26
     describe('transformLipps', function() {
2  spec/stemmer_ja_spec.js
@@ -20,7 +20,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 20
 THE SOFTWARE.
21 21
 */
22 22
 
23  
-var StemmerJa = require('lib/natural/stemmers/stemmer_ja');
  23
+var StemmerJa = require('../lib/natural/stemmers/stemmer_ja');
24 24
 var stemmer = new StemmerJa();
25 25
 
26 26
 var test = ['コピー', 'コーヒー', 'タクシー', 'パーティー', 'パーティ', 'ヘルプ・センター'];
2  spec/tfidf_spec.js
@@ -20,7 +20,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 20
 THE SOFTWARE.
21 21
 */
22 22
 
23  
-var TfIdf = require('lib/natural/tfidf/tfidf');
  23
+var TfIdf = require('../lib/natural/tfidf/tfidf');
24 24
 var tfidf;
25 25
         
26 26
 describe('tfidf', function() {
4  spec/tokenizer_ja_spec.js
@@ -20,7 +20,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 20
 THE SOFTWARE.
21 21
 */
22 22
 
23  
-var Tokenizer = require('lib/natural/tokenizers/tokenizer_ja'),
  23
+var Tokenizer = require('../lib/natural/tokenizers/tokenizer_ja'),
24 24
     tokenizer = new Tokenizer();
25 25
 
26 26
 var text = '計算機科学における字句解析 (じくかいせき、英: Lexical Analysis) とは、ソースコードを構成する文字の並びを、トークン (token) の並びに変換することをいう。\n' +
@@ -47,7 +47,7 @@ describe('TokenizerJa', function() {
47 47
   });
48 48
 
49 49
   it('should normalize input', function() {
50  
-    var converters = require('lib/natural/normalizers/normalizer_ja').converters;
  50
+    var converters = require('../lib/natural/normalizers/normalizer_ja').converters;
51 51
     var tokens = tokenizer.tokenize(
52 52
         converters.halfwidthToFullwidth.alphabet(
53 53
         converters.halfwidthToFullwidth.numbers(
2  spec/transliterator_ja_spec.js
@@ -20,7 +20,7 @@
20 20
  THE SOFTWARE.
21 21
  */
22 22
 
23  
-var transliterate_ja = require('lib/natural/transliterators/ja');
  23
+var transliterate_ja = require('../lib/natural/transliterators/ja');
24 24
 
25 25
 describe('transliterate_ja', function() {
26 26
   it('should transliterate hiragana', function() {
2  spec/treebank_word_tokenizer_spec.js
@@ -20,7 +20,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 20
 THE SOFTWARE.
21 21
 */
22 22
 
23  
-var Tokenizer = require('lib/natural/tokenizers/treebank_word_tokenizer'),
  23
+var Tokenizer = require('../lib/natural/tokenizers/treebank_word_tokenizer'),
24 24
   tokenizer = new Tokenizer();
25 25
 
26 26
 describe('treebank', function() {
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.