Giter Club home page Giter Club logo

php-korean-handler's Introduction

PHP-Korean-Handler

한글 자모 분리 라이브러리 (초성, 중성, 종성)

Installation

install using composer:

 composer require acidf0x/php-korean-handler

Usage

조회시 반환 값은 U+3130U+318F 사이의 Hangul Compatibility Jamo가 반환 됩니다.

use AcidF0x\KoreanHandler\Seperator; 

$separator = new Seperator();

$result = $separator->separate("수상하게 돈이 많은");
print_r($result->getSplitList()); // ["ㅅ","ㅜ","ㅅ","ㅏ","ㅇ","ㅎ","ㅏ","ㄱ","ㅔ","ㄷ","ㅗ","ㄴ","ㅇ","ㅣ","ㅁ","ㅏ","ㄶ","ㅇ","ㅡ","ㄴ"]
print_r($result->getChoseongList()); // ["ㅅ", "ㅅ", "ㅎ", "ㄱ", "ㄷ", "ㅇ", "ㅁ", "ㅇ"]
print_r($result->getJungseongList()); // ["ㅜ", "ㅏ", "ㅏ", "ㅔ", "ㅗ", "ㅣ", "ㅏ", "ㅡ"]
print_r($result->getJongseongList()); // ["ㅇ","ㄴ","ㄶ","ㄴ"]

separate 메서드의 리턴 값은 ArrayAccess, Iterator 인터페이스를 구현하였으므로 각 결과에 대해 Array처럼 접근 하여 사용이 가능합니다

$result = $this->separator->separate("황소");

$result[0]->getChoseong(); // ㅎ
$result[0]->getJungseong(); // ㅘ
$result[0]->getJongseong(); // ㅇ
$result[1]->getChoseong(); // ㅅ
$result[1]->getJungseong(); // ㅗ
$result[1]->getJongseong(); // null

$result[0]->getSplit(); // ["ㅎ", "ㅘ", "ㅇ"]


foreach ($result as $character) {
    $character->getChoseong();
}

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.