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-core

v0.5.0

Published

Core types, nodes, and utilities for GLOST (Glossed Syntax Tree)

Readme

glost

Core types and node creation for GLOST (Glossed Syntax Tree).

What is GLOST?

GLOST (Glossed Syntax Tree) is a Concrete Syntax Tree format that extends nlcst to support language learning annotations:

  • Translations and glosses in multiple languages
  • Difficulty levels and word frequency data
  • Pronunciation guides (IPA, romanization, transcription systems)
  • Cultural context and usage notes
  • Part-of-speech tagging
  • Grammar metadata for language learners

Installation

pnpm add glost

Usage

Simple Document Creation (Recommended)

import { createSimpleDocument, getAllWords, NODE_TYPES } from "glost";
import type { GLOSTWord, GLOSTRoot } from "glost";

// Create a simple document from words
const words = [
  createGLOSTWordNode({ value: "hello", lang: "en", script: "latin" }),
  createGLOSTWordNode({ value: "world", lang: "en", script: "latin" })
];

const document = createSimpleDocument(words, "en", "latin", {
  sentenceText: "hello world"
});

// Access words with type-safe helpers
const allWords = getAllWords(document);
console.log(allWords.length); // 2

Manual Word Creation

import { createGLOSTWordNode, createGLOSTRootNode } from "glost";
import type { GLOSTWord, GLOSTRoot } from "glost";

// Create a word node with annotations
// Language codes: ISO-639-1, ISO-639-3, or BCP-47 all work
const word = createGLOSTWordNode({
  value: "สวัสดี", // Thai: hello
  transcription: {
    rtgs: { text: "sà-wàt-dii", system: "rtgs" },
    ipa: { text: "sa.wàt.diː", system: "ipa" }
  },
  metadata: {
    partOfSpeech: "interjection",
    usage: "greeting"
  },
  lang: "th",    // Can also use "tha" (ISO-639-3) or "th-TH" (BCP-47)
  script: "thai"
});

API

Node Factory Functions

All factory functions accept a single options object for better readability and extensibility.

createGLOSTWordNode(options)

Create a word node with transcription and metadata.

const word = createGLOSTWordNode({
  value: "hello",
  transcription: { ipa: { text: "həˈloʊ", system: "ipa" } },
  metadata: { partOfSpeech: "interjection" },
  lang: "en",        // optional
  script: "latin",   // optional
  extras: {}         // optional extension data
});

createGLOSTSentenceNode(options)

Create a sentence node containing word nodes.

const sentence = createGLOSTSentenceNode({
  originalText: "Hello world",
  lang: "en",
  script: "latin",
  children: [wordNode1, wordNode2],  // optional
  transcription: {},                  // optional
  extras: {}                          // optional
});

createGLOSTRootNode(options)

Create a root document node.

const root = createGLOSTRootNode({
  lang: "en",
  script: "latin",
  children: [paragraphNode],           // optional
  metadata: { title: "My Document" },  // optional
  extras: {}                           // optional
});

Helper Functions

Convenience functions for common language patterns:

createSimpleWord(options)

const word = createSimpleWord({
  text: "hello",
  transliteration: "həˈloʊ",
  system: "ipa",           // default: "ipa"
  partOfSpeech: "noun"     // default: "unknown"
});

Language-Specific Helpers

Note: As of v0.2.0, language-specific helpers have been moved to separate packages.

Thai Language Support

npm install glost-th
import { createThaiWord } from 'glost-th';

const word = createThaiWord({
  text: "สวัสดี",
  rtgs: "sawatdi",
  partOfSpeech: "interjection",
  tone: 2,
  syllables: ["sa", "wat", "di"]
});

See glost-th documentation.

Japanese Language Support

npm install glost-ja
import { createJapaneseWord } from 'glost-ja';

const word = createJapaneseWord({
  text: "こんにちは",
  romaji: "konnichiwa",
  partOfSpeech: "interjection",
  furigana: "こんにちは"
});

See glost-ja documentation.

Migration: See MIGRATION.md for upgrading from v0.1.x.

Features

  • TypeScript support
  • Extends nlcst (Natural Language Concrete Syntax Tree)
  • Aims for compatibility with unist ecosystem
  • Framework-agnostic
  • Includes Zod validation schemas

Related Packages

Core Packages

  • glost-common - Shared utilities and language configs
  • glost-extensions - Extension system for transforming GLOST trees
  • glost-utils - Utilities for working with GLOST documents

Language Packages

  • glost-th - Thai language support
  • glost-ja - Japanese language support

Documentation

See the main GLOST repository for full documentation.