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

glost-pos

v0.4.0

Published

Part-of-speech extension for GLOST - generates and formats POS data

Downloads

179

Readme

glost-pos

Part-of-speech extension for GLOST - generates and formats POS data.

Overview

This package provides POS tagging for GLOST documents. It separates POS generation (tagging words) from POS enhancement (formatting for display).

Philosophy: No Data > Bad Data

This package intentionally does NOT include heuristic/rule-based taggers. Inaccurate POS tags are worse than no tags. You must provide a real POS tagger based on:

  • NLP models (e.g., MeCab for Japanese, Stanford NLP)
  • Dictionary-based tagging
  • Other validated language resources

Architecture

  • Generator: Tags words using a provider (language-specific NLP or dictionary)
  • Enhancer: Formats POS tags with categories and abbreviations (language-agnostic)
  • Provider Pattern: Pluggable taggers (NLP models, dictionaries)

Installation

pnpm add glost-pos

Usage

With Language-Specific Provider (Required)

import { createPOSGeneratorExtension, createPOSEnhancerExtension } from "glost-pos";
import { createThaiPOSProvider } from "glost-th/extensions";

// Create language-specific provider
const thaiProvider = createThaiPOSProvider(datasource);

// Create extensions
const generator = createPOSGeneratorExtension({
  targetLanguage: "th",
  provider: thaiProvider
});

const enhancer = createPOSEnhancerExtension({
  normalize: true,
  customMappings: {
    "n": { category: "Noun", abbreviation: "N" }
  }
});

// Process
const result = await processGLOSTWithExtensionsAsync(doc, [generator, enhancer]);

Enhancer Only (Data Already Present)

If your documents already have POS data:

import { POSEnhancerExtension } from "glost-pos";
import { processGLOSTWithExtensions } from "glost-extensions";

const result = processGLOSTWithExtensions(document, [POSEnhancerExtension]);

Universal POS Tags

The enhancer uses Universal Dependencies POS categories:

  • noun - Noun
  • verb - Verb
  • adjective - Adjective
  • adverb - Adverb
  • pronoun - Pronoun
  • preposition - Preposition
  • conjunction - Conjunction
  • interjection - Interjection
  • article - Article
  • determiner - Determiner
  • particle - Particle
  • numeral - Numeral
  • auxiliary - Auxiliary verb
  • punctuation - Punctuation

Creating Custom Providers

Implement the POSProvider interface:

import type { POSProvider } from "glost-pos";

export function createMyPOSProvider(config): POSProvider {
  return {
    async getPOS(word: string, language: string): Promise<string | undefined> {
      // Your POS tagging logic
      const result = await nlpModel.tag(word, language);
      return result.pos;
    }
  };
}

API

createPOSGeneratorExtension(options)

Creates extension that tags words with POS.

Options:

  • targetLanguage - ISO-639-1 language code
  • provider - POSProvider instance
  • skipExisting - Skip words with existing POS (default: true)

createPOSEnhancerExtension(options)

Creates extension that formats POS data.

Options:

  • normalize - Normalize POS tags (default: true)
  • customMappings - Tag → POSTagInfo mappings

Creating Custom Providers

Implement the POSProvider interface with a real tagger:

import type { POSProvider } from "glost-pos";

export function createMyPOSProvider(tagger: NLPTagger): POSProvider {
  return {
    async getPOS(word, language) {
      const result = await tagger.analyze(word, language);
      return result?.pos; // Return undefined if no data, don't guess!
    }
  };
}

createPOSExtension(options)

Convenience function that creates both generator and enhancer.

Returns: [generator, enhancer]

Migration from glost-extensions

Before (v0.1.x):

import { PartOfSpeechExtension } from "glost-extensions";
processGLOSTWithExtensions(doc, [PartOfSpeechExtension]);

After (v0.2.0+):

import { createPOSExtension, createSimplePOSProvider } from "glost-pos";

const provider = createSimplePOSProvider();
const [generator, enhancer] = createPOSExtension({
  targetLanguage: "en",
  provider
});

await processGLOSTWithExtensionsAsync(doc, [generator, enhancer]);

License

MIT