Comparing version 2.0.0 to 2.1.0
@@ -66,10 +66,19 @@ var pos = require('pos'); | ||
var newWord = { | ||
raw: word, | ||
noPunctuation: letters, | ||
type: 'word', | ||
length: chars.length, | ||
children: chars | ||
}; | ||
var newWord = {}; | ||
newWord.raw = word; | ||
newWord.type = 'word'; | ||
newWord.length = chars.length; | ||
newWord.noPunctuation = letters; | ||
if (/^\w+'s?$/.test(word)) { | ||
newWord.possessive = true; | ||
newWord.withoutPossessive = self.removePossessive(word); | ||
} | ||
else { | ||
newWord.possessive = false; | ||
} | ||
newWord.children = chars; | ||
if (options.pos) { | ||
@@ -89,3 +98,11 @@ newWord.partOfSpeech = self.wordPOS(word); | ||
self.removePossessive = function(word) { | ||
if (word.substr(word.length - 1) == 's') { | ||
return word.substr(0, word.length - 2); | ||
} | ||
return word.substr(0, word.length - 1); | ||
}; | ||
return self; | ||
}; |
{ | ||
"name": "text-parse", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "Text parser", | ||
@@ -20,5 +20,5 @@ "keywords": [ | ||
"mocha": "*", | ||
"should": "*" | ||
"should": "4.3" | ||
}, | ||
"main": "index" | ||
} |
@@ -56,5 +56,6 @@ # Text Parse | ||
[ { raw: 'Sed', | ||
noPunctuation: 'Sed', | ||
type: 'word', | ||
length: 3, | ||
noPunctuation: 'Sed', | ||
possessive: false, | ||
children: | ||
@@ -66,5 +67,6 @@ [ { raw: 'S', type: 'letter' }, | ||
{ raw: 'ut', | ||
noPunctuation: 'ut', | ||
type: 'word', | ||
length: 2, | ||
noPunctuation: 'ut', | ||
possessive: false, | ||
children: | ||
@@ -75,5 +77,6 @@ [ { raw: 'u', type: 'letter' }, | ||
{ raw: 'unde,', | ||
noPunctuation: 'unde', | ||
type: 'word', | ||
length: 5, | ||
noPunctuation: 'unde', | ||
possessive: false, | ||
children: | ||
@@ -87,5 +90,6 @@ [ { raw: 'u', type: 'letter' }, | ||
{ raw: 'omnis', | ||
noPunctuation: 'omnis', | ||
type: 'word', | ||
length: 5, | ||
noPunctuation: 'omnis', | ||
possessive: false, | ||
children: | ||
@@ -99,5 +103,6 @@ [ { raw: 'o', type: 'letter' }, | ||
{ raw: 'error', | ||
noPunctuation: 'error', | ||
type: 'word', | ||
length: 5, | ||
noPunctuation: 'error', | ||
possessive: false, | ||
children: | ||
@@ -111,5 +116,6 @@ [ { raw: 'e', type: 'letter' }, | ||
{ raw: 'sit', | ||
noPunctuation: 'sit', | ||
type: 'word', | ||
length: 3, | ||
noPunctuation: 'sit', | ||
possessive: false, | ||
children: | ||
@@ -121,5 +127,6 @@ [ { raw: 's', type: 'letter' }, | ||
{ raw: 'voluptatem;', | ||
noPunctuation: 'voluptatem', | ||
type: 'word', | ||
length: 11, | ||
noPunctuation: 'voluptatem', | ||
possessive: false, | ||
children: | ||
@@ -139,5 +146,7 @@ [ { raw: 'v', type: 'letter' }, | ||
{ raw: 'accusantium\'s.', | ||
noPunctuation: 'accusantiums', | ||
type: 'word', | ||
length: 14, | ||
noPunctuation: 'accusantiums', | ||
possessive: true, | ||
withoutPossessive: 'accusantium', | ||
children: | ||
@@ -144,0 +153,0 @@ [ { raw: 'a', type: 'letter' }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11151
90
188