Skip to content

Commit

Permalink
text formatted
Browse files Browse the repository at this point in the history
  • Loading branch information
PasoStudio73 committed Aug 15, 2024
1 parent 011cb92 commit 6ac407a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/evaluate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,11 @@ end
using PrettyTables

# TODO document
function metricstable(ms::Vector{<:Rule}; metrics_kwargs = (;), syntaxstring_kwargs = (;), variable_names_map = nothing, pretty_table_kwargs...)
function metricstable(ms::Vector{<:Rule}; metrics_kwargs = (;), syntaxstring_kwargs = (;), variable_names_map = nothing, variable_idx = nothing, pretty_table_kwargs...)
mets = readmetrics.(ms; metrics_kwargs...)
colnames = unique(Iterators.flatten(keys.(mets)))

data = hcat(syntaxstring.(antecedent.(ms); variable_names_map = variable_names_map, syntaxstring_kwargs...), strip.(displaymodel.(consequent.(ms); show_symbols = false)), [[get(met, colname, "") for met in mets] for colname in colnames]...)
data = hcat(AnsiTextCell.(syntaxstring.(antecedent.(ms); variable_names_map = variable_names_map, variable_idx = variable_idx, syntaxstring_kwargs...)), strip.(displaymodel.(consequent.(ms); show_symbols = false)), [[get(met, colname, "") for met in mets] for colname in colnames]...)
header = ["Antecedent", "Consequent", colnames...]
pretty_table(
data;
Expand Down
12 changes: 6 additions & 6 deletions src/print.jl
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ function printmodel(
println(io, "$(indentation_str)$(_typestr)$((length(info(m)) == 0) ?
"" : "\n$(indentation_str)Info: $(info(m))")")
end
depth == 0 && show_symbols && print(io, "")
depth == 0 && show_symbols && print(io, "\e[34m▣\e[0m")
print(io, " $(outcome(m))")
(show_subtree_metrics || show_metrics != false) && print(io, " : $(get_metrics_string(m; (show_metrics isa NamedTuple ? show_metrics : [])...))")
show_shortforms != false && haskey(info(m), :shortform) && print(io, "\t\t\t\t\t\t\tSHORTFORM: $(@_antecedent_syntaxstring info(m)[:shortform] m parenthesize_atoms syntaxstring_kwargs kwargs)")
Expand Down Expand Up @@ -215,7 +215,7 @@ function printmodel(
println(io, "$(indentation_str)$(_typestr)$((length(info(m)) == 0) ?
"" : "\n$(indentation_str)Info: $(info(m))")")
end
depth == 0 && show_symbols && print(io, "")
depth == 0 && show_symbols && print(io, "\e[34m▣\e[0m")
print(io, " $(f(m))")
(show_subtree_metrics || show_metrics != false) && print(io, " : $(get_metrics_string(m; (show_metrics isa NamedTuple ? show_metrics : [])...))")
show_shortforms != false && haskey(info(m), :shortform) && print(io, "\t\t\t\t\t\t\tSHORTFORM: $(@_antecedent_syntaxstring info(m)[:shortform] m parenthesize_atoms syntaxstring_kwargs kwargs)")
Expand Down Expand Up @@ -260,7 +260,7 @@ function printmodel(
println(io, "$(indentation_str)$(_typestr)$((length(info(m)) == 0) ?
"" : "\n$(indentation_str)Info: $(info(m))")")
end
depth == 0 && show_symbols && print(io, "")
depth == 0 && show_symbols && print(io, "\e[34m▣\e[0m")
########################################################################################
if isnothing(max_depth) || depth < max_depth
pipe = "$(indentation_list_children) "
Expand All @@ -282,7 +282,7 @@ function printmodel(
println(io, "")
else
line = "$(pipe)$(ant_str)" * " $(arrow) "
ind_str = indentation_str * repeat(" ", length(line) + length("") + 1)
ind_str = indentation_str * repeat(" ", length(line) + length("\e[34m▣\e[0m") + 1)
if (show_subtree_metrics || show_metrics != false)
print(io, line)
_io = IOBuffer()
Expand Down Expand Up @@ -339,7 +339,7 @@ function printmodel(
println(io, "$(indentation_str)$(_typestr)$((length(info(m)) == 0) ?
"" : "\n$(indentation_str)Info: $(info(m))")")
end
depth == 0 && show_symbols && print(io, "")
depth == 0 && show_symbols && print(io, "\e[34m▣\e[0m")
########################################################################################
if isnothing(max_depth) || depth < max_depth
pipe = "$(indentation_list_children) "
Expand Down Expand Up @@ -414,7 +414,7 @@ function printmodel(
println(io, "$(indentation_str)$(_typestr)$((length(info(m)) == 0) ?
"" : "\n$(indentation_str)Info: $(info(m))")")
end
depth == 0 && show_symbols && print(io, "")
depth == 0 && show_symbols && print(io, "\e[34m▣\e[0m")
########################################################################################
_show_rule_metrics = show_rule_metrics
# TODO show this metrics if show_metrics
Expand Down

0 comments on commit 6ac407a

Please sign in to comment.