Convert kanji to kana

Use mecab to convert to kana and connect the results to output as one character string

import MeCab

def mecab_list(text):
    tagger = MeCab.Tagger("-Ochasen")
    tagger.parse('')
    node = tagger.parseToNode(text)
    word_class = []
    while node:
        word = node.surface
        wclass = node.feature.split(',')
        if wclass[0] != u'BOS/EOS':
            if wclass[6] == None:
                word_class.append((wclass[7]))
            else:
                word_class.append((wclass[7]))
        node = node.next
    mojiretsu=''.join(word_class) 
    return mojiretsu

reference

Kanji → Katakana → Hiragana → Kanji conversion with Python, Mecab, GoogleTranslitrate API. Module to list MeCab output in Python (mecab-python)

Recommended Posts

Convert kanji to kana
Convert to HSV
Convert from katakana to vowel kana [python]
Convert jupyter to py
Convert keras-yolo3 to onnx
Convert dict to array
Convert json to excel
[python] Convert date to string
Convert numpy int64 to python int
[Python] Convert list to Pandas [Pandas]
Convert Scratch project to Python
[Python] Convert Shift_JIS to UTF-8
Convert IP address to decimal
Convert SDF to CSV quickly
Convert genbank file to gff file
Convert python 3.x code to python 2.x
Convert Tweepy Status object to JSON
Convert .ipynb to .html (with BatchFile)
Function to convert Excel column to number
Convert PDF to Documents by OCR
Convert markdown to PDF in Python
Convert A4 PDF to A3 every 2 pages
Convert wma to mp3 on Mac
Convert some Japanese names to antonyms
convert ggplot based graph to html
Workflow to convert formula (image) to python
Convert list to DataFrame with python
Convert sentences to vectors with gensim
How to convert 0.5 to 1056964608 in one shot
Python> list> Convert double list to single list
Convert from pdf to txt 2 [pyocr]
How to convert Tensorflow model to Lite
Convert a string to an image
[Python] Convert natural numbers to ordinal numbers
Convert decimal numbers to n-ary numbers [python]
Program to convert Japanese to station name
How to convert from .mgz to .nii.gz
Convert PDF to image with ImageMagick
A tool to convert Juniper config
Python> tuple> Convert double tuple to single tuple
[Python] How to convert db file to csv
Convert xml format data to txt format data (yolov3)
How to easily convert format from Markdown
Convert Python> two value sequence to dictionary
[Django] Convert QuerySet to dictionary type list
[Python] How to convert a 2D list to a 1D list
How to convert Python to an exe file
[Python] Convert csv file delimiters to tab delimiters
Convert from PDF to CSV with pdfplumber
Convert GFF3 to MSS for DDBJ submission
Convert (compress) formatted JSON string to 1-line JSON
Convert psd file to png in Python
Convert MetaImageIO (* .mha, * .mhd) to tiff stack
Convert character strings to features with RoBERTa
Convert Excel data to JSON with python
[MNIST] Convert data to PNG for keras
Convert Hiragana to Romaji with Python (Beta)
Use pandas to convert grid data to row-holding (?) Data
Convert FX 1-minute data to 5-minute data with Python
python> Convert tuple to list> aList = list (pi_tuple)
Convert PDF attached to email to text format