Fix jmdict generation
modules/nani/jmdict/xml.scm
69 | 69 | ((? source? s) (update-sense sense #:sources (cons s (sense-sources sense)))) | |
70 | 70 | (('tag (? integer? r)) (update-sense sense #:tags (cons r (sense-tags sense)))) | |
71 | 71 | (('gloss (? string? r)) (update-sense sense #:glosses (cons r (sense-glosses sense)))) | |
72 | - | (('lang (? string? l)) (update-sense sense #:language l)) | |
72 | + | ((('xml . 'lang) (? string? l)) (update-sense sense #:language l)) | |
73 | 73 | (((? symbol? s) v) (throw 'unknown-content s v)) | |
74 | 74 | ((? list? l) (loop sense l)) | |
75 | 75 | ((? string? _) sense)) | |
… | |||
95 | 95 | (car (result-kanjis result)))) | |
96 | 96 | (entity (frequency-entity frq word)) | |
97 | 97 | (sense1 (car (result-senses result))) | |
98 | - | (sense1 (update-sense sense1 #:tags (cons entity (sense-tags sense1)))) | |
98 | + | (sense1 (if entity | |
99 | + | (update-sense sense1 | |
100 | + | #:tags (cons (get-tag entity) (sense-tags sense1))) | |
101 | + | sense1)) | |
99 | 102 | (senses (cons sense1 (cdr (result-senses result))))) | |
100 | 103 | (update-result result | |
101 | 104 | #:points (get-points (update-result result #:senses senses)) | |
… | |||
117 | 120 | ('keb (if (and (= (length lst) 1) (string? (car lst))) | |
118 | 121 | `(kanji ,(car lst)) | |
119 | 122 | (throw 'invalid-keb lst))) | |
120 | - | ('s_inf (if (and (= (length lst) 1) (string? (car lst))) | |
121 | - | `(info ,(car lst)) | |
123 | + | ('s_inf (if (null? (filter (lambda (s) (not (string? s))) lst)) | |
124 | + | `(info ,(apply string-append lst)) | |
122 | 125 | (throw 'invalid-s_inf lst))) | |
123 | 126 | ('dial (if (and (= (length lst) 1) (string? (car lst))) | |
124 | 127 | `(tag ,(get-tag (car lst))) | |
… | |||
138 | 141 | ('ant (if (and (= (length lst) 1) (string? (car lst))) | |
139 | 142 | `(ref ,(car lst)) | |
140 | 143 | (throw 'invalid-ant lst))) | |
141 | - | ('reb `(reading ,lst)) | |
144 | + | ('reb (if (and (= (length lst) 1) (string? (car lst))) | |
145 | + | `(reading ,(car lst)) | |
146 | + | (throw 'invalid-reb lst))) | |
142 | 147 | ('r_ele (sxml->reading lst)) | |
143 | 148 | ('k_ele (car (filter list? lst))) | |
144 | 149 | ('pos (if (and (= (length lst) 1) (string? (car lst))) | |
… | |||
147 | 152 | ('xref (if (and (= (length lst) 1) (string? (car lst))) | |
148 | 153 | `(ref ,(car lst)) | |
149 | 154 | (throw 'invalid-xref lst))) | |
150 | - | ('gloss (append | |
151 | - | (filter list? lst) | |
152 | - | (map (lambda (v) `(gloss ,v)) (filter string? lst)))) | |
155 | + | ('gloss (cons | |
156 | + | `(gloss ,(apply string-append (filter string? lst))) | |
157 | + | (filter list? lst))) | |
153 | 158 | ('lsource (sxml->source lst)) | |
154 | 159 | ('sense (sxml->sense lst)) | |
155 | 160 | ('entry (sxml->result lst frq)))) |