/** Tree and graph transformations. */ import { Graph } from './graph'; import { Model } from './model'; import { Tree } from './tree'; export interface CanonicalizeRolesOptions { /** A model defining role normalizations. */ model?: Model; } export interface ReifyEdgesOptions { /** A model defining reifications. */ model?: Model; } export interface DereifyEdgesOptions { /** A model defining reifications. */ model?: Model; } /** * Normalize roles in `t` so they are canonical according to `model`. * * This is a tree transformation rather than a graph transformation * because the orientation of the pure graph's triples is not decided * until the graph is configured into a tree. * * `options` consists of the following: * - `model`: A model defining role normalizations. * * @param t - A `Tree` object. * @param options - Optional arguments. * @param options.model - A model defining role normalizations. * @returns A new `Tree` object with canonicalized roles. * @example * import { PENMANCodec, amrModel, canonicalizeRoles } from 'penman-js'; * * const codec = new PENMANCodec(); * const t = codec.parse('(c / chapter :domain-of 7)'); * const canonicalizedTree = canonicalizeRoles(t, { model: amrModel }); * console.log(codec.format(canonicalizedTree)); * // (c / chapter * // :mod 7) */ export declare const canonicalizeRoles: (t: Tree, options?: CanonicalizeRolesOptions) => Tree; /** * Reify all edges in `g` that have reifications in `model`. * * `options` consists of the following: * - `model`: A model defining reifications. * * @param g - A `Graph` object. * @param options - Optional arguments. * @param options.model - A model defining reifications. * @returns A new `Graph` object with reified edges. * @example * import { PENMANCodec, amrModel, reifyEdges } from 'penman-js'; * * const codec = new PENMANCodec(model); * const g = codec.decode('(c / chapter :mod 7)'); * const reifiedGraph = reifyEdges(g, { model: amrModel }); * console.log(codec.encode(reifiedGraph)); * // (c / chapter * // :ARG1-of (_ / have-mod-91 * // :ARG2 7)) */ export declare const reifyEdges: (g: Graph, options?: ReifyEdgesOptions) => Graph; /** * Dereify edges in `g` that have reifications in `model`. * * `options` consists of the following: * - `model`: A model defining reifications. * * @param g - A `Graph` object. * @param options - Optional arguments. * @param options.model - A model defining reifications. * @returns A new `Graph` object with dereified edges. * @example * import { PENMANCodec, amrModel, dereifyEdges } from 'penman-js'; * * const codec = new PENMANCodec({ model: amrModel }); * const g = codec.decode( * `(c / chapter * :ARG1-of (_ / have-mod-91 * :ARG2 7))` * ); * const dereifiedGraph = dereifyEdges(g, { model: amrModel }); * console.log(codec.encode(dereifiedGraph)); * // (c / chapter * // :mod 7) */ export declare const dereifyEdges: (g: Graph, options?: DereifyEdgesOptions) => Graph; /** * Reify all attributes in `g`. * * @param g - A `Graph` object. * @returns A new `Graph` object with reified attributes. * @example * import { PENMANCodec, amrModel, reifyAttributes } from 'penman-js'; * * const codec = new PENMANCodec(amrModel); * const g = codec.decode('(c / chapter :mod 7)'); * const reifiedGraph = reifyAttributes(g); * console.log(codec.encode(reifiedGraph)); * // (c / chapter * // :mod (_ / 7)) */ export declare const reifyAttributes: (g: Graph) => Graph; /** * Insert TOP triples in `g` indicating the tree structure. * * Note: This depends on `g` containing the epigraphical layout markers * from parsing; it will not work with programmatically * constructed Graph objects or those whose epigraphical data * were removed. * * @param g - A `Graph` object. * @param model - A model defining the TOP role. * @returns A new `Graph` object with TOP roles indicating tree branches. * @example * import { PENMANCodec, amrModel, indicateBranches } from 'penman-js'; * * const codec = new PENMANCodec(amrModel); * const g = codec.decode(` * (w / want-01 * :ARG0 (b / boy) * :ARG1 (g / go-02 * :ARG0 b))`); * const branchedGraph = indicateBranches(g, amrModel); * console.log(codec.encode(branchedGraph)); * // (w / want-01 * // :TOP b * // :ARG0 (b / boy) * // :TOP g * // :ARG1 (g / go-02 * // :ARG0 b)) */ export declare const indicateBranches: (g: Graph, model: Model) => Graph;