format
Function: format
▸ format(tree
, options?
): string
Format a Tree
object into a PENMAN string.
options
consists of the following:
indent
: How to indent formatted strings.compact
: Iftrue
, put initial attributes on the first line.
Example
import { format } from 'penman-js';
console.log(format(
['b', [['/', 'bark-01'],
[':ARG0', ['d', [['/', 'dog']]]]]
]
));
// (b / bark-01
// :ARG0 (d / dog))
Function: formatTriples
▸ formatTriples(triples
, options?
): string
Return the formatted triple conjunction of triples
.
options
consists of the following:
indent
: Whether or not to indent the results, default true.
Example
import { decode, formatTriples } from 'penman-js';
const g = decode('(b / bark-01 :ARG0 (d / dog))');
console.log(formatTriples(g.triples));
// instance(b, bark-01) ^
// ARG0(b, d) ^
// instance(d, dog)