Giter Club home page Giter Club logo

is-khmer's Introduction

Khmer utility functions

tests

Installation

# pnpm
pnpm add is-khmer

# npm
npm add is-khmer

# yarn
yarn add is-khmer

Browser

import { 
	isKhmer, 
	containsKhmer, 
	parseKhmer 
} from "https://unpkg.com/is-khmer"

API

isKhmer(text: string) => boolean

Check if a string is in Khmer language

import { isKhmer } from "is-khmer";

isKhmer("កូនខ្មែរ");
// => true

isKhmer("Cambodia");
// => false

containsKhmer(text: string) => boolean

Check if a string contains Khmer language

import { containsKhmer } from "is-khmer";

containsKhmer("Proud to be ខ្មែរ");
// => true

containsKhmer("Proud to be Cambodian");
// => false

parseKhmer(text: string) => KhmerMatchResult[]

Extract Khmer text from a string.

import { parseKhmer, KhmerMatchResult  } from "is-khmer";

const result = parseKhmer("ដោយយល់ឃើញថា ការមិនទទួលស្គាល់");

// =>
[
	{ start: 0, end: 11, value: "ដោយយល់ឃើញថា" },
	{ start: 12, end: 28, value: "ការមិនទទួលស្គាល់" },
];

License

Apache 2.0

is-khmer's People

Contributors

seanghay avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.