[Python] A convenient library that converts kanji to hiragana

You can easily convert kanji, hiragana, and katakana by using pykakasi.

You can install the library by entering the following command at the command prompt.

pip install pykakasi

Example of use

test.py



from pykakasi import kakasi

kakasi = kakasi()
kakasi.setMode('J', 'H') #Convert from kanji to hiragana
kakasi.setMode("K", "H") #Convert from katakana to hiragana
conv = kakasi.getConverter()

str = 'Tokyo Tower'

print(conv.do(str))

Execution result

python test.py
Tokyo Tower

You can convert it like this, so if you have a chance, please use it.

Recommended Posts

[Python] A convenient library that converts kanji to hiragana
A python script that converts Oracle Database data to csv
I made a library that adds docstring to a Python stub file.
I made a web application in Python that converts Markdown to HTML
How to use hmmlearn, a Python library that realizes hidden Markov models
I tried using the Python library "pykakasi" that can convert kanji to romaji.
[Python] How to write a docstring that conforms to PEP8
I made a python library to do rolling rank
Publish / upload a library created in Python to PyPI
A Python program that converts ical data into text
A road to intermediate Python
Published a library that hides character data in Python images
A Python script that saves a clipboard (GTK) image to a file.
Developed a library to get Kindle collection list in Python
How to write a metaclass that supports both python2 and python3
[Python] A story that seemed to fall into a rounding trap
Use pymol as a python library
How to write a Python class
I made a library to easily read config files with Python
I want to use a wildcard that I want to shell with Python remove
Introduction to Python Numerical Library NumPy
Use networkx, a library that handles graphs in python (Part 2: Tutorial)
A story that struggled to handle the Python package of PocketSphinx
How to use Requests (Python Library)
I created a Python library to call the LINE WORKS API
Created a library for python that can easily handle morpheme division
[Python] A memo that I tried to get started with asyncio
About psd-tools, a library that can process psd files in Python
Python library "Jusho" that converts postal code ⇔ address all over Japan
[Python] How to import the library
[For beginners] How to register a library created in Python in PyPI
A special Python codec that seems to know but does not know
A script that returns 0, 1 attached to the first Python prime number
A quick guide to PyFlink that combines Apache Flink and Python
5 Ways to Create a Python Chatbot
Generate a Python library download badge
[python] A note that started to understand the behavior of matplotlib.pyplot
A note about mock (Python mock library)
[Python] A program that rotates the contents of the list to the left
Introduction of "scikit-mobility", a library that allows you to easily analyze human flow data with Python (Part 1)
Introducing a library that was not included in pip on Python / Windows
[Python] I made a decorator that doesn't seem to have any use.
[Python] A program that calculates the number of socks to be paired
A memo that allows you to change Pineapple's Python environment with pyenv
Try using APSW, a Python library that SQLite can get serious about
I tried to develop a Formatter that outputs Python logs in JSON
Created Simple SQLite, a Python library that simplifies SQLite table creation / data insertion
I made a library konoha that switches the tokenizer to a nice feeling
What is a C language library? What is the information that is open to the public?
[Python] It was very convenient to use a Python class for a ROS program.
Code reading of faker, a library that generates test data in Python
It is convenient to use Layers when putting a library on Lambda
[Python] A program that creates stairs with #
[Python] Use pandas to extract △△ that maximizes ○○
[Python] How to make a class iterable
[Python] How to convert a 2D list to a 1D list
A super introduction to Python bit operations
Convert Hiragana to Romaji with Python (Beta)
I want to build a Python environment
[Python] How to invert a character string
How to get a stacktrace in python