• R/O
  • SSH
  • HTTPS

igo: 提交


Commit MetaInfo

修订版100 (tree)
时间2010-05-11 20:44:32
作者phjgt

Log Message

マッチ部分の文字列取り出し方法を変更

更改概述

差异

--- trunk/cl-igo/tagger.lisp (revision 99)
+++ trunk/cl-igo/tagger.lisp (revision 100)
@@ -61,19 +61,16 @@
6161
6262 (vn:prev (set-mincost-node (vn:make-bos/eos) (aref nodes len) mtx wdc))))
6363
64-(defmacro parse-then-map-result ((viterbi-node text start end tagger) &body body)
64+(defmacro parse-then-map-result ((viterbi-node charseq tagger) &body body)
6565 (let ((result (gensym))
66- (charseq (gensym))
6766 (code-stream (gensym)))
68- `(charseq:with-dynamic-extent (,charseq ,text :start ,start :end ,end)
69- (declare #.*optimize-fastest*)
70- (let ((,result '())
71- (,code-stream (code-stream:make ,charseq)))
72- (declare (dynamic-extent ,code-stream))
73- (do ((,viterbi-node (parse-impl ,tagger ,code-stream (charseq:length ,charseq))
74- (vn:prev ,viterbi-node)))
75- ((null (vn:prev ,viterbi-node)) ,result)
76- (push (progn ,@body) ,result))))))
67+ `(let ((,result '())
68+ (,code-stream (code-stream:make ,charseq)))
69+ (declare (dynamic-extent ,code-stream))
70+ (do ((,viterbi-node (parse-impl ,tagger ,code-stream (charseq:length ,charseq))
71+ (vn:prev ,viterbi-node)))
72+ ((null (vn:prev ,viterbi-node)) ,result)
73+ (push (progn ,@body) ,result)))))
7774
7875 ;;;;;;;;;;;;;;;;;;;;;
7976 ;;; external function
@@ -92,10 +89,12 @@
9289 (string text)
9390 (tagger tagger)
9491 (charseq:index start end))
95- (parse-then-map-result (vn text start end tagger)
96- (list (subseq text (+ start (vn:start vn)) (+ start (vn:end vn)))
97- (dic:word-data (vn:word-id vn) wdc)
98- (vn:start vn))))
92+ (charseq:with-dynamic-extent (charseq text :start start :end end)
93+ (declare #.*optimize-fastest*)
94+ (parse-then-map-result (vn charseq tagger)
95+ (list (charseq:to-string charseq (vn:start vn) (vn:end vn))
96+ (dic:word-data (vn:word-id vn) wdc)
97+ (vn:start vn)))))
9998
10099 (defun wakati (text &key (tagger *tagger*) (start 0) (end (length text)))
101100 (declare (optimize (speed 3) (debug 1) (safety 1))
@@ -102,5 +101,7 @@
102101 (string text)
103102 (tagger tagger)
104103 (charseq:index start end))
105- (parse-then-map-result (vn text start end tagger)
106- (subseq text (+ start (vn:start vn)) (+ start (vn:end vn)))))
\ No newline at end of file
104+ (charseq:with-dynamic-extent (charseq text :start start :end end)
105+ (declare #.*optimize-fastest*)
106+ (parse-then-map-result (vn charseq tagger)
107+ (charseq:to-string charseq (vn:start vn) (vn:end vn)))))
Show on old repository browser