hangulx
Version:
Providing various utilities for Hangul
64 lines (63 loc) • 3.23 kB
TypeScript
import { ISyllable } from "./interfaces";
export declare class Syllable {
static isChoFromCharCode(charCode: number): boolean;
static isCho(char: string): boolean;
static isChoAll(str: string): boolean;
static hasCho(str: string): boolean;
static isJungFromCharCode(charCode: number): boolean;
static isJung(char: string): boolean;
static isJungAll(str: string): boolean;
static hasJung(str: string): boolean;
static isJongFromCharCode(charCode: number): boolean;
static isJong(char: string): boolean;
static isJongAll(str: string): boolean;
static hasJong(str: string): boolean;
static disassembleFromCharCode(charCode: number | null | undefined): ISyllable | null;
/**
* 단일 문자열(길이가 1인)을 음절(초성, 중성, 종성)으로 분리합니다.
*
* Similar to the `disassemble` function but specifically for disassembling a single character into its syllable components.
*
* @param char 음절로 분리할 단일 문자 (길이가 1인 문자열)
* @param char A single character (string of length 1) to be disassembled into its syllable components
* @param option 분리 옵션 (선택 사항)
* @param option Optional disassembly options for specific customization
* @returns 분리된 음절(ISyllable) 객체를 반환, 옵션에 따라 null을 반환할 수도 있음
* @returns An ISyllable object representing the disassembled components or null based on the provided options
*/
static disassembleFromChar(char: string | null | undefined): ISyllable | null;
/**
* 완성형 한글을 음절(초성, 중성, 종성)으로 분리합니다.
*
* Disassembles complete Hangul characters into their component syllables (initial, medial, and final sounds).
*
* @param str 음절로 분리할 문자열 또는 문자열 배열
* @param str A string or an array of strings to be disassembled into syllables
* @returns 문자열의 경우 음절 배열, 문자열 배열의 경우 음절 2차 배열 반환
* @returns An array of ISyllable objects for a single string, or a 2D array of ISyllable objects for an array of strings
*/
static disassemble(str: string): ISyllable[];
static disassemble(str: string[]): ISyllable[][];
private static _assemble;
/**
* 한글의 초성, 중성, 종성을 완성형 한글로 조합하는 함수입니다.
*
* Assembles initial, medial, and final Korean jamo into complete Hangul syllables.
*
* @param syllable 단일 음절을 나타내는 ISyllable 객체
* @param syllable An ISyllable object representing a single syllable
* @param syllables 여러 음절을 나타내는 ISyllable 객체 배열
* @param syllables An array of ISyllable objects representing multiple syllables
* @returns 조합된 문자열을 반환합니다
* @returns A string formed by assembling the given syllable or array of syllables
*/
static assemble(syllable: ISyllable): string;
static assemble(syllables: ISyllable[]): string;
}
export declare namespace Syllable {
enum Position {
INITIAL = 0,
MIDDLE = 1,
FINAL = 2
}
}