>>> from importlib import metadata
>>> metadata.packages_distributions()
{'pip': ['pip'], 'MeCab': ['mecab'], '_MeCab': ['mecab']}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| """MeCabのmatrix.binを読み込むスクリプト""" | |
| import mmap | |
| import struct | |
| import sys | |
| _HEADER = struct.Struct("<HH") # lsize, rsize | |
| _COST = struct.Struct("<h") # int16 | |
| _HEADER_SIZE = _HEADER.size |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| import unicodedata | |
| for unicode_id in xrange(65536): | |
| char = unichr(unicode_id) | |
| normalized_char = unicodedata.normalize('NFKC', char) | |
| if char != normalized_char: | |
| if len(normalized_char) == 1: | |
| print u'[%d] %s -> [%d] %s' % (unicode_id, char, ord(normalized_char), normalized_char) | |
| else: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mail_address = '' | |
| password = '' | |
| from selenium import webdriver | |
| UA = 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0' | |
| PHANTOMJS_ARG = {'phantomjs.page.settings.userAgent': UA} | |
| driver = webdriver.PhantomJS(desired_capabilities=PHANTOMJS_ARG) | |
| url = 'https://www.google.com/accounts/Login?hl=ja&continue=http://www.google.co.jp/' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "Airline": "Airline Industry Services", | |
| "American Restaurant": "New American Restaurant", | |
| "Amusement Park Ride": "Roller Coaster", | |
| "Amusement": "Arcade", | |
| "Amusement": "Bingo Hall", | |
| "Amusement": "Go Karting", | |
| "Amusement": "Laser Tag", | |
| "Antiques & Vintage": "Antique Store", | |
| "Antiques & Vintage": "Auction House", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| files: ^backend/.*$ | |
| repos: | |
| - repo: https://github.com/astral-sh/ruff-pre-commit | |
| # Ruff version. | |
| rev: v0.3.7 | |
| hooks: | |
| # Run the linter. | |
| - id: ruff | |
| types_or: [python, pyi, jupyter] | |
| args: [--fix] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| HTS_ENGINE_VERSION=1.10 | |
| HTS_VOICE_VERSION=1.05 | |
| OPENJTALK_VERSION=1.10 | |
| pushd . | |
| cd /tmp | |
| wget http://downloads.sourceforge.net/hts-engine/hts_engine_API-${HTS_ENGINE_VERSION}.tar.gz | |
| tar xzf hts_engine_API-${HTS_ENGINE_VERSION}.tar.gz | |
| cd hts_engine_API-${HTS_ENGINE_VERSION} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import time | |
| import urllib.request | |
| import zipfile | |
| import pandas as pd | |
| from pandarallel import pandarallel | |
| URL = "https://www.post.japanpost.jp/zipcode/dl/utf/zip/utf_ken_all.zip" | |
| ZIP_FILE_NAME = URL.split("/")[-1] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # coding:utf-8 | |
| import re | |
| import socket | |
| import subprocess | |
| import time | |
| HOST = "127.0.0.1" | |
| PORT = 10500 | |
| JULIUS_DIR = 'C:\Program Files (x86)\julius-4.4.2-win32bin\\' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def weighted_levenshtein(a, b, insert=1, delete=1, substitute=1): | |
| len_a = len(a) | |
| len_b = len(b) | |
| m = [ [0] * (len_b + 1) for i in xrange(len_a + 1) ] | |
| for i in xrange(len_a + 1): | |
| m[i][0] = i * delete | |
| for j in xrange(len_b + 1): | |
| m[0][j] = j * insert |
NewerOlder