Skip to content

Inist-CNRS/node-jbj-nlp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Natural language processing for JBJ

Add filters to JBJ.

Installation

With npm do:

$ npm install jbj-nlp

Documentation

Usage

var JBJ = require('jbj');

JBJ.use(require('jbj-nlp'));

Filters

anglicize: true

Anglicize a string

var stylesheet = {
  "set": "ÂÇİĞÖŞÜÑ âçığöşüñ",
  "anglicize": true
};
JBJ.render(stylesheet, console.log);
// ACIGOSUN acigosun

countCharacters: true | slug | /regex_expression/

Count characters. Options:

  • true: all characters, including white spaces
  • slug: alphanumeric characters
  • regex: characters matching the regex
var stylesheet = {
  "set": "L'arbre de Jean-Claude est tombé.",
  "countCharacters" : true
};
JBJ.render(stylesheet, console.log);
// 33

countWords: see the tokenized filter for the arguments

Count tokenized words

var stylesheet = {
  "set": "L'arbre de Jean-Claude est tombé.",
  "countWords" : true
};
JBJ.render(stylesheet, console.log);
// 6

tokenize: true | slug | /regex_expression/

Tokenise a string.Options:

  • true: split on white spaces and ponctuation, keep dashes and quotes
  • slug: split on non-alphanumeric characters
  • regex: split with the given regex
var stylesheet = {
  "set": "L'arbre de Jean-Claude est tombé.",
  "tokenize" : true
};
JBJ.render(stylesheet, console.log);
// ["L'","arbre","de","Jean-Claude","est","tombé"]

metaphone

Gives a phonetics approximate to the input string.

var stylesheet = {
  "set": "Psychologue",
  "metaphone" : true
};
JBJ.render(stylesheet, console.log);
// PSXLK

About

Natural Language Processing JBJ module

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors