@@ -41,25 +41,33 @@ static boolean nolog = FALSE;
41
41
*
42
42
*/
43
43
44
+ static boolean show_gui = FALSE;
45
+
44
46
static void
45
47
show_visual (Recog * recog , void * dummy )
46
48
{
47
49
RecogProcess * process = recog -> process_list ;
48
- visual_show (process -> backtrellis );
50
+
51
+ if (show_gui )
52
+ visual_show (process -> backtrellis );
49
53
}
50
54
51
55
static void
52
56
init_visual2 (Recog * recog , void * dummy )
53
57
{
54
58
JCONF_SEARCH * conf = recog -> process_list -> config ;
55
- visual2_init (conf -> pass2 .hypo_overflow );
59
+
60
+ if (show_gui )
61
+ visual2_init (conf -> pass2 .hypo_overflow );
56
62
}
57
63
58
64
static void
59
65
pop_visual2 (Recog * recog , void * dummy )
60
66
{
61
67
StackDecode * pass2 = & (recog -> process_list -> pass2 );
62
- visual2_popped (pass2 -> current , pass2 -> popctr );
68
+
69
+ if (show_gui )
70
+ visual2_popped (pass2 -> current , pass2 -> popctr );
63
71
}
64
72
65
73
static void
@@ -70,6 +78,9 @@ next_word_visual2(Recog *recog, void *dummy)
70
78
NODE * prev , * next ;
71
79
int popctr ;
72
80
81
+ if (!show_gui )
82
+ return ;
83
+
73
84
process = recog -> process_list ;
74
85
pass2 = & (process -> pass2 );
75
86
prev = pass2 -> current ;
@@ -82,6 +93,13 @@ next_word_visual2(Recog *recog, void *dummy)
82
93
visual2_next_word (prev , next , popctr );
83
94
}
84
95
96
+ static boolean
97
+ opt_visualize (Jconf * jconf , char * arg [], int argnum )
98
+ {
99
+ show_gui = TRUE;
100
+ return TRUE;
101
+ }
102
+
85
103
#endif
86
104
87
105
/**
@@ -154,6 +172,9 @@ main(int argc, char *argv[])
154
172
j_add_option ("-outfile" , 0 , 0 , "save result in separate .out file" , opt_outfile );
155
173
j_add_option ("-help" , 0 , 0 , "display this help" , opt_help );
156
174
j_add_option ("--help" , 0 , 0 , "display this help" , opt_help );
175
+ #ifdef VISUALIZE
176
+ j_add_option ("-visualize" , 0 , 0 , "show a visual interface for the parsed input" , opt_visualize );
177
+ #endif /*VISUALIZE*/
157
178
158
179
/* create a configuration variables container */
159
180
jconf = j_jconf_new ();
0 commit comments