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

alenka

v2.0.2

Published

Predicting Russian names from transliterated and short forms with statistical learning and Levenshtein distance

Downloads

5

Readme

Alenka 👧

Alenka is a free library for predicting Russian names (and genders) from transliterated and short forms with statistical learning and Levenshtein distance.

Alenka now is not a tool for inflection (see Lvovich) or parsing first/middle/last Russian names from strings. But it will somewhen be.

Advantages

Useful for social data and media analysis.

🌀 Natively in TypeScript

🔢 Statistically trained

❤ Simple and friendly API

⚙ Configurable

Usage

Install Alenka with npm or yarn.

npm i alenka
yarn add alenka

Using with default configuration

import { NamePredictor } from "alenka";

const np = new NamePredictor();

np.predictName('Саня') // 'Александр' as more frequent
np.predictName('Саня', 'female') // 'Александра'
np.predictName('Сирожа') // 'Сергей' due to Levenstein matching
np.predictName('$one4ka') // 'София' due to transliteration rules
np.predictName('asdasda') // undefined
np.predictGender('Соня') // 'female'
np.predictAll('Саня') // [{name: 'Александр', ...}, ...]

Using with custom configuration

import { NamePredictor } from "alenka";

const options = {
    useLevenshtein: false,
    // minAcceptibleDistance: 1,
    // frequenciesSource: 'vk',
    // handlingCase: 'ignore',
    // handlingYo: 'ignore',
} as const;

const np = new NamePredictor(options);

np.predictName('Сирожа') // 'unedfined'

Terminology

Terminology diagram

  1. Names are full forms of Russian Names (e.g. Александр or София);
  2. Shorts are shotened forms of names (e.g. Саша or Сонечка);
  3. Transliterations are latin versions of names or shorts (e.g. Alex or Sofia);
  4. Variants are names, shorts and transliterations together;
  5. Tokens are any strings including variatns (e.g. Саша, $0nechk@, abcdefg).

Prediction is mapping a token to a name. It happens via mathcing token against a dataset of names, shorts and transliterations with Levenshtein distance to find the closest one and return the relevant name. If nothing matched, undefined will be returned.

Contribution

Feel free to fork and leave pull requests.

To start development just run following familiar commands.

git clone https://github.com/solovevserg/alenka.git
cd alenka
yarn install
yarn test:watch

Roadmap

Here a list of actual tasks to participate at. Thanks in advance for any help.

  • Fix problems with handling 'ё'
  • Split in the dataset variants for shorts and tranliterations
  • Finish README
  • Add issues board (bug tracker)
  • Add ESLint
  • Add missing short forms to the data source
  • Write transliteration logic (instead of cyrillic-to-translit-js)
  • Optimize performance

About author

I am sergei Solovev, fullstack TS developer, data analyst and teacher. Look at my works here. For fast response get me on telegram

Licesnse

Copyright (c) 2022, Sergei Solovev [email protected]

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.