1 (concord-assign-genre 'glyph-image "/usr/local/var/photo/db")
3 (concord-assign-genre 'hng-card "/usr/local/var/hng-card/db")
4 (mount-char-attribute-table '->HNG)
5 (mount-char-attribute-table '<-HNG)
7 (defun concord-kaisei-add-takuhon (source-id file-prefix taku-num
10 (let ((taku-file (format "%s%03d" file-prefix taku-num))
14 x y w h ucs seg-cobj char
15 seg-glyph-cobj seg-glyph-id
16 char-num-alist ret char-num ucs-hng-chars hng-code hng-cards)
18 (concord-images-add-url
20 "http://hng.chise.org/images/zinbun/takuhon/kaisei/%s.jpg"
23 "http://hng.chise.org/images/iiif/zinbun/takuhon/kaisei/%s.tif"
26 "http://hng.chise.org/iipsrv/iipsrv.fcgi?FIF=/zinbun/takuhon/kaisei/%s.tif&CVT=jpeg"
28 (setq base-id (concord-object-get base-cobj '=id))
30 base-cobj 'name (format "%s%d" source-name taku-num))
35 "http://coe21.zinbun.kyoto-u.ac.jp/db-machine/imgsrv/djvu/kaisei/%s.djvu"
39 (format "/opt/photo/zinbun/djvuchar/takuhonkaisei/%s.csv"
41 (goto-char (point-min))
43 (while (re-search-forward
44 "^\\([0-9]+\\),\\([0-9]+\\),\\([0-9]+\\),\\([0-9]+\\),\\([0-9]+\\)"
46 (setq x (string-to-int (match-string 1))
47 y (string-to-int (match-string 2))
48 w (string-to-int (match-string 3))
49 h (string-to-int (match-string 4))
50 ucs (string-to-int (match-string 5)))
51 (setq seg-cobj (concord-images-add-segments base-cobj x y w h))
52 (setq seg-glyph-id (intern (format "%s/char=%d" base-id glyph-num)))
53 (unless (setq seg-glyph-cobj
54 (concord-decode-object '=id seg-glyph-id))
56 (concord-make-object 'glyph-image seg-glyph-id))
57 (concord-object-adjoin*
58 seg-glyph-cobj '->image-resource seg-cobj)
59 (concord-object-adjoin*
60 seg-glyph-cobj '<-segmented-glyph-image base-cobj)
62 (setq char (decode-char '=ucs ucs))
63 (concord-object-put seg-glyph-cobj 'character (list char))
64 (cond ((setq ret (assq char char-num-alist))
65 (setq char-num (1+ (cdr ret)))
70 (setq char-num-alist (cons (cons char 0)
75 'name (format "%s%d-%d (%c-%d)"
76 source-short-name taku-num glyph-num char char-num))
80 (format "http://coe21.zinbun.kyoto-u.ac.jp/djvuchar?jpg=data/takuhonkaisei/%s&coords=%d,%d,%d,%d"
81 taku-file x y (+ x w) (+ y h)))
82 (setq ucs-hng-chars (append (char-feature char '->HNG)
83 (char-feature char '->HNG@zinbun/takuhon)))
85 (dolist (hng-char ucs-hng-chars)
86 (when (and (setq hng-code (encode-char hng-char ccs))
87 (setq ret (concord-decode-object
89 (intern (format "%d-%d"
93 (not (member ret hng-cards)))
94 (setq hng-cards (append hng-cards (list ret)))))
95 (concord-object-put seg-glyph-cobj
96 '<-glyph-image@zinbun/takuhon hng-cards)
97 (setq glyph-num (1+ glyph-num))
100 (defun concord-kaisei-fix-buffer (buffer)
101 (interactive "bBuffer ")
102 (goto-char (point-min))
104 (while (re-search-forward
105 ",38 35 120 \\(\\([0-9]+\\)\\( [0-9]+\\)+\\) 59$" nil t)
106 (setq beg (1+ (match-beginning 0))
108 (setq code (string-to-int
113 (string-to-number unit))))
114 (split-string (match-string 1) " ")
117 (delete-region beg end)
118 (insert (format "%d" code)))))