Skip to main content

surface

Surface strings, tokens, and alignments.

Class: AlignmentMarker​

constructor​

• new AlignmentMarker(indices, options?): AlignmentMarker

options consists of the following:

  • prefix: The prefix of the alignment marker.

indices​

• indices: number[]


mode​

• mode: number = 0

The mode attribute specifies what the Epidatum annotates:

  • mode = 0 -- unspecified
  • mode = 1 -- role epidata
  • mode = 2 -- target epidata

prefix​

• Optional prefix: string


equals​

▸ equals(other): boolean


pprint​

▸ pprint(): string

Equivalent to __repr__ in Python


toString​

▸ toString(): string


fromString​

▸ fromString<T>(s): T

Instantiate the alignment marker from its string s.

Example

import { Alignment, RoleAlignment } from 'penman-js';

Alignment.fromString('1');
// Alignment([1])

RoleAlignment.fromString('e.2,3');
// RoleAlignment([2, 3], 'e.')

Class: Alignment​

constructor​

• new Alignment(indices, options?): Alignment

options consists of the following:

  • prefix: The prefix of the alignment marker.

indices​

• indices: number[]


mode​

• mode: number = 2

The mode attribute specifies what the Epidatum annotates:

  • mode = 0 -- unspecified
  • mode = 1 -- role epidata
  • mode = 2 -- target epidata

prefix​

• Optional prefix: string


equals​

▸ equals(other): boolean


pprint​

▸ pprint(): string

Equivalent to __repr__ in Python


toString​

▸ toString(): string


fromString​

▸ fromString<T>(s): T

Instantiate the alignment marker from its string s.

Example

import { Alignment, RoleAlignment } from 'penman-js';

Alignment.fromString('1');
// Alignment([1])

RoleAlignment.fromString('e.2,3');
// RoleAlignment([2, 3], 'e.')

Class: RoleAlignment​

constructor​

• new RoleAlignment(indices, options?): RoleAlignment

options consists of the following:

  • prefix: The prefix of the alignment marker.

indices​

• indices: number[]


mode​

• mode: number = 1

The mode attribute specifies what the Epidatum annotates:

  • mode = 0 -- unspecified
  • mode = 1 -- role epidata
  • mode = 2 -- target epidata

prefix​

• Optional prefix: string


equals​

▸ equals(other): boolean


pprint​

▸ pprint(): string

Equivalent to __repr__ in Python


toString​

▸ toString(): string


fromString​

▸ fromString<T>(s): T

Instantiate the alignment marker from its string s.

Example

import { Alignment, RoleAlignment } from 'penman-js';

Alignment.fromString('1');
// Alignment([1])

RoleAlignment.fromString('e.2,3');
// RoleAlignment([2, 3], 'e.')

Function: alignments​

▸ alignments(g): _Alignments

Return a mapping of triples to alignments in graph g.

Example

import { decode, alignments } from 'penman-js';

const g = decode(
`(c / chase-01~4
:ARG0~5 (d / dog~7)
:ARG0~3 (c / cat~2))`
);
alignments(g);
// ArrayKeysMap({
// ['c', ':instance', 'chase-01']: Alignment([4]),
// ['d', ':instance', 'dog']: Alignment([7]),
// ['c', ':instance', 'cat']: Alignment([2])
// })

Function: roleAlignments​

▸ roleAlignments(g): _Alignments

Return a mapping of triples to role alignments in graph g.

Example

import { decode, roleAlignments } from 'penman-js';

const g = decode(
`(c / chase-01~4
:ARG0~5 (d / dog~7)
:ARG0~3 (c / cat~2))`
);
roleAlignments(g);
// ArrayKeysMap({
// ['c', ':ARG0', 'd']: RoleAlignment([5]),
// ['c', ':ARG0', 'c']: RoleAlignment([3])
// })