el-name-tools
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

el-name-tools

Synopsis

El-name-tools is a package assembling a set of tools to work with Greek names.

  • It can recognize around 2000 forms of around 1200 male and female given names, present in its name dictionary
  • It can do so in the presence of usual misspellings, since matching is done using the phonetic rendering of the names
  • It can calculate namedays for specific years (data for 2019 - 2049 are included)
  • It can recognize the gender of any Greek name, regardless of its presence in the aforementioned dictionary
  • It can form the vocative form of any Greek name, regardless of its presence in the aforementioned dictionary
  • Optionally, it can form the vocative of the Canonical given name of the form, if it is found in the dictionary

Usage

Including the package

import {nametools} from 'el-name-tools';

Recognizing a name

This function identifies the name in the name dictionary and returns its stored data and its computed namedays for all years specified during initialization.

let name = nametools.recognizeName('Πάνος');
/* Results in:
{ name: 'Πάνος',
  skeleton: 'πανοσ',
  allnames:
   [ 'Παναγιώτης', 'Πάνος', 'Πανίκος', 'Γιώτης', 'Τάκης', 'Πανούσος' ],
  namedays:
   [ { case: 'fixed', date: '1970-08-15' },
     { case: 'fixed', date: '1970-12-26' },
     { case: 'fixed', date: '1970-04-21' } ],
  gender: 'MALE' 
}
*/ 

.allnames[0] is the Canonical given name for this entry.

Computing namedays for a range of years

            const namedayDates =  nametools.calculateNamedays(nameData, 2020, 2020)
const namedayDateΜillis = namedayDates[2020].map(
    d => d.getTime());
/* namedayDates is something like:
{ '2020':
  [ 2020-08-15T00:00:00.000Z,
    2020-12-26T00:00:00.000Z,
    2020-04-21T00:00:00.000Z ] 
}
 */

Recognizing and computing the vocative

This function identifies the name in the name dictionary and computes the vocative of its recognized form, or else computes the vocative based on its form.

let name = nametools.recognizeAndGetVocative('Πανήκος');
// Results in 'Πανίκο'

Recognizing and computing the normalized vocative

This function identifies the name in the name dictionary and computes the vocative of its normalized form, or else computes the vocative based on its form.

let name = nametools.recognizeAndGetNormalizedVocative('Πανήκος');
// Results in 'Παναγιώτη'

Recognizing and computing the gender

This function identifies the name in the name dictionary and returns its gender, or else computes the gender based on its form.

let name = nametools.recognizeAndGetGender('Πανήκος');
// Results in 'MALE'

Computing the vocative using the form of the name

let gender = nametools.getVocative('Πανήκος');
// Results in 'Πανήκο'

Computing the gender using the form of the name

let gender = nametools.getGender('Μπούλα');
// Results in 'FEMALE'

Phonetic Skeleton

The phonetic skeleton is the phonetic rendering of its argument, which must be a Greek word.

let skel = nametools.phoneticSkeleton('αιλουρος');
// Results in 'ελUροσ'

Resources

Links

Readme

Keywords

Package Sidebar

Install

npm i el-name-tools

Weekly Downloads

1

Version

2.0.0

License

MIT

Unpacked Size

571 kB

Total Files

11

Last publish

Collaborators

  • dsouflis