npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@lexar974/normalize-fr

v1.0.8

Published

A JavaScript library for French typography and text normalization.

Readme

@lexar974/normalize-fr

Bibliotheque JavaScript de normalisation typographique francaise.

normalize-fr transforme du texte brut en texte plus propre et plus conforme aux usages francais :

  • espaces et ponctuation ;
  • apostrophes typographiques ;
  • guillemets francais ;
  • points de suspension ;
  • espaces insecables ;
  • tirets ;
  • ligatures ;
  • caracteres invisibles ;
  • nombres et unites ;
  • abreviations ;
  • correction orthographique avec fallback IA local.

Installation

npm install @lexar974/normalize-fr

Utilisation

import { normalizeFrench } from "@lexar974/normalize-fr";

const text = "Bonjour   ! C'est un exemple...";
const result = normalizeFrench(text);

console.log(result);

Resultat :

Bonjour ! C'est un exemple...

Fonction principale

normalizeFrench(text, options)

Normalise un texte francais.

normalizeFrench('Il a dit : "Bonjour..."');

Profils

Les profils activent rapidement un ensemble de regles.

Basic

Correction legere :

normalizeFrench(text, {
    profile: "basic"
});

Active les espaces, les apostrophes et les points de suspension.

Typography

Profil recommande pour les sites web et applications :

normalizeFrench(text, {
    profile: "typography"
});

Active la ponctuation francaise, les guillemets, les espaces insecables, les tirets, les ligatures et la capitalisation.

Publishing

Profil complet pour livres, articles, PDF et documents professionnels :

normalizeFrench(text, {
    profile: "publishing"
});

Correction orthographique IA

normalizeSpelling() combine trois niveaux de correction :

  • corrections connues pour les fautes tres frequentes, par exemple bonjor ou mapelle ;
  • dictionnaire francais indexe pour les fautes proches ;
  • modele IA local en fallback quand le dictionnaire ne suffit pas.

Le modele IA est entierement local : aucune requete reseau n'est effectuee pendant la correction.

import { normalizeSpelling } from "@lexar974/normalize-fr";

console.log(normalizeSpelling("Bonjor je mapelle Pierre"));

Resultat :

Bonjour je m'appelle Pierre

Le fallback IA utilise :

  • un vocabulaire appris depuis le corpus d'entrainement ;
  • un index par prefixes pour limiter les candidats ;
  • un index par trigrammes de caracteres ;
  • une distance de Damerau-Levenshtein pour gerer substitutions, suppressions, insertions et inversions ;
  • un score qui combine similarite, frequence du mot et ecart de longueur ;
  • une protection contre les corrections trop agressives des noms propres en majuscule initiale.

Options avancees

Chaque regle peut etre activee ou desactivee :

normalizeFrench(text, {
    apostrophes: false,
    quotes: true,
    numbers: true
});

Mode debug

normalizeFrench(text, {
    debug: true
});

Retour :

{
    original: "Bonjour...",
    result: "Bonjour...",
    changes: [
        "ellipsis"
    ]
}

Fonctions individuelles

import {
    normalizeQuotes,
    normalizeSpaces,
    normalizeApostrophes,
    normalizeSpelling
} from "@lexar974/normalize-fr";

Modules disponibles

| Fonction | Role | |-|-| | normalizeSpaces | Nettoyage des espaces | | normalizeApostrophes | Apostrophes typographiques | | normalizeEllipsis | Points de suspension | | normalizePunctuation | Ponctuation francaise | | normalizeQuotes | Guillemets francais | | normalizeNonBreakingSpaces | Espaces insecables | | normalizeDashes | Tirets typographiques | | normalizeLigatures | Ligatures | | normalizeUnicode | Normalisation Unicode | | normalizeNumbers | Formatage des nombres | | normalizeUnits | Espaces avant les unites | | normalizeAbbreviations | Abreviations francaises | | normalizeDates | Dates francaises | | normalizeSpelling | Correction orthographique avec fallback IA |


Compatibilite

  • Node.js >= 18
  • ES Modules

Licence

MIT