diff --git a/README.md b/README.md index de23129..f040af3 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ var nlp = require( 'wink-nlp-utils' ); // Extract person's name from a string: var name = nlp.string.extractPersonsName( 'Dr. Sarah Connor M. Tech., PhD. - AI' ); console.log( name ); -// name -> 'Sarah Connor' +// -> 'Sarah Connor' // Compose all possible sentences from a string: var str = '[I] [am having|have] [a] [problem|question]'; diff --git a/docs-toc.yml b/docs-toc.yml index 0fdbe26..c32804c 100644 --- a/docs-toc.yml +++ b/docs-toc.yml @@ -1,7 +1,8 @@ toc: - name: string - - string.bong - string.amplifyNotElision + - string.bong + - string.composeCorpus - string.extractPersonsName - string.extractRunOfCapitalWords - string.lowerCase @@ -13,9 +14,11 @@ toc: - string.removePunctuations - string.removeSplChars - string.retainAlphaNums + - string.sentences - string.soc - string.song - string.splitElisions + - string.stem - string.trim - string.upperCase - name: helper diff --git a/docs/index.html b/docs/index.html index 8bea798..c85a15c 100644 --- a/docs/index.html +++ b/docs/index.html @@ -34,6 +34,16 @@
Amplifies the not elision by converting it into not; for example isn't
+becomes is not
.
(string)
+ — the input string.
+
+ string
:
+ input string after not elision amplification.
+
+
+
+
+
+
+
+
+ amplifyNotElision( "someone's wallet, isn't it?" );
+// -> "someone's wallet, is not it?"
+
+
+
+
+
+
+
+
+Amplifies the not elision by converting it into not; for example isn't
-becomes is not
.
Generates all possible sentences from the input argument string.
+The string s must follow a special syntax as illustrated in the
+example below:
+'[I] [am having|have] [a] [problem|question]'
Each phrase must be quoted between [ ]
and each possible option of phrases
+(if any) must be separated by a |
character. The corpus is composed by
+computing the cartesian product of all the phrases.
string
:
- input string after not elision amplification.
+ Array<string>
:
+ of all possible sentences.
@@ -503,8 +615,11 @@ amplifyNotElision( "someone's wallet, isn't it?" );
-// -> "someone's wallet, is not it?"
+ composeCorpus( '[I] [am having|have] [a] [problem|question]' );
+// -> [ 'I am having a problem',
+// 'I am having a question',
+// 'I have a problem',
+// 'I have a question' ]
@@ -1393,6 +1508,99 @@ Splits the input string into sentences. Punctuation marks found at the end
+of a sentence are retained. The function can handle sentences beginning with
+numbers as well, though it is not a good english practice. It uses ~
as the
+special character for splitting and therefore it must not be present in the
+input string; else you may give another special character as the second argument.
(string)
+ — the input string.
+
+ (char
+ = '~'
)
+ — a single character to be used for splitting into sentences;
+it must not be resent in the
+str
+.
+
+ Array<string>
:
+ of sentences.
+
+
+
+
+
+
+
+
+ sentences( 'There is a cat. 2 dogs are running!' );
+// -> [ 'There is a cat.', '2 dogs are running!' ]
+
+
+
+
+
+
+
+
Stems an inflected word using Porter2 stemming algorithm.
+ + +(string)
+ — to be stemmed.
+
+ string
:
+ the stemmed word.
+
+
+
+
+
+
+
+
+ stem( 'consisting' );
+// -> 'consist'
+
+
+
+
+
+
+
+