From fcef020eab037294de8f890e5fbd3cd0beb72988 Mon Sep 17 00:00:00 2001 From: Spencer Kelly Date: Sat, 19 Dec 2015 17:42:44 -0500 Subject: [PATCH] use lowercase methods --- src/index.js | 1 - tests/unit_tests/adjective/to_adverb.js | 8 ++++---- tests/unit_tests/adjective/to_noun.js | 2 +- tests/unit_tests/adverb/to_adjective.js | 2 +- tests/unit_tests/nouns/article.js | 2 +- tests/unit_tests/nouns/date.js | 7 ++++--- tests/unit_tests/nouns/to_number.js | 2 +- tests/unit_tests/sentence/lumper.js | 22 +++++++++++----------- tests/unit_tests/sentence/manipulations.js | 2 +- tests/unit_tests/sentence/sentence.js | 16 ++++++++-------- tests/unit_tests/sentence/tagger.js | 2 +- tests/unit_tests/text/ngram_test.js | 2 +- tests/unit_tests/tokenize/sentence.js | 2 +- tests/unit_tests/verbs/conjugate.js | 20 ++++++++++---------- tests/unit_tests/verbs/negate.js | 2 +- 15 files changed, 46 insertions(+), 46 deletions(-) diff --git a/src/index.js b/src/index.js index 28d841793..146ea41aa 100644 --- a/src/index.js +++ b/src/index.js @@ -18,7 +18,6 @@ let models = { const extend = function(m, context) { context = context || {}; - return m; }; diff --git a/tests/unit_tests/adjective/to_adverb.js b/tests/unit_tests/adjective/to_adverb.js index b63bc0ed2..a0631793a 100644 --- a/tests/unit_tests/adjective/to_adverb.js +++ b/tests/unit_tests/adjective/to_adverb.js @@ -15,7 +15,7 @@ describe('adjective methods', function() { ['cute', 'cutely'], ]; tests.forEach(function(a) { - let adv = nlp.Adjective(a[0]); + let adv = nlp.adjective(a[0]); (adv.to_adverb() || '').should.equal(a[1]); }); done(); @@ -32,7 +32,7 @@ describe('adjective methods', function() { ['cute', 'cutest'], ]; tests.forEach(function(a) { - let adv = nlp.Adjective(a[0]); + let adv = nlp.adjective(a[0]); (adv.to_superlative() || '').should.equal(a[1]); }); done(); @@ -49,14 +49,14 @@ describe('adjective methods', function() { ['cute', 'cuter'], ]; tests.forEach(function(a) { - let adv = nlp.Adjective(a[0]); + let adv = nlp.adjective(a[0]); (adv.to_comparative() || '').should.equal(a[1]); }); done(); }); it('conjugate', function(done) { - let adv = nlp.Adjective('nice'); + let adv = nlp.adjective('nice'); let o = adv.conjugate(); (o.comparative).should.equal('nicer'); (o.superlative).should.equal('nicest'); diff --git a/tests/unit_tests/adjective/to_noun.js b/tests/unit_tests/adjective/to_noun.js index 1d52fd9fc..feb2eb5df 100644 --- a/tests/unit_tests/adjective/to_noun.js +++ b/tests/unit_tests/adjective/to_noun.js @@ -15,7 +15,7 @@ describe('adjective', function() { ['clean', 'cleanliness'], ]; tests.forEach(function(a) { - let adv = nlp.Adjective(a[0]); + let adv = nlp.adjective(a[0]); adv.to_noun().should.equal(a[1]); }); done(); diff --git a/tests/unit_tests/adverb/to_adjective.js b/tests/unit_tests/adverb/to_adjective.js index a24b44877..d1e4d9333 100644 --- a/tests/unit_tests/adverb/to_adjective.js +++ b/tests/unit_tests/adverb/to_adjective.js @@ -61,7 +61,7 @@ describe('to_adjective', function() { ['vertically', 'vertical'] ]; tests.forEach(function(a) { - let adv = nlp.Adverb(a[0]); + let adv = nlp.adverb(a[0]); adv.to_adjective().should.equal(a[1]); }); done(); diff --git a/tests/unit_tests/nouns/article.js b/tests/unit_tests/nouns/article.js index 99100ba92..68bd1edcc 100644 --- a/tests/unit_tests/nouns/article.js +++ b/tests/unit_tests/nouns/article.js @@ -17,7 +17,7 @@ describe('article', function() { ['ukalele', 'a'], ]; tests.forEach(function(a) { - let n = nlp.Noun(a[0]); + let n = nlp.noun(a[0]); n.article().should.equal(a[1]); }); done(); diff --git a/tests/unit_tests/nouns/date.js b/tests/unit_tests/nouns/date.js index d98b52ff5..45b9b8074 100644 --- a/tests/unit_tests/nouns/date.js +++ b/tests/unit_tests/nouns/date.js @@ -34,7 +34,7 @@ describe('date', function () { // ['200bc', [5, 22, 1997]], ]; tests.forEach(function (a) { - let n = nlp.Date(a[0]); + let n = nlp.date(a[0]); let w = a[1]; let d = n.date(); d.getMonth().should.equal(w[0]); @@ -43,6 +43,7 @@ describe('date', function () { }); done(); }); + it('partial dates', function (done) { let tests = [ ['3rd of March 1969', [2, 3, 1969]], @@ -63,7 +64,7 @@ describe('date', function () { ['jan 1921', [0, null, 1921]], ]; tests.forEach(function (a) { - let n = nlp.Date(a[0]); + let n = nlp.date(a[0]); let w = a[1]; let o = n.data; (o.month || '').should.equal(w[0] || ''); @@ -80,7 +81,7 @@ describe('date', function () { ['January 5th 4032', [0, 5, null]], ]; tests.forEach(function (a) { - let n = nlp.Date(a[0]); + let n = nlp.date(a[0]); let w = a[1]; let o = n.data; (o.month || '').should.equal(w[0] || ''); diff --git a/tests/unit_tests/nouns/to_number.js b/tests/unit_tests/nouns/to_number.js index a4547bd71..d65534a9d 100644 --- a/tests/unit_tests/nouns/to_number.js +++ b/tests/unit_tests/nouns/to_number.js @@ -71,7 +71,7 @@ let tests = [ describe('to noun', function() { it('text to noun', function(done) { tests.forEach(function(a) { - let v = nlp.Value(a[0]); + let v = nlp.value(a[0]); (v.number || '').should.equal(a[1] || ''); }); done(); diff --git a/tests/unit_tests/sentence/lumper.js b/tests/unit_tests/sentence/lumper.js index 8270fae5a..f2ff98b30 100644 --- a/tests/unit_tests/sentence/lumper.js +++ b/tests/unit_tests/sentence/lumper.js @@ -16,7 +16,7 @@ describe('lumper test', function() { ['joe had 5 books', ['Person', 'PastTense', 'Value']], ]; tests.forEach(function(a) { - let n = nlp.Text(a[0]); + let n = nlp.text(a[0]); let tags = n.tags()[0]; (a[1]).should.deepEqual(tags); }); @@ -27,16 +27,16 @@ describe('lumper test', function() { it('contractions', function(done) { - nlp.Text('he\'s fun').terms()[1].normal.should.equal('is'); - nlp.Text('she\'s walking').terms()[1].normal.should.equal('is'); - nlp.Text('where\'s waldo').terms()[1].normal.should.equal('is'); - nlp.Text('where\'s he going?').terms()[1].normal.should.equal('is'); - nlp.Text('where\'s the pencil?').terms()[1].normal.should.equal('is'); - nlp.Text('he\'s walked').terms()[1].normal.should.equal('has'); - nlp.Text('it\'s got the best features').terms()[1].normal.should.equal('has'); - nlp.Text('it\'s achieved each goal').terms()[1].normal.should.equal('has'); - nlp.Text('where\'s he disappeared to?').terms()[1].normal.should.equal('has'); - nlp.Text('where\'s the pencil disappeared to?').terms()[1].normal.should.equal('has'); + nlp.text('he\'s fun').terms()[1].normal.should.equal('is'); + nlp.text('she\'s walking').terms()[1].normal.should.equal('is'); + nlp.text('where\'s waldo').terms()[1].normal.should.equal('is'); + nlp.text('where\'s he going?').terms()[1].normal.should.equal('is'); + nlp.text('where\'s the pencil?').terms()[1].normal.should.equal('is'); + nlp.text('he\'s walked').terms()[1].normal.should.equal('has'); + nlp.text('it\'s got the best features').terms()[1].normal.should.equal('has'); + nlp.text('it\'s achieved each goal').terms()[1].normal.should.equal('has'); + nlp.text('where\'s he disappeared to?').terms()[1].normal.should.equal('has'); + nlp.text('where\'s the pencil disappeared to?').terms()[1].normal.should.equal('has'); done(); }); diff --git a/tests/unit_tests/sentence/manipulations.js b/tests/unit_tests/sentence/manipulations.js index 4ad843c1d..a67c97d82 100644 --- a/tests/unit_tests/sentence/manipulations.js +++ b/tests/unit_tests/sentence/manipulations.js @@ -9,7 +9,7 @@ describe('Sentence Manipulation Methods', function() { ['he is quick', 'he was quick', 'he will be quick'], ]; tests.forEach(function(a) { - let s = nlp.Text(a[0]); + let s = nlp.text(a[0]); s.to_past(); s.text().should.equal(a[1]); s.to_future(); diff --git a/tests/unit_tests/sentence/sentence.js b/tests/unit_tests/sentence/sentence.js index 8d685f431..cbf0b8527 100644 --- a/tests/unit_tests/sentence/sentence.js +++ b/tests/unit_tests/sentence/sentence.js @@ -4,7 +4,7 @@ let nlp = require('../../../src/index.js'); describe('Sentence Class Methods', function() { it('Basic', function(done) { - let sen = nlp.Text('Hello World').sentences[0]; + let sen = nlp.text('Hello World').sentences[0]; let methods = [ 'terminator', 'text', @@ -25,7 +25,7 @@ describe('Sentence Class Methods', function() { ['Tony is okay', '.'] ]; tests.forEach(function(a) { - let s = nlp.Text(a[0]).sentences[0]; + let s = nlp.text(a[0]).sentences[0]; s.terminator().should.eql(a[1]); }); done(); @@ -40,7 +40,7 @@ describe('Sentence Class Methods', function() { ]; tests.forEach(function(a) { - let people = nlp.Text(a[0]).people(); + let people = nlp.text(a[0]).people(); people = people.map(function(t) { return t.text; }); @@ -57,7 +57,7 @@ describe('Sentence Class Methods', function() { ]; tests.forEach(function(a) { - let arr = nlp.Text(a[0]).places(); + let arr = nlp.text(a[0]).places(); arr = arr.map(function(t) { return t.text; }); @@ -74,7 +74,7 @@ describe('Sentence Class Methods', function() { ]; tests.forEach(function(a) { - let arr = nlp.Text(a[0]).dates(); + let arr = nlp.text(a[0]).dates(); arr = arr.map(function(t) { return t.text; }); @@ -92,7 +92,7 @@ describe('Sentence Class Methods', function() { ]; tests.forEach(function(a) { - let arr = nlp.Text(a[0]).values(); + let arr = nlp.text(a[0]).values(); arr = arr.map(function(t) { return t.text; }); @@ -110,7 +110,7 @@ describe('Sentence Class Methods', function() { ]; tests.forEach(function(a) { - let arr = nlp.Text(a[0]).organisations(); + let arr = nlp.text(a[0]).organisations(); arr = arr.map(function(t) { return t.text; }); @@ -127,7 +127,7 @@ describe('Sentence Class Methods', function() { ]; tests.forEach(function(a) { - let bool = nlp.Sentence(a[0]).is_passive(); + let bool = nlp.sentence(a[0]).is_passive(); (bool).should.eql(a[1]); }); done(); diff --git a/tests/unit_tests/sentence/tagger.js b/tests/unit_tests/sentence/tagger.js index 523f0c489..1ed77afd2 100644 --- a/tests/unit_tests/sentence/tagger.js +++ b/tests/unit_tests/sentence/tagger.js @@ -14,7 +14,7 @@ describe('pos tag', function() { ['He is in Canada', ['Person', 'Copula', 'Preposition', 'Place']], ]; tests.forEach(function(a) { - let n = nlp.Text(a[0]); + let n = nlp.text(a[0]); let tags = n.tags()[0]; (a[1]).should.deepEqual(tags); }); diff --git a/tests/unit_tests/text/ngram_test.js b/tests/unit_tests/text/ngram_test.js index 61249ee35..cc755f3d9 100644 --- a/tests/unit_tests/text/ngram_test.js +++ b/tests/unit_tests/text/ngram_test.js @@ -14,7 +14,7 @@ describe('ngram', function() { ['55 and 55', '55', 2], ]; tests.forEach(function(a) { - let n = nlp.Text(a[0]); + let n = nlp.text(a[0]); let topgram = n.ngram()[0][0]; topgram.word.should.equal(a[1]); topgram.count.should.equal(a[2]); diff --git a/tests/unit_tests/tokenize/sentence.js b/tests/unit_tests/tokenize/sentence.js index ec26ced3c..095c70776 100644 --- a/tests/unit_tests/tokenize/sentence.js +++ b/tests/unit_tests/tokenize/sentence.js @@ -26,7 +26,7 @@ describe('tokenize sentence tests', function() { ['I made $5.60 today in 1 hour of work. The E.M.T.\'s were on time, but only barely.', 2] ]; tests.forEach(function(a) { - let n = nlp.Text(a[0]); + let n = nlp.text(a[0]); n.sentences.should.have.length(a[1]); }); done(); diff --git a/tests/unit_tests/verbs/conjugate.js b/tests/unit_tests/verbs/conjugate.js index f387767aa..36b1936e0 100644 --- a/tests/unit_tests/verbs/conjugate.js +++ b/tests/unit_tests/verbs/conjugate.js @@ -147,7 +147,7 @@ let verbs = [{ describe('verb conjugate', function() { it('infinitive stays infinitive', function(done) { verbs.forEach(function(o) { - let c = nlp.Verb(o.infinitive).conjugate(); + let c = nlp.verb(o.infinitive).conjugate(); (c.infinitive).should.equal(o.infinitive); }); done(); @@ -155,7 +155,7 @@ describe('verb conjugate', function() { it('infinitive becomes past', function(done) { verbs.forEach(function(o) { - let c = nlp.Verb(o.infinitive).conjugate(); + let c = nlp.verb(o.infinitive).conjugate(); (c.past).should.equal(o.past); }); done(); @@ -163,7 +163,7 @@ describe('verb conjugate', function() { it('infinitive becomes present', function(done) { verbs.forEach(function(o) { - let c = nlp.Verb(o.infinitive).conjugate(); + let c = nlp.verb(o.infinitive).conjugate(); (c.present).should.equal(o.present); }); done(); @@ -171,7 +171,7 @@ describe('verb conjugate', function() { it('infinitive becomes gerund', function(done) { verbs.forEach(function(o) { - let c = nlp.Verb(o.infinitive).conjugate(); + let c = nlp.verb(o.infinitive).conjugate(); (c.gerund).should.equal(o.gerund); }); done(); @@ -179,7 +179,7 @@ describe('verb conjugate', function() { it('past stays past', function(done) { verbs.forEach(function(o) { - let c = nlp.Verb(o.past).conjugate(); + let c = nlp.verb(o.past).conjugate(); (c.past).should.equal(o.past); }); done(); @@ -187,7 +187,7 @@ describe('verb conjugate', function() { it('past becomes present', function(done) { verbs.forEach(function(o) { - let c = nlp.Verb(o.past).conjugate(); + let c = nlp.verb(o.past).conjugate(); (c.present).should.equal(o.present); }); done(); @@ -195,7 +195,7 @@ describe('verb conjugate', function() { it('past becomes gerund', function(done) { verbs.forEach(function(o) { - let c = nlp.Verb(o.past).conjugate(); + let c = nlp.verb(o.past).conjugate(); (c.gerund).should.equal(o.gerund); }); done(); @@ -203,7 +203,7 @@ describe('verb conjugate', function() { it('present stays present', function(done) { verbs.forEach(function(o) { - let c = nlp.Verb(o.present).conjugate(); + let c = nlp.verb(o.present).conjugate(); (c.present).should.equal(o.present); }); done(); @@ -211,7 +211,7 @@ describe('verb conjugate', function() { it('present becomes past', function(done) { verbs.forEach(function(o) { - let c = nlp.Verb(o.present).conjugate(); + let c = nlp.verb(o.present).conjugate(); (c.past).should.equal(o.past); }); done(); @@ -219,7 +219,7 @@ describe('verb conjugate', function() { it('present becomes gerund', function(done) { verbs.forEach(function(o) { - let c = nlp.Verb(o.present).conjugate(); + let c = nlp.verb(o.present).conjugate(); (c.gerund).should.equal(o.gerund); }); done(); diff --git a/tests/unit_tests/verbs/negate.js b/tests/unit_tests/verbs/negate.js index a67181f2b..d99b76339 100644 --- a/tests/unit_tests/verbs/negate.js +++ b/tests/unit_tests/verbs/negate.js @@ -14,7 +14,7 @@ describe('verb negate', function() { ]; tests.forEach(function(a) { - let n = nlp.Text(a[0]); + let n = nlp.text(a[0]); it(a[1], function(done) { n.terms()[0].negate().should.equal(a[1]); done();