ãã¼ãåãã²ãããªã«å¤æããé¢æ°
30åããã°ã©ã ããã®512ããã¼ãåãã²ãããªã«å¤æããé¢æ°ãæ¸ãã¦ã¿ãã
ä»æ¥ãb:id:banjunã¨"John"ã"æ
é³"ã«å¤æã§ãããããããããããã?ã¿ããªè©±ããã¦ãã®ã§ãã¨ãããããã¼ãåãã²ãããªã«å¤æããé¢æ°ãä½ã£ã¦ã¿ããSchemeã§ã
æ¬æ°ã§ãããã ã£ãããSKKã®è¾æ¸ã¨ããæµç¨ããã»ããããæ°ããããã©ããã¨ãå
¨é¨ã«å¯¾å¿ããã®ã¯å¤§å¤ã ã£ãã®ã§ããè¡ã¨ãè¡ããå¤æã§ããªãã
使ãæ¹
gosh> (romaji->hiragana "aka") ("ã" "ã")
ã½ã¼ã¹ã³ã¼ã
#! /opt/local/bin/gosh ;; -*- mode:scheme; coding:utf-8 -*- ;; ;; romaji.scm - ;; ;; Copyright(C) 2009 by mzp ;; Author: MIZUNO Hiroki / mzpppp at gmail dot com ;; http://howdyworld.org ;; ;; Timestamp: 2009/01/21 22:34:58 ;; ;; This program is free software; you can redistribute it and/or ;; modify it under MIT Lincence. ;; (define *table* '((a . ã) (i . ã) (u . ã) (e . ã) (o . ã) (ka . ã) (ki . ã) (ku . ã) (ke . ã) (ko . ã))) ;;; setup table (define *hash* (make-hash-table 'string=?)) (for-each (lambda (x) (hash-table-put! *hash* (symbol->string (car x)) (symbol->string (cdr x)))) *table*) (define *regexp* (string->regexp (string-append "^(?:" (string-join (sort (hash-table-keys *hash*) (lambda (x y) (> (string-length x) (string-length y)))) "|") ")"))) (define (romaji->hiragana romaji) (let1 match (*regexp* romaji) (if match (cons (hash-table-get *hash* (rxmatch-substring match)) (romaji->hiragana (rxmatch-after match))) '())))