Skip to content

Instantly share code, notes, and snippets.

View Madoshakalaka's full-sized avatar
😋

Siyuan Yan Madoshakalaka

😋
  • Cardiff University
  • Cardiff, Unitied Kingdom
View GitHub Profile
#![feature(cell_update)]
#[cfg(test)]
mod test {
use crate::*;
use std::cell::Cell;
#[test]
fn test() {
test_counter::<0>();
@iddan
iddan / sync_pipfile_setup.py
Last active August 25, 2019 14:41
Sync Pipfile and setup.py
# Sync Pipfile with setup.py dependencies
# Assumptions:
# - You are running in a directory with Pipfile, Pipfile.lock & setup.py
# - Your setup.py calls a function named setup()
# - setup() is called with keyword arguments of install_requires and dependency_links (can be empty lists)
# - All your remote dependencies are HTTPS git
import pipfile
import ast
import json
@fasiha
fasiha / README.md
Last active March 31, 2024 17:49
Hiragana frequency in readings of sentences in Tono, et al., *A Frequency Dictionary of Japanese* (2013; Core5000 Anki deck)

Overview Nayr's Japanese Core5000 Anki deck (discussion) contains pronunciations of all five thousand or so sentences in A Frequency Dictionary of Japanese by Yukio Tono, Makoto Yamazaki, and Kikuo Maekawa (2013), which contains the top five thousand words in Japanese according to the latest corpus research. I analyzed these sentences to make a histogram table of hiragana occurrences, including dipthongs like きゃ, ちょ, etc. The attached two tables show the results in modern hiragana order, and sorted order.

Technical notes I parsed a file containing those sentences (with annotated readings in hiragana, in core5k-sentences.md) using the following script and helper file (in kana.txt):

cp core5k-sentences.md sacrifice.md; 
sed '/^$/d' kana.txt | while read i; do 
  echo -n $i " : " ;
  sed -n "s/$i/$i\n/gp" 
import bisect
class NFA(object):
EPSILON = object()
ANY = object()
def __init__(self, start_state):
self.transitions = {}
self.final_states = set()
self._start_state = start_state