Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More โ†’
Socket
Sign inDemoInstall
Socket

hanja

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hanja

Hangul & Hanja library

  • 0.15.1
  • PyPI
  • Socket score

Maintainers
1

hanja: ํ•œ์ž-ํ•œ๊ธ€ ๋ณ€ํ™˜ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ

ํ•œ์ž-ํ•œ๊ธ€ ๋ณ€ํ™˜๊ธฐ__\ ์—์„œ ์‚ฌ์šฉ๋˜๋Š” ๋ชจ๋“ˆ์ž…๋‹ˆ๋‹ค.

__ http://hanja.suminb.com

Improve Hanja Library

์‚ฌ์šฉ ํ•˜์‹œ๋‹ค๊ฐ€ ๋น ์ง„ ํ•œ์ž ๋˜๋Š” ํ‹€๋ฆฐ ๋…์Œ์„ ๋ฐœ๊ฒฌํ•˜์‹œ๋ฉด ์ด ๋งํฌ <https://docs.google.com/forms/d/e/1FAIpQLScAtw6ylAhy1t0hMn5K25ZbN1vSNPlRdUtebS9PVtKeLQRfvw/viewform>_
๋ฅผ ํ†ตํ•ด ์ œ๋ณดํ•ด์ฃผ์„ธ์š”. ํ™•์ธ ํ›„ ๋ฐ˜์˜ํ•˜๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค. GitHub์„ ํ†ตํ•ด ์ง์ ‘ PR์„ ๋ณด๋‚ด์ฃผ์…”๋„ ์ข‹์Šต๋‹ˆ๋‹ค.

Installation

.. code-block:: console

pip install hanja

Usage

ํ•„์š”ํ•œ ๋ชจ๋“ˆ import ํ•˜๊ธฐ


.. code-block:: python

   >>> import hanja
   >>> from hanja import hangul

ํ•œ๊ธ€ ์ดˆ์„ฑ, ์ค‘์„ฑ, ์ข…์„ฑ ๋ถ„๋ฆฌ

.. code-block:: python

hangul.separate('๊ฐ€') (0, 0, 0) hangul.separate('๊นŒ') (1, 0, 0)

ํŠœํ”Œ(tuple)์˜ ๋งˆ์ง€๋ง‰ ์›์†Œ๊ฐ€ 0์ด๋ฉด ์ข…์„ฑ์ด ์—†๋Š” ๊ธ€์ž๋ผ๊ณ  ํŒ๋‹จํ•  ์ˆ˜ ์žˆ๋‹ค.

.. code-block:: python

hangul.separate('ํ•œ') (18, 0, 4)

'ใ…Ž'์€ 19๋ฒˆ์งธ ์ž์Œ, 'ใ…'๋Š” ์ฒซ๋ฒˆ์งธ ๋ชจ์Œ, 'ใ„ด'์€ ๋‹ค์„ฏ๋ฒˆ์งธ ์ž์Œ์ด๋ผ๋Š” ๊ฒƒ์„ ์•Œ ์ˆ˜ ์žˆ๋‹ค.

์ดˆ์„ฑ, ์ค‘์„ฑ, ์ข…์„ฑ์„ ์กฐํ•ฉํ•˜์—ฌ ํ•œ ๊ธ€์ž๋ฅผ ๋งŒ๋“ฆ


.. code-block:: python

   >>> hangul.build(0, 0, 0)
   '๊ฐ€'


์ฃผ์–ด์ง„ ๊ธ€์ž๊ฐ€ ํ•œ๊ธ€์ธ์ง€์˜ ์—ฌ๋ถ€๋ฅผ ํŒ๋ณ„
````````````````````````````````````

.. code-block:: python

   >>> hangul.is_hangul('๊ฐ€')
   True
   >>> hangul.is_hangul('a')
   False


ํ•œ๊ธ€๋กœ ๋œ ๋ถ€๋ถ„๊ณผ ํ•œ์ž๋กœ ๋œ ๋ถ€๋ถ„์„ ๋ถ„๋ฆฌ
``````````````````````````````````````

๋ฆฌ์ŠคํŠธ๊ฐ€ ์•„๋‹Œ ์ œ๋„ค๋ ˆ์ดํ„ฐ(generator)๋ฅผ ๋ฐ˜ํ™˜ํ•œ๋‹ค.

