JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4
  • Score
    100M100P100Q19264F
  • License MIT

Small library to collect words, optionally using a stemmer

Package Exports

  • @h9h/word-collect

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@h9h/word-collect) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

word-collect

Simple Library to collect word-sets, optionally using stemming algorithms

MIT license npm version Codacy Badge XO code style

Usage

const { collectWords } = require('../src/collector')

const text = '...'

const result = collectWords('de', text)
console.log(result.getWordDistribution(3))

Example

Mephistopheles:

Ein Teil von jener Kraft, Die stets das Böse will und stets das Gute schafft.

Faust:

Was ist mit diesem Rätselwort gemeint?

Mephistopheles:

Ich bin der Geist, der stets verneint! Und das mit Recht; denn alles, was entsteht, Ist wert, daß es zugrunde geht; Drum besser wär's, daß nichts entstünde. So ist denn alles, was ihr Sünde, Zerstörung, kurz, das Böse nennt, Mein eigentliches Element.

Faust:

Du nennst dich einen Teil, und stehst doch ganz vor mir?

Result:

Array(1)
    Array(2)
        0 = "stets"  // Word
        1 = 3        // Count

@h9h/word-collect

word-collect module

Given a text, this modules offers methods to

  • break the text into words
  • removes stop-words (aka noise)
  • stemm those words (reduzing them to their base form)
  • and counting the occurrences of these stemms

The result is a distribution of the main words in this text, giving a quick overview what it's all about.