#[non_exhaustive]pub struct RenderedDocument {
pub text: String,
pub paragraphs: Vec<RenderedParagraph>,
pub sentences: Vec<RenderedSentence>,
pub connectives_used: Vec<UsedConnective>,
pub list_styles_used: Vec<UsedListStyle>,
}Expand description
A structured view of a rendered document.
Diagnosers and the composite scorer consume this rather than the
flat text of crate::DocumentPlan::render. The text field always
equals the same flattened-with-"\n\n" form render returns, so
callers can ignore the structured fields when they don’t need them.
Population of the rich fields (connectives_used, list_styles_used,
per-sentence opening connectives) happens via discourse-state
introspection at render time. A RenderedDocument returned by
crate::DocumentPlan::render_structured is internally consistent;
hand-constructed instances (e.g. for diagnoser tests) need to populate
matching data.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.text: StringThe flattened paragraph text, joined with "\n\n".
paragraphs: Vec<RenderedParagraph>One entry per paragraph, in render order.
sentences: Vec<RenderedSentence>All sentences from all paragraphs, flattened in render order. Mirrors the per-paragraph nesting and exists as a convenience for scorers that don’t care about paragraph boundaries.
connectives_used: Vec<UsedConnective>Connectives emitted across the whole document, in render order. Each entry tracks which paragraph and sentence index emitted it.
list_styles_used: Vec<UsedListStyle>List styles emitted across the whole document, in render order.
Trait Implementations§
Source§impl Clone for RenderedDocument
impl Clone for RenderedDocument
Source§fn clone(&self) -> RenderedDocument
fn clone(&self) -> RenderedDocument
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RenderedDocument
impl Debug for RenderedDocument
Source§impl Default for RenderedDocument
impl Default for RenderedDocument
Source§fn default() -> RenderedDocument
fn default() -> RenderedDocument
Source§impl PartialEq for RenderedDocument
impl PartialEq for RenderedDocument
Source§fn eq(&self, other: &RenderedDocument) -> bool
fn eq(&self, other: &RenderedDocument) -> bool
self and other values to be equal, and is used by ==.