1 ; Portions Copyright 2004 Sun Microsystems, Inc.
2 ; Portions Copyright 1999-2003 Language Technologies Institute,
3 ; Carnegie Mellon University.
4 ; All Rights Reserved. Use is subject to license terms.
6 ; See the file "license.terms" for information on usage and
7 ; redistribution of this file, and for a DISCLAIMER OF ALL
10 ; Dumps the clunit_selection_trees to standard out.
12 ; Expects clunit_selection_trees to be defined.
18 (let ((tree (cadr cart))
20 (set! cart_nodes_text (format nil "%s" (print_cart_nodes tree)))
21 (format t "CART %s %d\n" name current_node)
22 (format t "%s" cart_nodes_text)
24 clunits_selection_trees))
26 (defvar cart_operators
32 ("=" "EQUALS"))) ; CST_CART_OP_EQUALS not handled in
33 ; Flite->FreeTTS Conversion
36 (define (print_cart_list l)
39 ((cdr l) (format nil "%f,%s" (caar l) (print_cart_list (cdr l))))
40 (t (format nil "%f" (caar l)))
43 (define (print_cart_nodes tree)
44 (set! current_node (+ 1 current_node))
46 ((cdr tree) ;node (non-leaf)
47 (let ((operator (cadr (assoc_string (cadr (car tree)) cart_operators)))
48 (val (nth 2 (car tree))))
50 ((string-equal operator "=") (format nil "String(%s)" val))
51 ((string-equal operator "REGEX") (format nil "Integer(%d)" val))
52 ((number? val) (format nil "Float(%f)" val))
53 ((consp val) (format stderr "List vals not supported here yet\n")
55 (t (format nil "String(%s)" val))
57 (let ((left_val (print_cart_nodes (car (cdr tree)))))
58 (let ((this_node_val (format nil "NODE %s %s %s %d\n"
63 (let ((right_val (print_cart_nodes (car (cdr (cdr tree))))))
64 (string-append this_node_val left_val right_val))))
67 ((consp (caar tree)) ;leaf = (caar tree)
68 (format nil "LEAF List(%s)\n"
69 (print_cart_list (caar tree)))
71 (t (format stderr "Unknown leaf format\n") (error 1))