GithubHelp home page GithubHelp logo

ununiga's Introduction

Build Status Gem Version

ununiga[은는이가]

은는이가는 한글의 자소를 분리하고 적절한 조사를 찾아주는 역할을 합니다.
I18n의 Backend 모듈도 제공합니다.

Installation

gem install ununiga

조사 찾기

require 'ununiga'

Ununiga::JosaPicker.takewell("레일즈와(과) 쟝고은(는) 싸우지 않습니다.")
# => "레일즈와 쟝고는 싸우지 않습니다."
Ununiga::JosaPicker.takewell("페이스북(으)로 로그인합니다.")
# => "페이스북으로 로그인합니다."

picker = Ununiga::JosaPicker.new("레일즈은(는) 루비을(를) 사용합니다.")
picker.takewell
# => "레일즈는 루비를 사용합니다.

picker.josas
# => [[3, ["은", "는"]], [10, ["을", "를"]]]

I18n에 적용하기

  1. Gemfile에 ununiga를 추가합니다.
gem 'ununiga'
  1. Initializer나 environment config파일에 아래 코드를 추가합니다.
I18n::Backend::Simple.send(:include, Ununiga::I18n::JosaTransformer)
  1. 한글 locale yml 파일에 조사를 사용하는 부분을 찾아 '은(는)|(는)은|을(를)...'등으로 조사를 변경합니다.
links:
  sign_in_with_provider: "%{provider}(으)로 로그인"

# Rails의 ActiveModel/ActiveRecord의 Validation을 사용할 경우
errors:
  # 디폴트는 `%{attribute} %{message}`형식으로 띄워쓰기가 되어 있으므로 format을 붙여쓰기로 변경해줍니다.
  foramt: "%{attribute}%{message}"
  messages:
    accepted: 을(를) 반드시 확인해야 합니다.
    equal_to: 은(는) %{count}와(과) 같아야 합니다

자소 분리하기

splitter = Ununiga::JasoSplitter.new('흯')
splitter.chosung       # => 'ㅎ'
splitter.jungsung      # => 'ㅢ'
splitter.jongsung      # => 'ㄳ'
splitter.split         # => ['ㅎ', 'ㅢ', 'ㄳ']

Test

두가지 방식으로 테스트 할 수 있습니다.

  • rake test 혹은 그냥 rake 커맨드를 사용합니다.
  • 특정 파일을 테스트할 경우 ruby -Ilib:test /test/{file_name} 을 사용합니다.

ununiga's People

Contributors

keepcosmos avatar

Watchers

 avatar  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.