.. code-block:: python

   >>> '|'.join(hanja.split_hanja('ๅคง้Ÿ“ๆฐ‘ๅœ‹์€ ๆฐ‘ไธปๅ…ฑๅ’Œๅœ‹์ด๋‹ค.'))
   ๅคง้Ÿ“ๆฐ‘ๅœ‹|์€ |ๆฐ‘ไธปๅ…ฑๅ’Œๅœ‹|์ด๋‹ค.

   >>> [x for x in hanja.split_hanja('ๅคง้Ÿ“ๆฐ‘ๅœ‹์€ ๆฐ‘ไธปๅ…ฑๅ’Œๅœ‹์ด๋‹ค.')]
   ['ๅคง้Ÿ“ๆฐ‘ๅœ‹', '์€ ', 'ๆฐ‘ไธปๅ…ฑๅ’Œๅœ‹', '์ด๋‹ค.']

์ฃผ์–ด์ง„ ๊ธ€์ž๊ฐ€ ํ•œ์ž์ธ์ง€์˜ ์—ฌ๋ถ€๋ฅผ ํŒ๋ณ„
````````````````````````````````````

.. code-block:: python

   >>> hanja.is_hanja('้Ÿ“')
   True

   >>> hanja.is_hanja('ํ•œ')
   False

๋ฌธ์žฅ ๋ณ€ํ™˜
`````````

์น˜ํ™˜ ๋ชจ๋“œ ๋ณ€ํ™˜:

.. code-block:: python

   >>> hanja.translate('ๅคง้Ÿ“ๆฐ‘ๅœ‹์€ ๆฐ‘ไธปๅ…ฑๅ’Œๅœ‹์ด๋‹ค.', 'substitution')
   '๋Œ€ํ•œ๋ฏผ๊ตญ์€ ๋ฏผ์ฃผ๊ณตํ™”๊ตญ์ด๋‹ค.'

ํ˜ผ์šฉ ๋ชจ๋“œ ๋ณ€ํ™˜ (text):

.. code-block:: python

   >>> hanja.translate('ๅคง้Ÿ“ๆฐ‘ๅœ‹์€ ๆฐ‘ไธปๅ…ฑๅ’Œๅœ‹์ด๋‹ค.', 'combination-text')
   'ๅคง้Ÿ“ๆฐ‘ๅœ‹(๋Œ€ํ•œ๋ฏผ๊ตญ)์€ ๆฐ‘ไธปๅ…ฑๅ’Œๅœ‹(๋ฏผ์ฃผ๊ณตํ™”๊ตญ)์ด๋‹ค.'

ํ˜ผ์šฉ ๋ชจ๋“œ ๋ณ€ํ™˜ version 2 (text):

.. code-block:: python

   >>> hanja.translate('ๅคง้Ÿ“ๆฐ‘ๅœ‹์€ ๆฐ‘ไธปๅ…ฑๅ’Œๅœ‹์ด๋‹ค.', 'combination-text-reversed')
   '๋Œ€ํ•œ๋ฏผ๊ตญ(ๅคง้Ÿ“ๆฐ‘ๅœ‹)์€ ๋ฏผ์ฃผ๊ณตํ™”๊ตญ(ๆฐ‘ไธปๅ…ฑๅ’Œๅœ‹)์ด๋‹ค.'

ํ˜ผ์šฉ ๋ชจ๋“œ ๋ณ€ํ™˜ (HTML):

.. code-block:: python

   >>> hanja.translate(u'ๅคง้Ÿ“ๆฐ‘ๅœ‹์€ ๆฐ‘ไธปๅ…ฑๅ’Œๅœ‹์ด๋‹ค.', 'combination-html')
   '<span class="hanja">ๅคง้Ÿ“ๆฐ‘ๅœ‹</span><span class="hangul">(๋Œ€ํ•œ๋ฏผ๊ตญ)</span>์€ <span class="hanja">ๆฐ‘ไธปๅ…ฑๅ’Œๅœ‹</span><span class="hangul">(๋ฏผ์ฃผ๊ณตํ™”๊ตญ)</span>์ด๋‹ค.'

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with โšก๏ธ by Socket Inc