pub struct DNM {
    pub plaintext: String,
    pub byte_offsets: Vec<usize>,
    pub parameters: DNMParameters,
    pub root_node: RoNode,
    pub node_map: HashMap<usize, (usize, usize)>,
    pub runtime: RuntimeParseData,
    pub back_map: Vec<(RoNode, i32)>,
}
Expand description

The DNM is essentially a wrapper around the plain text representation of the document, which facilitates mapping plaintext pieces to the DOM. This breaks, if the DOM is changed after the DNM generation!

Fields

plaintext: String

The plaintext

byte_offsets: Vec<usize>

As the plaintext is UTF-8: the byte offsets of the characters

parameters: DNMParameters

The options for generation

root_node: RoNode

The root node of the underlying xml tree

node_map: HashMap<usize, (usize, usize)>

Maps nodes to plaintext offsets

runtime: RuntimeParseData

A runtime object used for holding auxiliary state

back_map: Vec<(RoNode, i32)>

maps an offset to the corresponding node, and the offset in the node offset -1 means that the offset corresponds to the entire node this is e.g. used if a node is replaced by a token.

Implementations

Our linguistic canonical form will only include 1) node name, 2) class attribute and 3) textual content - excludes certain experimental markup, such as all math annotation elements - excludes whitespace nodes and comment nodes

Canonicalize a single node of choice

Obtain an MD5 hash from the canonical string of the entire DOM

Obtain an MD5 hash from the canonical string of a Node

Creates a DNM for root

Use the DNM abstraction over a plaintext utterance, assuming it stands for a single paragraph

Rebuild a llamapun-generated tokenized plaintext into a DNM quite specific to the AMS paragraph generation

Get the plaintext range of a node

Get the range representing the full DNM

Get the underlying text for this DNM

Trait Implementations

Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.