Skip to content

Commit

Permalink
docs(*): complete JSDoc for tokens- stem, phonetize, soundex
Browse files Browse the repository at this point in the history
  • Loading branch information
sanjayaksaxena committed Oct 13, 2017
1 parent 946f623 commit eb99464
Show file tree
Hide file tree
Showing 6 changed files with 426 additions and 10 deletions.
4 changes: 4 additions & 0 deletions docs-toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ toc:
- string.tokenize0
- string.trim
- string.upperCase
- name: tokens
- tokens.phonetize
- tokens.soundex
- tokens.stem
- name: helper
- helper.returnIndexer
- helper.returnQuotedTextExtractor
Expand Down
283 changes: 283 additions & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,46 @@ <h3 class='mb0 no-anchor'>wink-nlp-utils</h3>
</li>


<li><a
href='#tokens'
class="h5 bold black caps">
tokens

</a>

</li>


<li><a
href='#tokensphonetize'
class="">
tokens.phonetize

</a>

</li>


<li><a
href='#tokenssoundex'
class="">
tokens.soundex

</a>

</li>


<li><a
href='#tokensstem'
class="">
tokens.stem

</a>

</li>


<li><a
href='#helper'
class="h5 bold black caps">
Expand Down Expand Up @@ -2535,6 +2575,249 @@ <h3 class='fl m0' id='stringuppercase'>



</section>




<div class='keyline-top-not py2'><section class='py2 clearfix'>

<h2 id='tokens' class='mt0'>
tokens
</h2>





</section>
</div>



<section class='p2 mb2 clearfix bg-white minishadow'>


<div class='clearfix'>

<h3 class='fl m0' id='tokensphonetize'>
tokens.phonetize
</h3>


</div>


<p>Phonetizes input tokens using using an algorithmic adaptation of Metaphone.</p>


<div class='pre p1 fill-light mt0'>tokens.phonetize</div>











<div class='py1 quiet mt1 prose-big'>Parameters</div>
<div class='prose'>

<div class='space-bottom0'>
<div>
<span class='code bold'>tokens</span> <code class='quiet'>(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>&#x3C;<a href="#string">string</a>>)</code>
— the input tokens.

</div>

</div>

</div>






<div class='py1 quiet mt1 prose-big'>Returns</div>
<code><a href="#string">string</a></code>:
phonetized tokens.








<div class='py1 quiet mt1 prose-big'>Example</div>


<pre class='p1 overflow-auto round fill-light'>phonetize( [ <span class="hljs-string">'he'</span>, <span class="hljs-string">'acted'</span>, <span class="hljs-string">'decisively'</span>, <span class="hljs-string">'today'</span> ] );
<span class="hljs-comment">// -&gt; [ 'h', 'aktd', 'dssvl', 'td' ]</span></pre>








</section>




<section class='p2 mb2 clearfix bg-white minishadow'>


<div class='clearfix'>

<h3 class='fl m0' id='tokenssoundex'>
tokens.soundex
</h3>


</div>


<p>Generates the soundex coded tokens from the input tokens.</p>


<div class='pre p1 fill-light mt0'>tokens.soundex</div>











<div class='py1 quiet mt1 prose-big'>Parameters</div>
<div class='prose'>

<div class='space-bottom0'>
<div>
<span class='code bold'>tokens</span> <code class='quiet'>(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>&#x3C;<a href="#string">string</a>>)</code>
— the input tokens.

</div>

</div>

</div>






<div class='py1 quiet mt1 prose-big'>Returns</div>
<code><a href="#string">string</a></code>:
soundex coded tokens.








<div class='py1 quiet mt1 prose-big'>Example</div>


<pre class='p1 overflow-auto round fill-light'>soundex( [ <span class="hljs-string">'he'</span>, <span class="hljs-string">'acted'</span>, <span class="hljs-string">'decisively'</span>, <span class="hljs-string">'today'</span> ] );
<span class="hljs-comment">// -&gt; [ 'H000', 'A233', 'D221', 'T300' ]</span></pre>








</section>




<section class='p2 mb2 clearfix bg-white minishadow'>


<div class='clearfix'>

<h3 class='fl m0' id='tokensstem'>
tokens.stem
</h3>


</div>


<p>Stems input tokens using Porter Stemming Algorithm Version 2.</p>


<div class='pre p1 fill-light mt0'>tokens.stem</div>











<div class='py1 quiet mt1 prose-big'>Parameters</div>
<div class='prose'>

<div class='space-bottom0'>
<div>
<span class='code bold'>tokens</span> <code class='quiet'>(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>&#x3C;<a href="#string">string</a>>)</code>
— the input tokens.

</div>

</div>

</div>






<div class='py1 quiet mt1 prose-big'>Returns</div>
<code><a href="#string">string</a></code>:
stemmed tokens.








<div class='py1 quiet mt1 prose-big'>Example</div>


<pre class='p1 overflow-auto round fill-light'>stem( [ <span class="hljs-string">'he'</span>, <span class="hljs-string">'acted'</span>, <span class="hljs-string">'decisively'</span>, <span class="hljs-string">'today'</span> ] );
<span class="hljs-comment">// -&gt; [ 'he', 'act', 'decis', 'today' ]</span></pre>








</section>


Expand Down
45 changes: 45 additions & 0 deletions src/tokens-phonetize.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// wink-nlp-utils
// NLP Functions for removing HTML Tags, Managing Elisions,
// NGrams, phonetizeming, Phoneticising to Tokenizating and more.
//
// Copyright (C) 2017 GRAYPE Syphonetizes Private Limited
//
// This file is part of “wink-nlp-utils”.
//
// “wink-nlp-utils” is free software: you can redistribute it
// and/or modify it under the terms of the GNU Affero
// General Public License as published by the Free
// Software Foundation, version 3 of the License.
//
// “wink-nlp-utils” is distributed in the hope that it will
// be useful, but WITHOUT ANY WARRANTY; without even
// the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU Affero General
// Public License for more details.
//
// You should have received a copy of the GNU Affero
// General Public License along with “wink-nlp-utils”.
// If not, see <http://www.gnu.org/licenses/>.

//
var stringPhonetize = require( './string-phonetize.js' );

// ## tokens

// ### phonetize
/**
*
* Phonetizes input tokens using using an algorithmic adaptation of Metaphone.
*
* @name tokens.phonetize
* @param {string[]} tokens — the input tokens.
* @return {string} phonetized tokens.
* @example
* phonetize( [ 'he', 'acted', 'decisively', 'today' ] );
* // -> [ 'h', 'aktd', 'dssvl', 'td' ]
*/
var phonetize = function ( tokens ) {
return tokens.map( stringPhonetize );
}; // phonetize()

module.exports = phonetize;
Loading

0 comments on commit eb99464

Please sign in to comment.