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 🙏

© 2025 – Pkg Stats / Ryan Hefner

lexic

v0.0.2

Published

Lexic analyser

Downloads

841

Readme

lexic.js

Lexic analyser

Warning! It's not working now!

Now it's just a dictionaries, parsed to JSON. Sources of dictionaries mined from aot.ru

Usage

var Lexic = require('lexic');

Lexic.create({<options>}, function(error, lexic) {
    if (err) throw err;
    // lexic is a new lexic analyser
});

Documentation

In that distribution there are 3 dictionary json's. They are pretty heavy, so, you may remove those you aren't interested in. You may find them in dic/ folder

Module

module.create(options, callback)

Arguments

  • options - is an object of options.
  • callback - is a function, there will be err and lexic passed into a callback

Options

  • lang - is a language of creating dictionary. Now it can be ru, en, de

lexic

it's a special object contains methods to analyze text. It has property lexic.dictionary which is the reference to the dictionary object

###lexic.analyze(string)

Method to parse the text. Now it's not working, just splitting text to sentences. Returns the array of strings.

lexic.findWord(string)

Method to find and collect data about word. It returns special object - word

Arguments

  • string - a word, you want to find and wrap. You should pass into only string with no spaces, dots, commas, and other stuff. You will just get nothing useful, following another way.

dictionary

It's a special object contains massive JSON dictionary and some methods to work with it.

dictionary.parse(string, deep)

Method returns an array of theories. It is low levelled, so, I don't expect anyone will use it.

Theory is an object.

Theory properties

  • variants - array of grammar elements
  • base - base grammar element of the theory
  • assumption - is the assumption of theory. Contain base - hypothetical lemma of string, and ending - hypothetical ending of string

Arguments

  • string - is a string you want to parse. The string should be in language, you passed to options of Lexic.create().
  • deep - boolean. false by default. If true method will try to find every possible variant in dictionary, no matter how many variants it already founded.

dictionary.store(path, callback)

That method will help you to store loaded json. callback will be called with only err, if there will be smth wrong

dictionary.mine(options, callback)

I don't expect anyone will use that method, aot.ru do not update their dictionaries. That method will drop current loaded json dictionary, and may overwrite existing dictionaries, so, don't use it!

Arguments

  • options - is an object of options.
  • callback - callback will be called with only err, if there will be smth wrong

Options

  • dic - is the path to main dictionary. Dictionary should be in aot.ru format. It often has extension .mrd
  • lang - the language of mining dictionary. It changes the lang of a dictionary
  • gram - a grammar file, it often sounds like egramtab.tab, from aot.ru too
  • path - path for storing json dictionary

###dictionary.load(callback)

A method to load json dictionary. It's only for initialization, don't use it!

word

Word is an object of result. It has possible variants of grammar forms of source string inside of it. Variants are int hre property word.variants

word.toString()

Returns source string

word.grammar([all])

Returns the string with description of the active variant of the grammar form of the word

Arguments

  • all - boolean argument, false by default. If true = method will return information about all grammar forms.

word.otherVariant()

Method will switch active variant of the grammar form.

word.getBase()

Method will try to find the base form of the word. It's not working good now