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 🙏

© 2026 – Pkg Stats / Ryan Hefner

tiny-mood-generate

v0.3.0

Published

Build a project-specific mood table from your content using GloVe embeddings. Dev/build-time only — not a runtime dependency of tiny-mood.

Readme

tiny-mood-generate

Build a tiny-mood mood table from your own content, using real GloVe word embeddings instead of a small hand-written word list.

This is a build-time tool, not a runtime dependency. It reads your blog posts, looks up the words that actually appear in them, and writes a small JSON file. Your app never needs this package or GloVe itself at runtime — only the generated JSON.

What it is

tiny-mood's mood scoring works by averaging known words in a lookup table. The problem with a small hand-written table is coverage: words like "acquisition," "regulatory," or "orchestration" simply aren't in it, so any post using that kind of vocabulary scores as falsely neutral.

tiny-mood-generate fixes this by scanning your real content for its actual vocabulary, looking each word up in a pre-trained GloVe embedding, and calibrating the result against a small set of reference words with known mood values — so the judgment already encoded in tiny-mood's defaults carries over to any word GloVe has seen, not just the words someone happened to type into a hardcoded list.

Install

npm install -D tiny-mood-generate

Quick start

npx tiny-mood-generate ./content ./mood-table.json

./content should be a directory of JSON files with title, description, and optionally sections (each with heading/body) — typically your blog post source files.

On first run, this downloads and caches a GloVe embeddings file (~59 MB, one time, reused across all future projects on your machine). You'll be asked to confirm before anything downloads:

tiny-mood-generate needs a GloVe word embeddings file to build your mood table.

Source: Zenodo (Leipzig University mirror of Stanford's GloVe 6B, 50-dimensional)
Size: ~59 MB, one-time download
Cached at: ~/.cache/tinymood/glove.6B.50d.txt
License: Public Domain Dedication and License v1.0

Proceed with download? (y/n)

Every run after the first reuses the cached file instantly — no repeat downloads, no repeat prompts.

// In your app, using tiny-mood (separate package):
import { getMoodBackground } from 'tiny-mood'
import moodTable from './mood-table.json'

getMoodBackground(text, moodTable, seed)

CLI usage

npx tiny-mood-generate <contentDir> <outputPath> [options]

| Flag | What it does | |---|---| | --glove <path> | Use a GloVe file you already have instead of downloading. Accepts plain-text format (word d1 d2 d3...) or the gensim binary word2vec format — both are detected and handled automatically. | | --yes | Skip the download confirmation prompt (for CI / non-interactive use). |

Examples

# Standard use — downloads and caches GloVe automatically on first run
npx tiny-mood-generate ./blog/content ./blog/mood-table.json

# Use a GloVe file you already have
npx tiny-mood-generate ./content ./mood-table.json --glove ./glove.6B.300d.txt

# Non-interactive, e.g. in a CI pipeline
npx tiny-mood-generate ./content ./mood-table.json --yes

What you'll see

Scanning content in ./content...
Generation stats:
  vocabulary words found in content: 84
  calibration anchors requested: 27
  calibration anchors found in GloVe source: 27
  words successfully scored: 84
  words not found in GloVe source (skipped): 0
Wrote 84 word vectors to ./mood-table.json

Use it with tiny-mood:
  import { getMoodBackground } from 'tiny-mood'
  import moodTable from './mood-table.json'
  getMoodBackground(text, moodTable, seed)

Words not found in the GloVe source are silently skipped, the same way an unknown word is skipped by tiny-mood's default table — no crash, no placeholder value, just absence.

Functions

For use in your own build scripts, instead of the CLI:

generateMoodTable(contentDir, glovePath)

Runs the full scan → lookup → calibrate → score pipeline. Returns { table, stats }.

ensureGloveFile(options?)

Handles the download/cache/format-conversion logic on its own — useful if you want to trigger the GloVe acquisition step separately from generation, or build your own CLI on top of it. Returns the local path to a ready-to-use plain-text GloVe file.

Regenerating as content grows

The table is a static snapshot of your vocabulary at the time you ran the command. New posts with new words won't be scored until you regenerate:

npx tiny-mood-generate ./content ./mood-table.json --yes

This is fast after the first run — the GloVe file is cached, so regenerating only re-runs the scan/lookup/calibrate steps, not the download.

Where this fits

your content (JSON)  ──┐
                        ├──>  tiny-mood-generate  ──>  mood-table.json
GloVe embeddings  ──────┘            (build time)          │
                                                             ▼
                                                  tiny-mood (runtime)
                                                  getMoodBackground(...)

tiny-mood-generate and the GloVe file it uses never ship inside your app's runtime bundle or dependency tree — they're a devDependency only, used to produce one small JSON file that tiny-mood reads at runtime.

Try it live

[StackBlitz demo — link coming soon]

License

MIT. GloVe embeddings are from Stanford's GloVe project, redistributed via Zenodo under the Public Domain Dedication and License v1.0.