Skip to content

Commit

Permalink
bump to release 1.0.0, document 2 new functions
Browse files Browse the repository at this point in the history
  • Loading branch information
spencermountain committed May 19, 2015
1 parent 97fef78 commit 6af4539
Show file tree
Hide file tree
Showing 9 changed files with 88 additions and 88 deletions.
35 changes: 28 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ nlp.syllables("hamburger")
s.values()
//[]
````
as sugar, these methods can be called on multiple sentences from the nlp.pos() object too, like:
```javascript
nlp.pos("Tony is cool. Jen is happy.").people()
//[{text:"Tony"}, {text:"Jen"}]
```

###Noun methods:
```javascript
Expand All @@ -112,21 +117,34 @@ nlp.noun("earthquakes").singularize()
nlp.noun("earthquake").pluralize()
//earthquakes
nlp.noun('veggie burger').is_plural
nlp.noun('veggie burger').is_plural()
//false
nlp.noun('tony danza').is_person
nlp.noun('tony danza').is_person()
//true
nlp.noun('Tony J. Danza elementary school').is_person
nlp.noun('Tony J. Danza elementary school').is_person()
//false
nlp.noun('SS Tony danza').is_person
nlp.noun('SS Tony danza').is_person()
//false
nlp.noun('hour').article()
//an
nlp.inflect('mayors of toronto'))
nlp.noun('mayors of toronto').conjugate()
//{ plural: 'mayors of toronto', singular: 'mayor of toronto' }
nlp.noun("tooth").pronoun()
//it
nlp.noun("teeth").pronoun()
//they
nlp.noun("Tony Hawk").pronoun()
//"he"
nlp.noun("Nancy Hawk").pronoun()
//"she"
var he = nlp.pos("Tony Danza is great. He lives in L.A.").sentences[1].tokens[0]
he.analysis.reference_to()
//{text:"Tony Danza"...}
```

###Verb methods:
Expand Down Expand Up @@ -244,6 +262,7 @@ nlp.denormalize("The quick brown fox jumps over the lazy dog", {percentage:50})
"VBN" : "past-participle verb (eaten)"
"VBP" : "infinitive verb (eat)"
"VBZ" : "present-tense verb (eats, swims)"
"VBF" : "future-tense verb (will eat)"
"CP" : "copula (is, was, were)"
"VBG" : "gerund verb (eating,winning)"
"adjective":
Expand Down Expand Up @@ -284,7 +303,7 @@ Because the library can conjugate all sorts of forms, it only needs to store one
The lexicon was built using the [American National Corpus](http://www.americannationalcorpus.org/), then intersected with the regex rule-list. For example, it lists only 300 verbs, then blasts-out their 1200+ derived forms.

####Contractions
Unlike other nlp toolkits, this library puts a 'silent token' into the phrase for contractions. Otherwise something would be neglected.
It puts a 'silent token' into the phrase for contractions. Otherwise a meaningful part-of-speech could be neglected.
```javascript
nlp.pos("i'm good.")
[{
Expand All @@ -304,7 +323,7 @@ nlp.pos("i'm good.")
}]
```
####Tokenization
Neighbouring words with the same part of speech are merged together, unless there is punctuation, different capitalisation, or special cases.
Neighbouring words with the same part of speech are merged together, unless there is punctuation, different capitalisation, or some special cases.
```javascript
nlp.pos("tony hawk won").tags()
//tony hawk NN
Expand All @@ -317,6 +336,8 @@ nlp.pos("tony hawk won", {dont_combine:true}).tags()
//hawk NN
//won VB
```
####Phrasal Verbs
'beef up' is one verb, and not some direction of beefing.

## Licence
MIT
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "nlp_compromise",
"main": "./client_side/nlp.js",
"version": "0.5.2",
"version": "1.0.0",
"homepage": "https://github.com/spencermountain/nlp_compromise",
"authors": [
"Spencer Kelly <[email protected]>"
Expand Down
7 changes: 7 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@ Uses semvar, with casual releases to npm and bower.

'Major' is considered an api change, while 'Minor' is considered a performance change.

#v1.0.0 - May 2015
added name genders and beginning of co-reference resolution ('Tony' -> 'he') API.
small breaking change on ```Noun.is_plural``` and ```Noun.is_entity```, affording significant pos() speedup. Bumped Major version for these changes.

#v0.5.2 - May 2015
Phrasal verbs ('step up'), firstnames and .people()

#v0.4.0 - May 2015
Major file-size reduction through refactoring

Expand Down
3 changes: 2 additions & 1 deletion client_side/nlp.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! nlp_compromise 0.5.2 by @spencermountain 2015-05-18 MIT */
/*! nlp_compromise 1.0.0 by @spencermountain 2015-05-18 MIT */
var nlp = (function() {
var verb_irregulars = (function() {
var types = [
Expand Down Expand Up @@ -9432,6 +9432,7 @@ if (typeof module !== "undefined" && module.exports) {
// console.log( nlp.pos('she sells seashells by the seashore').sentences[0].negate().text() )
// console.log( nlp.pos('i will slouch'));
// console.log( nlp.pos('Sally Davidson sells seashells by the seashore. Joe Biden said so.').people() )
// console.log(nlp.pos("Tony Danza is great. He works in the bank.").sentences[1].tokens[0].analysis.reference_to())

return nlp;
})()
3 changes: 2 additions & 1 deletion contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,10 @@ of minimized clientside build:
* May 1st - 103kb
* May 8th - 79kb
* May 10th - 88kb
* May 18th - 99kb

#speed
benchmarked on backend
benchmarked unit tests on backend-frontent.
* May 2015 - 60ms boot

have a nice day
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,4 @@ if (typeof module !== "undefined" && module.exports) {
// console.log( nlp.pos('she sells seashells by the seashore').sentences[0].negate().text() )
// console.log( nlp.pos('i will slouch'));
// console.log( nlp.pos('Sally Davidson sells seashells by the seashore. Joe Biden said so.').people() )
// console.log(nlp.pos("Tony Danza is great. He works in the bank.").sentences[1].tokens[0].analysis.reference_to())
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"author": "Spencer Kelly <[email protected]> (http://spencermounta.in)",
"name": "nlp_compromise",
"description": "natural language processing in the browser",
"version": "0.5.2",
"version": "1.0.0",
"repository": {
"type": "git",
"url": "git://github.com/spencermountain/nlp_compromise.git"
Expand Down
Loading

0 comments on commit 6af4539

Please sign in to comment.