Created
June 3, 2010 04:29
-
-
Save miyamuko/423460 to your computer and use it in GitHub Desktop.
This file contains 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
;; monday.l で日本語の置換に適当に対応してみた。以下も必要。 | |
;; | |
;; - http://gist.github.com/423444 | |
;; - http://gist.github.com/423449 | |
;; | |
;; == 設定 == | |
;; | |
;; (defvar *monday-weekj-alist* | |
;; '(("月曜" . "火曜") | |
;; ("火曜" . "水曜") | |
;; ("水曜" . "木曜") | |
;; ("木曜" . "金曜") | |
;; ("金曜" . "土曜") | |
;; ("土曜" . "日曜") | |
;; ("日曜" . "月曜") | |
;; ("月曜日" . "火曜日") | |
;; ("火曜日" . "水曜日") | |
;; ("水曜日" . "木曜日") | |
;; ("木曜日" . "金曜日") | |
;; ("金曜日" . "土曜日") | |
;; ("土曜日" . "日曜日") | |
;; ("日曜日" . "月曜日") | |
;; )) | |
;; | |
;; (pushnew *monday-weekj-alist* ed::*monday-alist-list* :test #'equalp) | |
;; | |
;; == 問題 == | |
;; | |
;; tiny-segmenter の分割がいまいち。 | |
;; | |
;; (tiny-segmenter:segment "今日は日曜日です。") => ("今日" "は" "日曜日" "です" "。") | |
;; (tiny-segmenter:segment "今日は月曜日です。") => ("今日" "は" "月曜" "日" "です" "。") | |
;; | |
--- monday.l.orig Thu Jun 3 11:04:16 2010 | |
+++ monday.l Thu Jun 3 13:25:43 2010 | |
@@ -222,7 +222,7 @@ | |
((numberp (string-match *monday-string-regexp* str)) | |
(values nil (monday-get-current-word *monday-string-regexp*))) | |
(t | |
- ))) | |
+ (values nil str)))) | |
(cond | |
((or (looking-at-backward *monday-number-regexp*) | |
(looking-at *monday-number-regexp*)) | |
@@ -231,7 +231,7 @@ | |
(looking-at *monday-string-regexp*)) | |
(values nil (monday-get-current-word *monday-string-regexp*))) | |
(t | |
- )))) | |
+ (values nil (monday-get-current-segment :before nil)))))) | |
(defun monday-get-current-word (regexp) | |
(let (word) | |
@@ -253,6 +253,16 @@ | |
(buffer-substring (match-beginning 0) (match-end 0)) | |
(goto-char (match-beginning 0))) | |
)) | |
+ | |
+(defun monday-get-current-segment (&key before) | |
+ (when (modulep "tiny-segmenter") | |
+ (multiple-value-bind (segment begin end) | |
+ (user::segment-at (point) :before before) | |
+ (message "Current Segment: ~S" segment) | |
+ (goto-char begin) | |
+ (set-mark) | |
+ (goto-char end) | |
+ segment))) | |
;;; utilities | |
(defmacro atoi (str) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment