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

lao-grammar-checker

v1.1.1

Published

A utility to check grammar and split Lao language sentences into individual words

Readme

Lao Grammar Checker

ເຄື່ອງມືສຳລັບກວດໄວຍະກອນຄຳພາສາລາວ ແລະ ແຍກປະໂຫຍກພາສາລາວ ອອກເປັນແຕ່ລະຄຳອີງຕາມໂຄງສ້າງພາສາ.

A utility to check grammar in Lao language sentences and split the text into individual words based on syllable structure rules.

ການຕິດຕັ້ງ / Installation

npm install lao-grammar-checker

ການໃຊ້ງານ / Usage

import { laoGrammarCheck } from 'lao-grammar-checker';

// Example 1: Basic usage
const sentence = "ສະບາຍດີຕອນເຊົ້າ";
const results = laoGrammarCheck(sentence);
console.log(results);
/* Output:
[
  { word: "ສະ", startIndex: 0, endIndex: 1, grammarCorrect: true },
  { word: "ບາຍ", startIndex: 2, endIndex: 4, grammarCorrect: true },
  { word: "ດີ", startIndex: 5, endIndex: 6, grammarCorrect: true },
  { word: "ຕອນ", startIndex: 7, endIndex: 9, grammarCorrect: true },
  { word: "ເຊົ້າ", startIndex: 10, endIndex: 14, grammarCorrect: true }
]
*/

// Example 2: Finding grammar errors
const textWithErrors = "ທາງເດ່ອນແມ່ນຫ່";
const errorResults = laoGrammarCheck(textWithErrors);
console.log(errorResults);
/* Output:
[
  { word: "ທາງ", startIndex: 0, endIndex: 2, grammarCorrect: true },
  { word: "ເດ່ອນ", startIndex: 3, endIndex: 7, grammarCorrect: false },
  { word: "ແມ່ນ", startIndex: 8, endIndex: 11, grammarCorrect: true },
  { word: "ຫ່", startIndex: 12, endIndex: 13, grammarCorrect: false },
]
*/

// Example 3: Mixed Lao, non-Lao, and incorrect words
const mixedText = "lao 123ປທ້ດເທດgrammarລວ!#$";
const mixedResults = laoGrammarCheck(mixedText);
console.log(mixedResults);
/* Output:
[
  { word: "lao", startIndex: 0, endIndex: 2, grammarCorrect: true },
  { word: " ", startIndex: 3, endIndex: 3, grammarCorrect: true },
  { word: "123", startIndex: 4, endIndex: 6, grammarCorrect: true },
  { word: "ປ", startIndex: 7, endIndex: 7, grammarCorrect: false },
  { word: "ທ້ດ", startIndex: 8, endIndex: 10, grammarCorrect: false },
  { word: "ເທດ", startIndex: 11, endIndex: 13, grammarCorrect: true },
  { word: "grammar", startIndex: 14, endIndex: 20, grammarCorrect: true },
  { word: "ລວ", startIndex: 21, endIndex: 22, grammarCorrect: false },
  { word: "!#$", startIndex: 23, endIndex: 25, grammarCorrect: true }
]
*/

ຄຸນສົມບັດ / Features

  • ກວດໄວຍະກອນຄຳພາສາລາວຕາມກົດເກນທາງພາສາ

  • ແຍກປະໂຫຍກພາສາລາວ ອອກເປັນແຕ່ລະຄຳ

  • ບົ່ງຊີ້ຄຳທີ່ມີໂຄງສ້າງໄວຍະກອນບໍ່ຖືກຕ້ອງ

  • ຮອງຮັບເນື້ອຫາທີ່ເປັນພາສາລາວປົນກັບອັກສອນອື່ນໆ

  • Checks Lao grammar according to linguistic rules

  • Splits Lao sentences into individual words

  • Identifies words with incorrect grammatical structure

  • Supports mixed Lao and non-Lao text

ວິທີການທຳງານ / How It Works

ຟັງຊັນນີ້ປະກອບດ້ວຍ 2 ຂັ້ນຕອນຫຼັກ:

  1. ການແຍກຄຳ: ໃຊ້ກົດເກນທາງດ້ານໂຄງສ້າງພະຍາງຄຳພາສາລາວເພື່ອກຳນົດຂອບເຂດຂອງຄຳ
  2. ການກວດໄວຍະກອນ: ກວດແຕ່ລະຄຳທີ່ແຍກອອກມາຕາມກົດເກນເຊັ່ນ:
    • ໂຄງສ້າງສະຫຼະ ແລະ ພະຍັນຊະນະ
    • ຕຳແໜ່ງຂອງສະຫຼະ ແລະ ວັນນະຍຸດ
    • ກົດເກນພິເສດສຳລັບຕົວອັກສອນຕ່າງໆ (່ ້ ໊ ໋ ໍ, ຯລຯ)
    • ຈຳນວນພະຍັນຊະນະທີ່ເໝາະສົມໃນຄຳດຽວ

This function operates in two main steps:

  1. Word Segmentation: Uses Lao syllable structure rules to determine word boundaries
  2. Grammar Checking: Analyzes each segmented word according to rules such as:
    • Vowel and consonant structure
    • Position of vowels and tone marks
    • Special rules for specific characters (່ ້ ໊ ໋ ໍ, etc.)
    • Appropriate number of consonants in a single word

ປະສິດທິພາບ / Performance

ອານຸພາບການຄຳນວນ (Time Complexity): O(n) ໝາຍຄວາມວ່າໄວຂອງຟັງຊັນຂຶ້ນຢູ່ກັບຄວາມຍາວຂອງປະໂຫຍກທີ່ປ້ອນເຂົ້າໄປ. ການແຍກປະໂຫຍກ ແລະ ການກວດໄວຍະກອນແມ່ນມີປະສິດທິພາບເນື່ອງຈາກການດຳເນີນງານສ່ວນໃຫຍ່ເກີດຂຶ້ນພຽງແຕ່ໃນຮອບດຽວເທົ່ານັ້ນ.

Time Complexity: O(n) where n is the length of the input sentence. This means the algorithm's performance scales linearly with the input size. The segmentation and grammar checking are efficient as they process the text primarily in single passes.

ລິຂະສິດ / License

MIT