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

@mailwoman/neural

v4.12.0

Published

Mailwoman neural classifier runtime: SentencePiece tokenizer + ONNX inference + decoder wiring.

Downloads

2,313

Readme

@mailwoman/neural

Neural address classifier — SentencePiece tokenizer, ONNX runtime inference, and decoder wiring for the Mailwoman address parser.

This is the engine that runs the trained transformer model (shipped separately as @mailwoman/neural-weights-en-us and @mailwoman/neural-weights-fr-fr). It handles tokenization, ONNX session management, soft-feature injection (anchor, gazetteer), Viterbi decoding, and the ProposalClassifier / ProductionScorer high-level APIs.

import { createScorer, loadTokenizer, loadModel } from "@mailwoman/neural"

// Load a weights bundle (model.onnx + tokenizer.model + model-card.json)
const scorer = await createScorer({
	weightsPath: "path/to/neural-weights-en-us",
})
const result = scorer.score(tokens)

// Or at a lower level
const tokenizer = await loadTokenizer("path/to/tokenizer.model")
const session = await loadModel("path/to/model.onnx")

What's inside

| Module | Purpose | | --------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | | tokenizer.ts | SentencePiece unigram tokenizer (loads .model file) | | onnx-runner.ts | ONNX Runtime Web inference session (WebGPU / WASM backends) | | classifier.ts | NeuralAddressClassifier — tokenize → run → decode | | scorer.ts | createScorer / ProductionScorer — canonical entry point that reads requires from model-card.json and fails closed | | anchor-inference.ts | Postcode anchor feature injection (soft channel, not override) | | gazetteer-inference.ts | Gazetteer lexicon soft-feature injection | | viterbi.ts | Viterbi decoder (linear-chain CRF) with BIO transition masks | | labels.ts | Label index ↔ ComponentTag mapping | | weights.ts | Weight loading from @mailwoman/neural-weights-* bundles | | soft-features.ts | Soft-feature vector construction (anchor + gazetteer channels) | | postcode-anchor.ts | Postcode extraction and anchor coordinate resolution | | postcode-binary-resolver.ts | Sorted-binary postcode lookup (browser) | | query-shape-prior.ts | Query-shape-based emission priors | | span-proposal-prior.ts | Phrase-grouper-based span proposal priors | | span-proposer-lexicon.ts | Lexicon-based span proposals | | proposal-classifier.ts | Proposal-level classification wrapper | | case-normalize.ts | All-caps case normalization before the model |

Key exports

// Canonical entry point — respects model-card.json "requires" contract
export { createScorer, ProductionScorer, type Scorer } from "./scorer.js"

// Tokenizer (SentencePiece unigram, byte_fallback)
export { loadTokenizer, Tokenizer, tokenizeToIds } from "./tokenizer.js"

// ONNX inference
export { loadModel, createOrtSession, OnnxRunner } from "./onnx-runner.js"

// Neural classifier
export { NeuralAddressClassifier } from "./classifier.js"

// Decoder (Viterbi + BIO masks + argmax)
export { viterbi, softmax, perTokenArgmax, buildBioTransitionMask } from "./viterbi.js"

// Label mapping
export { labelIndexToClassification, classificationToLabelIndices } from "./labels.js"

// Weight loading
export { loadFromWeights, type WeightsBundle } from "./weights.js"

// Anchor + gazetteer features (soft channels, never overrides)
export { AnchorInference, type AnchorResult } from "./anchor-inference.js"
export { GazetteerInference } from "./gazetteer-inference.js"

// Postcode lookup
export { extractPostcodeAnchors } from "./postcode-anchor.js"
export { PostcodeBinaryResolver } from "./postcode-binary-resolver.js"

// Case normalization
export { normalizeCase, type CaseNormalizeResult } from "./case-normalize.js"

Ship-config contract

The ProductionScorer reads model-card.json's requires block and fails closed if a declared channel isn't fed. Do not hand-wire ONNX sessions with zero-filled anchor inputs — anchor-off is out-of-distribution for the shipped model.

Related

License

AGPL-3.0-only