spmviz.data.format_pattern#

spmviz.data.format_pattern(p, style='arrow', labels=None)[source]#

Format a pattern as text.

Parameters:
ppattern
style{“arrow”, “ascii”, “angle”, “compact”, “spmf”, “underscore”}

"arrow": a → b → (c, d); "ascii": a -> b -> (c,d); "angle": ⟨a b (cd)⟩; "compact": a b (c d); "spmf": 1 -1 2 -1; "underscore": a_b_c (notation of the NbVFS paper).

labelsmapping, optional

Display names of the items.

Examples

>>> format_pattern((("a",), ("b", "c")))
'a → (b, c)'
>>> format_pattern((("a",), ("b", "c")), "angle")
'⟨a (bc)⟩'