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 🙏

© 2024 – Pkg Stats / Ryan Hefner

greek-utils

v1.3.0

Published

Utilities for Greek language such as accent and diacritics replacement

Downloads

5,527

Readme

Greek Utilities

Build Status

A JavaScript library for Greek language with utilities such as replacement of accented and other diacritics characters, conversion from Greek to phonetic, transliterated or greeklish Latin and more, like Greek stopwords removal.

NPM

Installation

npm install --save greek-utils

Usage

Node.js

var greekUtils = require('greek-utils');

- sanitizeDiacritics()

Convert all diacritics symbols to their simple equivalent

Example 1 (modern Greek):

var sanitized = greekUtils.sanitizeDiacritics('Αρνάκι άσπρο και παχύ');
console.log(sanitized); //Αρνακι ασπρο και παχυ

Example 2 (ancient Greek):

var sanitized = greekUtils.sanitizeDiacritics('Ἐξ οὗ καὶ δῆλον ὅτι οὐδεμία τῶν ἠθικῶν ἀρετῶν φύσει ἡμῖν ἐγγίνεται');
console.log(sanitized); //Εξ ου και δηλον οτι ουδεμια των ηθικων αρετων φυσει ημιν εγγινεται

- toGreek()

Convert a Latin characters text to its modern Greek equivalent

Example:

var greek = greekUtils.toGreek('kalhmera, pws eiste?');
console.log(greek); //καλημερα, πως ειστε;

- toGreeklish()

Convert a modern Greek characters text to its greeklish equivalent

Example:

var greeklish = greekUtils.toGreeklish('Εύηχο: αυτό που ακούγεται ωραία.');
console.log(greeklish); //Euhxo: auto pou akougetai wraia.

- toPhoneticLatin()

Convert a modern Greek characters text to its phonetically equivalent Latin (sound mapping).

Example:

var phoneticLatin = greekUtils.toPhoneticLatin('Εύηχο: αυτό που ακούγεται ωραία.');
console.log(phoneticLatin); //Évikho: aftó pou akoúyete oréa.

- toTransliteratedLatin()

Convert a modern Greek characters text to its transliterated equivalent Latin (letter mapping).

Example:

var transliteratedLatin = greekUtils.toTransliteratedLatin('Εύηχο: αυτό που ακούγεται ωραία.');
console.log(transliteratedLatin); //Eúēkho: autó pou akoúgetai ōraía.
Ignoring characters

All of the above functions accept an optional second parameter as a string with characters you don't wish to be converted.

Example:

var greeklish = greekUtils.toGreeklish('καλημερα, πως ειστε;', 'ε');
console.log(greeklish); //kalhmεra, pws εistε?

- removeStopWords()

Remove all stop words from the given text, for both ancient and modern Greek. Also accepts an optional flag, which when set to true will remove the multiple whitespaces that probably have occurred in the text after removing the stop words.

Note: The default value for that flag is false, so multiple whitespaces are expected to be returned.

Examples:

  • Without stripping the extra white spaces:

    var withoutStopwordsPreservedWhitespace = greekUtils.removeStopWords('Αυτή είναι μια απλή πρόταση, που δείχνει την αφαίρεση όλων των stopwords της αρχαίας και νέας Ελληνικής γλώσσας και επιστρέφει το καθαρό κείμενο.', false);
      
    console.log(withoutStopwordsPreservedWhitespace); //μια απλή πρόταση,  δείχνει  αφαίρεση όλων  stopwords  αρχαίας  νέας Ελληνικής γλώσσας  επιστρέφει  καθαρό κείμενο.
  • With stripping the extra white spaces:

    var withoutStopwordsPreservedWhitespace = greekUtils.removeStopWords('Αυτή είναι μια απλή πρόταση, που δείχνει την αφαίρεση όλων των stopwords της αρχαίας και νέας Ελληνικής γλώσσας και επιστρέφει το καθαρό κείμενο.', true);
      
    console.log(withoutStopwordsPreservedWhitespace); //μια απλή πρόταση, δείχνει αφαίρεση όλων stopwords αρχαίας νέας Ελληνικής γλώσσας επιστρέφει καθαρό κείμενο.