Skip to content

Instantly share code, notes, and snippets.

View knok's full-sized avatar

NOKUBI Takatsugu knok

View GitHub Profile
@knok
knok / pos_map.h
Last active June 10, 2020 09:57
mozc pos_map.h on 0.12.410.102
// Copyright 2009 Google Inc. All Rights Reserved.
// Author: keni
#ifndef MOZC_DICTIONARY_POS_MAP_H_
#define MOZC_DICTIONARY_POS_MAP_H_
// POS conversion rules
const POSMap kPOSMap[] = {
{ "\x31", "\xE5\x90\x8D\xE8\xA9\x9E" },
{ "\x31\x30", "\xE5\x90\x8D\xE8\xA9\x9E\xE3\x82\xB5\xE5\xA4\x89" },
@knok
knok / makefile.diff
Created June 10, 2020 05:33
mozc-config linux build
diff --git a/Makefile b/Makefile
index c8b7257..01950be 100644
--- a/Makefile
+++ b/Makefile
@@ -8,15 +8,15 @@ CXX = g++
RM = rm -f
INSTALL = /usr/bin/install
-MOZC_SRC = ..
+MOZC_SRC = ../mozc-2.23.2815.102+dfsg/src
@knok
knok / gist:4e43a23895508fe91bc33ebee8e5f646
Created February 3, 2020 06:13
make Japanese WordNet synonym list
import sqlite3
import os
import sys
fname = "wnjpn.db" # get from http://compling.hss.ntu.edu.sg/wnja/jpn/detail.html
conn = sqlite3.connect(fname)
def id2word(wordid):
w = conn.execute("select * from word where wordid = %s" % wordid)
@knok
knok / parse_cirrus_sudachi.py
Created January 29, 2020 07:38
Parse cirrus jawiki content with sudachi via pipe
# refer to https://github.com/yagays/pretrained_doc2vec_ja/blob/master/src/parse_cirrus.py
#
import json
import gzip
import bz2
import subprocess
from tqdm import tqdm
p = subprocess.Popen(["java", "-jar", "sudachi-0.3.2.jar", "-s",
@knok
knok / gist:c8d9b3909ca6dd83a94359c8e49be062
Created January 29, 2020 06:34
SudachiDict on mecab
/usr/lib/mecab/mecab-dict-index -d . -o . -f utf8 -t utf8
reading ./unk.def ... 35
emitting double-array: 100% |###########################################|
./model.def is not found. skipped.
reading ./lex.csv ... context_id.cpp(96) [it != left_.end()] cannot find LEFT-ID for 100,名詞,数詞,*,*,*,*,*,*
Makefile:613: recipe for target 'char.bin' failed
make: *** [char.bin] Error 255
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>不正アクセスとは?被害事例、被害有無のチェック方法と有効な対策</title
>
<style>
.container {
width: 60%;
margin: 10% auto 0;
@knok
knok / sg-onnx.py
Created August 1, 2019 07:56
Chainer StyleGAN onnx export
import os
import sys
import re
import json
import numpy as np
from PIL import Image
import chainer
import chainer.cuda
@knok
knok / file0.txt
Last active December 12, 2017 23:48
フレンズ画像を生成させてみたい-画像収集編+DCGAN ref: https://qiita.com/knok/items/3f3c1d3eef4b435ed37e
# -*- coding: utf-8 -*-
from bs4 import BeautifulSoup
import urllib.request
import urllib.parse
import time
import os
wait_sec = 5
@knok
knok / file0.txt
Last active July 4, 2017 03:59
猫画像から猫部分のみを抽出する(matting/semantig segmentation) ref: http://qiita.com/knok/items/6ad09cc870739dbd921b
$ pip install -r requirements.txt
$ curl -L https://github.com/nicolov/segmentation_keras/releases/download/model/nicolov_segmentation_model.tar.gz \
| tar xvf -
$ python predict.py --weights_path \
conversion/converted/dilation8_pascal_voc.npy \
images/cat.jpg
@knok
knok / file0.py
Last active April 4, 2019 07:10
ChainerCVを用いて猫画像を分類する ref: https://qiita.com/knok/items/8b1919e2a8b71d9134c9
#!/usr/nogpu/bin/python
# -*- coding: utf-8 -*-
import argparse
import chainer
from chainercv.datasets import voc_detection_label_names
from chainercv.links import SSD300
from chainercv import utils
import os