Do not build .sxml intermediate files anymore

Julien LepillerWed Jun 03 20:48:11+0200 2020

1f34f33

Do not build .sxml intermediate files anymore

Makefile

5050
	head -n20000 $@.tmp > $@
5151
	rm $@.tmp
5252
53-
dictionaries/%.sxml: dictionaries/%.xml tools/jmdict.scm
54-
	guile -L modules tools/jmdict.scm convert $< nolang $@
55-
5653
dicos/JMdict_%.nani: dictionaries/JMdict.xml tools/jmdict.scm dictionaries/frequency.tsv $(DICO_MODULES)
5754
	guile -L modules tools/jmdict.scm build \
5855
        $< $(shell echo $@ | sed 's|^.*_\([^.]*\)\..*$$|\1|g') $@

tools/jmdict.scm

2525
(use-modules (ice-9 match))
2626
(use-modules (ice-9 binary-ports))
2727
28-
(define (convert input output)
29-
  (let ((sxml (load-dic input)))
30-
    (call-with-output-file output
31-
      (lambda (port)
32-
        (write sxml port)))))
33-
3428
;; Break these steps to try and let the GC reclaim these big objects
3529
(define (get-results1 input frq)
3630
  (call-with-input-file input

7165
     (if (equal? lang "e")
7266
       (compile input (const #t) output)
7367
       (compile input (lambda (sense) (equal? (sense-language sense) lang)) output)))
74-
    ((equal? cmd "convert")
75-
     (convert input output))
7668
    (else (format #t "Unknown cmd ~a.~%" cmd))))
7769
  ((_ "print" word input)
7870
   (print word input)))

tools/wadoku.scm

6868
     (if (equal? lang "e")
6969
       (compile input (const #t) output)
7070
       (compile input (lambda (sense) (equal? (sense-language sense) lang)) output)))
71-
    ((equal? cmd "convert")
72-
     (convert input output))
7371
    (else (format #t "Unknown cmd ~a.~%" cmd))))
7472
  ((_ "print" word input)
7573
   (print word input)))