@@ -457,6 +457,68 @@ function printmodel(
457
457
nothing
458
458
end
459
459
460
+ function printmodel (
461
+ io:: IO ,
462
+ m:: DecisionSet ;
463
+ header = DEFAULT_HEADER,
464
+ indentation_str = " " ,
465
+ indentation = default_indentation,
466
+ depth = 0 ,
467
+ max_depth = nothing ,
468
+ show_subtree_info = false ,
469
+ show_rule_metrics = true ,
470
+ show_subtree_metrics = false ,
471
+ show_metrics = false ,
472
+ show_shortforms = false ,
473
+ show_intermediate_finals = false ,
474
+ tree_mode = false ,
475
+ show_symbols = true ,
476
+ syntaxstring_kwargs = (;),
477
+ #
478
+ parenthesize_atoms = true ,
479
+ kwargs... ,
480
+ )
481
+ (
482
+ indentation_list_children,
483
+ indentation_hspace,
484
+ indentation_any_first,
485
+ indentation_any_space,
486
+ indentation_last_first,
487
+ indentation_last_space
488
+ ) = indentation
489
+ if header != false
490
+ _typestr = string (header == true ? typeof (m) :
491
+ header == :brief ? nameof (typeof (m)) :
492
+ error (" Unexpected value for parameter header: $(header) ." )
493
+ )
494
+ println (io, " $(indentation_str)$(_typestr)$((length (info (m)) == 0 ) ?
495
+ " " : " \n $(indentation_str) Info: $(info (m)) " ) " )
496
+ end
497
+ depth == 0 && show_symbols && print (io, MODEL_SYMBOL)
498
+ # #######################################################################################
499
+ _show_rule_metrics = show_rule_metrics
500
+ # TODO show this metrics if show_metrics
501
+ # #######################################################################################
502
+ if isnothing (max_depth) || depth < max_depth
503
+ println (io, " $(indentation_list_children) " )
504
+ for (i_rule, rule) in enumerate (rules (m))
505
+ # pipe = indentation_any_first
506
+ pipe = (i_rule != nrules (m) ? indentation_any_first : indentation_last_first)* " [$(i_rule) /$(nrules (m)) ]"
507
+ # println(io, "$(indentation_str*pipe)$(syntaxstring(antecedent(rule); (haskey(info(rule), :syntaxstring_kwargs) ? info(rule).syntaxstring_kwargs : (;))..., syntaxstring_kwargs..., parenthesize_atoms = parenthesize_atoms, kwargs...))")
508
+ pad_str = indentation_str* indentation_any_space* repeat (indentation_hspace, length (pipe)- length (indentation_any_space)- 1 )
509
+ # print(io, "$(pad_str*indentation_last_first)")
510
+ ind_str = pad_str* indentation_last_space
511
+ # @_print_submodel io consequent(rule) ind_str indentation depth max_depth show_subtree_info false show_subtree_metrics show_shortforms show_intermediate_finals tree_mode show_symbols syntaxstring_kwargs parenthesize_atoms kwargs
512
+ print (io, pipe)
513
+ @_print_submodel io rule ind_str indentation depth max_depth show_subtree_info _show_rule_metrics show_subtree_metrics show_shortforms show_intermediate_finals tree_mode show_symbols syntaxstring_kwargs parenthesize_atoms kwargs
514
+ end
515
+ else
516
+ depth != 0 && print (io, " " )
517
+ println (io, " [...]" )
518
+ end
519
+ nothing
520
+ end
521
+
460
522
function printmodel (
461
523
io:: IO ,
462
524
m:: DecisionEnsemble ;
0 commit comments