natural 0.2.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.npmignore +4 -11
- package/README.md +156 -41
- package/bayes_classifier.json +1 -0
- package/lib/natural/brill_pos_tagger/data/Dutch/README.txt +2 -0
- package/lib/natural/brill_pos_tagger/data/Dutch/brill_CONTEXTRULES.jg +285 -0
- package/lib/natural/brill_pos_tagger/data/Dutch/brill_LEXICON.jg +11699 -0
- package/lib/natural/brill_pos_tagger/data/English/README.txt +8 -0
- package/lib/natural/brill_pos_tagger/data/English/lexicon_from_posjs.json +297827 -0
- package/lib/natural/brill_pos_tagger/data/English/tr_from_brill_paper.txt +10 -0
- package/lib/natural/brill_pos_tagger/data/English/tr_from_posjs.txt +18 -0
- package/lib/natural/brill_pos_tagger/lib/Brill_POS_Tagger.js +136 -0
- package/lib/natural/brill_pos_tagger/lib/Predicate.js +410 -0
- package/lib/natural/brill_pos_tagger/lib/TF_Parser.js +717 -0
- package/lib/natural/brill_pos_tagger/lib/TF_Parser.pegjs +55 -0
- package/lib/natural/brill_pos_tagger/lib/TransformationRule.js +49 -0
- package/lib/natural/classifiers/bayes_classifier.js +6 -5
- package/lib/natural/classifiers/classifier.js +3 -2
- package/lib/natural/classifiers/logistic_regression_classifier.js +9 -5
- package/lib/natural/distance/dice_coefficient.js +22 -12
- package/lib/natural/index.js +6 -0
- package/lib/natural/ngrams/ngrams.js +4 -0
- package/lib/natural/stemmers/stemmer.js +31 -6
- package/lib/natural/tokenizers/regexp_tokenizer.js +3 -3
- package/{examples/inflection/noun.js → lib/natural/tokenizers/sentence_tokenizer.js} +14 -10
- package/lib/natural/tokenizers/tokenizer_case.js +58 -0
- package/lib/natural/util/bag.js +1 -0
- package/lib/natural/wordnet/wordnet.js +2 -2
- package/lib/natural/wordnet/wordnet_file.js +1 -1
- package/lr_classifier.json +1 -0
- package/package.json +6 -3
- package/package.json~ +66 -0
- package/benchmarks/index.js +0 -32
- package/benchmarks/metaphone.js +0 -27
- package/benchmarks/soundex.js +0 -27
- package/examples/classification/basic.js +0 -35
- package/examples/classification/recall.js +0 -28
- package/examples/classification/store.js +0 -37
- package/examples/inflection/count.js +0 -35
- package/examples/inflection/noun_attach.js +0 -33
- package/examples/phonetics/compare.js +0 -39
- package/examples/phonetics/sounds_like.js +0 -40
- package/examples/phonetics/tokenize_and_phoneticize.js +0 -54
- package/examples/stemming/stem_corpus.js +0 -29
- package/examples/stemming/stem_word.js +0 -26
- package/examples/tfidf/array_example.js +0 -34
- package/examples/tfidf/multiple_terms.js +0 -33
- package/examples/tfidf/tfidf_example.js +0 -44
- package/io_spec/test_data/tfidf/one +0 -1
- package/io_spec/test_data/tfidf/two +0 -1
- package/io_spec/tfidf_spec.js +0 -50
- package/io_spec/wordnet_spec.js +0 -81
- package/spec/aggressive_tokenizer_es_spec.js +0 -36
- package/spec/aggressive_tokenizer_fr_spec.js +0 -101
- package/spec/aggressive_tokenizer_nl_spec.js +0 -36
- package/spec/aggressive_tokenizer_pt_spec.js +0 -56
- package/spec/aggressive_tokenizer_spec.js +0 -56
- package/spec/bayes_classifier_spec.js +0 -173
- package/spec/classifier_spec.js +0 -175
- package/spec/count_inflector_fr_spec.js +0 -44
- package/spec/count_inflector_spec.js +0 -73
- package/spec/dice_coefficient_spec.js +0 -26
- package/spec/double_metaphone_spec.js +0 -752
- package/spec/jaro-winkler_spec.js +0 -53
- package/spec/lancaster_stemmer_spec.js +0 -73
- package/spec/levenshtein_spec.js +0 -66
- package/spec/logistic_regression_classifier_spec.js +0 -122
- package/spec/longest_path_tree_spec.js +0 -102
- package/spec/metaphone_spec.js +0 -252
- package/spec/ngram_spec.js +0 -130
- package/spec/ngram_zh_spec.js +0 -122
- package/spec/normalizer_ja_spec.js +0 -160
- package/spec/normalizer_no_spec.js +0 -111
- package/spec/normalizer_spec.js +0 -140
- package/spec/noun_inflector_fr_spec.js +0 -476
- package/spec/noun_inflector_ja_spec.js +0 -112
- package/spec/noun_inflector_spec.js +0 -270
- package/spec/porter_stemmer_fr_spec.js +0 -101
- package/spec/porter_stemmer_it_spec.js +0 -44
- package/spec/porter_stemmer_no_spec.js +0 -143
- package/spec/porter_stemmer_pt_spec.js +0 -50
- package/spec/porter_stemmer_ru_spec.js +0 -63
- package/spec/porter_stemmer_spec.js +0 -182
- package/spec/present_verb_inflector_spec.js +0 -128
- package/spec/remove_diacritics_spec.js +0 -31
- package/spec/sentence_analyzer_spec.js +0 -277
- package/spec/shortest_path_tree_spec.js +0 -132
- package/spec/soundex_spec.js +0 -158
- package/spec/spellcheck_spec.js +0 -92
- package/spec/stemmer_ja_spec.js +0 -66
- package/spec/stemmer_token_spec.js +0 -161
- package/spec/test_data/snowball_fr.txt +0 -20402
- package/spec/test_data/snowball_it.txt +0 -35482
- package/spec/test_data/snowball_no.txt +0 -20628
- package/spec/test_data/snowball_pt.txt +0 -32016
- package/spec/test_data/tfdif_testcorpus.txt +0 -7
- package/spec/test_data/tfidf_document1.txt +0 -1
- package/spec/test_data/tfidf_document2.txt +0 -1
- package/spec/test_data/tfidf_document3.txt +0 -1
- package/spec/test_data/tfidf_document4.txt +0 -1
- package/spec/test_data/tfidf_teststopwords.txt +0 -1
- package/spec/test_data/wordnet_mini.sql +0 -95
- package/spec/tfidf_spec.js +0 -323
- package/spec/tokenizer_ja_spec.js +0 -58
- package/spec/transliterator_ja_spec.js +0 -103
- package/spec/treebank_word_tokenizer_spec.js +0 -36
- package/spec/trie_spec.js +0 -206
package/benchmarks/soundex.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
// single word
|
|
3
|
-
|
|
4
|
-
suite.bench('soundex() word', function(next){
|
|
5
|
-
soundex('stephen');
|
|
6
|
-
next();
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
// small body of text
|
|
10
|
-
|
|
11
|
-
var words = fs.readFileSync('lib/natural/index.js', 'utf8').split(/\W+/);
|
|
12
|
-
suite.bench('soundex() small', function(next){
|
|
13
|
-
for (var i = 0, len = words.length; i < len; ++i) {
|
|
14
|
-
soundex(words[i]);
|
|
15
|
-
}
|
|
16
|
-
next();
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
// medium body of text
|
|
20
|
-
|
|
21
|
-
var words2 = fs.readFileSync('README.md', 'utf8').split(/\W+/);
|
|
22
|
-
suite.bench('soundex() medium', function(next){
|
|
23
|
-
for (var i = 0, len = words2.length; i < len; ++i) {
|
|
24
|
-
soundex(words2[i]);
|
|
25
|
-
}
|
|
26
|
-
next();
|
|
27
|
-
});
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright (c) 2011, Chris Umbel
|
|
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
|
-
var natural = require('natural'),
|
|
24
|
-
classifier = new natural.BayesClassifier();
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
classifier.addDocument('my unit-tests failed.', 'software');
|
|
28
|
-
classifier.addDocument('tried the program, but it was buggy.', 'software');
|
|
29
|
-
classifier.addDocument('the drive has a 2TB capacity.', 'hardware');
|
|
30
|
-
classifier.addDocument('i need a new power supply.', 'hardware');
|
|
31
|
-
|
|
32
|
-
classifier.train();
|
|
33
|
-
|
|
34
|
-
console.log(classifier.classify('did the tests pass?'));
|
|
35
|
-
console.log(classifier.classify('did you buy a new drive?'));
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright (c) 2011, Chris Umbel
|
|
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
|
-
var natural = require('natural'),
|
|
24
|
-
classifier = new natural.BayesClassifier();
|
|
25
|
-
|
|
26
|
-
natural.BayesClassifier.load('classifier.json', null, function(err, classifier) {
|
|
27
|
-
console.log(classifier.classify('did the tests pass?'));
|
|
28
|
-
});
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright (c) 2011, Chris Umbel
|
|
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
|
-
var natural = require('natural'),
|
|
24
|
-
classifier = new natural.BayesClassifier();
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
classifier.addDocument('my unit-tests failed.', 'software');
|
|
28
|
-
classifier.addDocument('tried the program, but it was buggy.', 'software');
|
|
29
|
-
classifier.addDocument('the drive has a 2TB capacity.', 'hardware');
|
|
30
|
-
classifier.addDocument('i need a new power supply.', 'hardware');
|
|
31
|
-
|
|
32
|
-
classifier.train();
|
|
33
|
-
|
|
34
|
-
classifier.save('classifier.json', function(err, classifier) {
|
|
35
|
-
// the classifier is saved to the classifier.json file!
|
|
36
|
-
});
|
|
37
|
-
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright (c) 2011, Chris Umbel
|
|
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
|
-
var natural = require('natural'),
|
|
24
|
-
inflector = natural.CountInflector;
|
|
25
|
-
|
|
26
|
-
console.log(inflector.nth(1));
|
|
27
|
-
console.log(inflector.nth(2));
|
|
28
|
-
console.log(inflector.nth(3));
|
|
29
|
-
console.log(inflector.nth(4));
|
|
30
|
-
console.log(inflector.nth(10));
|
|
31
|
-
console.log(inflector.nth(11));
|
|
32
|
-
console.log(inflector.nth(101));
|
|
33
|
-
console.log(inflector.nth(102));
|
|
34
|
-
console.log(inflector.nth(103));
|
|
35
|
-
console.log(inflector.nth(104));
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright (c) 2011, Chris Umbel
|
|
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
|
-
var natural = require('natural'),
|
|
24
|
-
nounInflector = new natural.NounInflector();
|
|
25
|
-
|
|
26
|
-
nounInflector.attach();
|
|
27
|
-
|
|
28
|
-
console.log('beers'.singularizeNoun());
|
|
29
|
-
console.log('radii'.singularizeNoun());
|
|
30
|
-
|
|
31
|
-
console.log('beer'.pluralizeNoun());
|
|
32
|
-
console.log('radius'.pluralizeNoun());
|
|
33
|
-
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright (c) 2011, Chris Umbel
|
|
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
|
-
var natural = require('natural'),
|
|
24
|
-
phonetic = natural.Metaphone;
|
|
25
|
-
|
|
26
|
-
var wordA = 'phonetics';
|
|
27
|
-
var stdin = process.openStdin();
|
|
28
|
-
stdin.setEncoding('ascii');
|
|
29
|
-
|
|
30
|
-
process.stdout.write('try to enter a word that sounds like "' + wordA +'": ');
|
|
31
|
-
|
|
32
|
-
stdin.on('data', function (wordB) {
|
|
33
|
-
if(phonetic.compare(wordA, wordB))
|
|
34
|
-
process.stdout.write('they sound alike!\n');
|
|
35
|
-
else
|
|
36
|
-
process.stdout.write('sorry, they don\'t sound alike.\n');
|
|
37
|
-
|
|
38
|
-
process.exit();
|
|
39
|
-
});
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright (c) 2011, Chris Umbel
|
|
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
|
-
var natural = require('natural'),
|
|
24
|
-
phonetic = natural.Metaphone;
|
|
25
|
-
|
|
26
|
-
phonetic.attach();
|
|
27
|
-
var wordA = 'phonetics';
|
|
28
|
-
var stdin = process.openStdin();
|
|
29
|
-
stdin.setEncoding('ascii');
|
|
30
|
-
|
|
31
|
-
process.stdout.write('try to enter a word that sounds like "' + wordA +'": ');
|
|
32
|
-
|
|
33
|
-
stdin.on('data', function (wordB) {
|
|
34
|
-
if(wordA.soundsLike(wordB))
|
|
35
|
-
process.stdout.write('they sound alike!\n');
|
|
36
|
-
else
|
|
37
|
-
process.stdout.write('sorry, they don\'t sound alike.\n');
|
|
38
|
-
|
|
39
|
-
process.exit();
|
|
40
|
-
});
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright (c) 2011, Chris Umbel
|
|
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
|
-
var natural = require('natural'),
|
|
24
|
-
phonetic = natural.DoubleMetaphone;
|
|
25
|
-
|
|
26
|
-
var sentence = 'phonetic modules contain algorithms';
|
|
27
|
-
var stdin = process.openStdin();
|
|
28
|
-
stdin.setEncoding('ascii');
|
|
29
|
-
phonetic.attach();
|
|
30
|
-
process.stdout.write('enter a word that sounds like one of these, "' + sentence +'": ');
|
|
31
|
-
|
|
32
|
-
words = sentence.tokenizeAndPhoneticize();
|
|
33
|
-
|
|
34
|
-
function findMatch(input) {
|
|
35
|
-
inputSounds = input.phonetics();
|
|
36
|
-
console.log(inputSounds);
|
|
37
|
-
|
|
38
|
-
for(var i = 0; i < words.length; i++) {
|
|
39
|
-
wordSounds = words[i];
|
|
40
|
-
|
|
41
|
-
if(wordSounds == inputSounds) {
|
|
42
|
-
process.stdout.write('match found!\n');
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
process.stdout.write('no match found.\n');
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
stdin.on('data', function (input) {
|
|
52
|
-
findMatch(input);
|
|
53
|
-
process.exit();
|
|
54
|
-
});
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright (c) 2011, Chris Umbel
|
|
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
|
-
var natural = require('natural'),
|
|
24
|
-
stemmer = natural.PorterStemmer;
|
|
25
|
-
|
|
26
|
-
stemmer.attach();
|
|
27
|
-
|
|
28
|
-
console.log('i stemmed words.'.tokenizeAndStem());
|
|
29
|
-
console.log('i stemmed words.'.tokenizeAndStem(true));
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright (c) 2011, Chris Umbel
|
|
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
|
-
var natural = require('natural'),
|
|
24
|
-
stemmer = natural.LancasterStemmer;
|
|
25
|
-
|
|
26
|
-
console.log(stemmer.stem('stemming'));
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright (c) 2011, Rob Ellis, Chris Umbel
|
|
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
|
-
var natural = require('natural'),
|
|
24
|
-
TfIdf = natural.TfIdf,
|
|
25
|
-
tfidf = new TfIdf();
|
|
26
|
-
|
|
27
|
-
tfidf.addDocument(['document', 'about', 'node']);
|
|
28
|
-
tfidf.addDocument(['document', 'about', 'ruby']);
|
|
29
|
-
tfidf.addDocument(['document', 'about', 'ruby', 'node']);
|
|
30
|
-
tfidf.addDocument(['document', 'about', 'node', 'node']);
|
|
31
|
-
|
|
32
|
-
tfidf.tfidfs(['node', 'ruby'], function(i, measure) {
|
|
33
|
-
console.log('document #' + i + ' is ' + measure);
|
|
34
|
-
});
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright (c) 2011, Rob Ellis, Chris Umbel
|
|
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
|
-
var natural = require('natural'),
|
|
24
|
-
TfIdf = natural.TfIdf,
|
|
25
|
-
tfidf = new TfIdf();
|
|
26
|
-
|
|
27
|
-
tfidf.addDocument('this document is about node.');
|
|
28
|
-
tfidf.addDocument('this document is about ruby.');
|
|
29
|
-
tfidf.addDocument('this document is about ruby and node.');
|
|
30
|
-
|
|
31
|
-
tfidf.tfidfs('node ruby', function(i, measure) {
|
|
32
|
-
console.log('document #' + i + ' is ' + measure);
|
|
33
|
-
});
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright (c) 2011, Rob Ellis, Chris Umbel
|
|
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
|
-
var natural = require('natural'),
|
|
24
|
-
TfIdf = natural.TfIdf,
|
|
25
|
-
tfidf = new TfIdf();
|
|
26
|
-
|
|
27
|
-
tfidf.addDocument('this document is about node.');
|
|
28
|
-
tfidf.addDocument('this document is about ruby.');
|
|
29
|
-
tfidf.addDocument('this document is about ruby and node.');
|
|
30
|
-
tfidf.addDocument('this document is about node. it has node examples');
|
|
31
|
-
|
|
32
|
-
console.log('node --------------------------------');
|
|
33
|
-
tfidf.tfidfs('node', function(i, measure) {
|
|
34
|
-
console.log('document #' + i + ' is ' + measure);
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
console.log('ruby --------------------------------');
|
|
38
|
-
tfidf.tfidfs('ruby', function(i, measure) {
|
|
39
|
-
console.log('document #' + i + ' is ' + measure);
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
console.log('-------------------------------------');
|
|
43
|
-
console.log(tfidf.tfidf('ruby', 0));
|
|
44
|
-
console.log(tfidf.tfidf('ruby', 1));
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
disk document one
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
disk document two
|
package/io_spec/tfidf_spec.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright (c) 2011, Rob Ellis, Chris Umbel
|
|
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
|
-
var TfIdf = require('lib/natural/tfidf/tfidf');
|
|
24
|
-
var tfidf;
|
|
25
|
-
|
|
26
|
-
describe('tfidf io', function() {
|
|
27
|
-
it('should be able to be serialized', function() {
|
|
28
|
-
tfidf = new TfIdf();
|
|
29
|
-
tfidf.addDocument('document one', 'un');
|
|
30
|
-
tfidf.addDocument('document Two', 'deux');
|
|
31
|
-
var s = JSON.stringify(tfidf);
|
|
32
|
-
expect(s).toBe('{"documents":[{"__key":"un","document":1,"one":1},{"__key":"deux","document":1,"two":1}]}');
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it('should deserialize', function() {
|
|
36
|
-
var s = '{"documents":[{"__key":"un","document":1,"one":1},{"__key":"deux","document":1,"two":1}]}';
|
|
37
|
-
var tfidf = new TfIdf(JSON.parse(s));
|
|
38
|
-
expect(tfidf.tfidf('one', 0)).toBe(0.9162907318741551);
|
|
39
|
-
expect(tfidf.tfidf('two', 0)).toBe(0);
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
describe('files', function() {
|
|
43
|
-
var tfidf = new TfIdf();
|
|
44
|
-
tfidf.addFileSync('io_spec/test_data/tfidf/one');
|
|
45
|
-
tfidf.addFileSync('io_spec/test_data/tfidf/two');
|
|
46
|
-
expect(tfidf.tfidf('Document', 0)).toBe(0.8472978603872037);
|
|
47
|
-
expect(tfidf.tfidf('one', 0)).toBe(0.9162907318741551);
|
|
48
|
-
expect(tfidf.tfidf('two', 0)).toBe(0);
|
|
49
|
-
});
|
|
50
|
-
});
|
package/io_spec/wordnet_spec.js
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright (c) 2011, Chris Umbel
|
|
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
|
-
var WordNet = require('lib/natural/wordnet/wordnet');
|
|
24
|
-
jasmine.asyncSpecWait.timeout = 30 * 1000;
|
|
25
|
-
|
|
26
|
-
describe('wordnet', function() {
|
|
27
|
-
|
|
28
|
-
it('should lookup synonyms', function() {
|
|
29
|
-
var wordnet = new WordNet();
|
|
30
|
-
|
|
31
|
-
wordnet.lookupSynonyms('entity', function(records) {
|
|
32
|
-
expect(records.length).toBe(3);
|
|
33
|
-
asyncSpecDone();
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
asyncSpecWait();
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
it('should lookup synonyms give a synset offset and a pos', function() {
|
|
40
|
-
var wordnet = new WordNet();
|
|
41
|
-
|
|
42
|
-
wordnet.getSynonyms(1740, 'n', function(records) {
|
|
43
|
-
expect(records.length).toBe(3);
|
|
44
|
-
expect(records[0].synsetOffset).toBe(4424418);
|
|
45
|
-
expect(records[1].synsetOffset).toBe(2137);
|
|
46
|
-
expect(records[2].synsetOffset).toBe(1930);
|
|
47
|
-
asyncSpecDone();
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
asyncSpecWait();
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
it('should lookup synonyms via a provided synset object', function() {
|
|
54
|
-
var wordnet = new WordNet();
|
|
55
|
-
|
|
56
|
-
wordnet.lookup('entity', function(results) {
|
|
57
|
-
wordnet.getSynonyms(results[0], function(records) {
|
|
58
|
-
expect(records.length).toBe(3);
|
|
59
|
-
expect(records[0].synsetOffset).toBe(4424418);
|
|
60
|
-
expect(records[1].synsetOffset).toBe(2137);
|
|
61
|
-
expect(records[2].synsetOffset).toBe(1930);
|
|
62
|
-
asyncSpecDone();
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
asyncSpecWait();
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
it('should add records but once', function() {
|
|
70
|
-
var wordnet = new WordNet();
|
|
71
|
-
|
|
72
|
-
wordnet.lookup('node', function(records) {
|
|
73
|
-
expect(records.length).toBe(8);
|
|
74
|
-
expect(records[0].lemma).toBe('node');
|
|
75
|
-
|
|
76
|
-
asyncSpecDone();
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
asyncSpecWait();
|
|
80
|
-
});
|
|
81
|
-
});
|