Giter VIP home page Giter VIP logo

nlp-js-tools-french's Introduction

NLP Javascript tools for french language

Tokenize, POS Tagger, lemmatizer and stemmer

This package is partly based on the Snowball stemming algorythm and the javascript adaptation by Kasun Gajasinghe, University of Moratuwa

This package offers 4 NLP tools in javascript for french language :

  • Tokenizing
  • POS Tagging
  • Lemmatizing
  • Stemming

Install

npm install nlp-js-tools-french

Usage

var NlpjsTFr = require('nlp-js-tools-french');

Corpus to use

var corpus = "Elle semble se nourrir essentiellement de plancton, et de hotdog.";

Configs

var config = {
    tagTypes: ['art', 'ver', 'nom'],
    strictness: false,
    minimumLength: 3,
    debug: true
};

New instance with specific corpus and configs

var nlpToolsFr = new NlpjsTFr(corpus, config);

These are the available methods, self-explanatory. Note: The sentence that is passed into the class earlier is automaticaly tokenized.

var tokenizedWords = nlpToolsFr.tokenized;
var posTaggedWords = nlpToolsFr.posTagger();
var lemmatizedWords = nlpToolsFr.lemmatizer();
var stemmedWords = nlpToolsFr.stemmer();
var stemmedWord = nlpToolsFr.wordStemmer("aléatoirement");

Attributes

config

Shows config

tokenized

["semble", "nourrir", "de"]

Methods return

posTagger()

[{
  "id": 1,
  "word": "semble",
  "pos": [
   "VER",
   "VER"
  ]
 },
 {
  "id": 2,
  "word": "nourrir",
  "pos": [
   "VER"
  ]
 },
 {
  "id": 3,
  "word": "de",
  "pos": [
   "NOM",
   "ART:def",
   "PRE"
  ]
 }]

lemmatizer()

[{
  "id": 1,
  "word": "semble",
  "lemma": "sembler"
 },
 {
  "id": 2,
  "word": "nourrir",
  "lemma": "nourrir"
 },
 {
  "id": 3,
  "word": "de",
  "lemma": "de"
 }]

stemmer()

[{
  "id": 1,
  "word": "semble",
  "stem": "sembl"
 },
 {
  "id": 3,
  "word": "nourrir",
  "stem": "nourr"
 },
 {
  "id": 5,
  "word": "de",
  "stem": "de"
}]

wordStemmer(word)

{
    word: "aléatoirement",
    stem: "aléatoir"
}

Config

Option Type Default Description
tagTypes Array ["adj", "adv", "art", "con", "nom", "ono", "pre", "ver", "pro"] List of dictionnaries the package will look in, in case you only need verbs or nouns, both or whatever else. If a word does not belong to any type, it is tagged as "UNK".
strictness Bool false If you set the strictness to true and try to POS Tag the word generalement, it will fail because the word is missine its accents. On the other hand, trying to POS Tag the word with the strictness set to false well return the types art, pre and nom because the word will match de in these dictionnaries.
minimumLength Int 1 Algorythms will ignore words that are shorter than this parameter.
debug Bool false Enable console debug

nlp-js-tools-french's People

Contributors

bastienbot avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.