pub struct DocumentParser;Expand description
Stateless document parser.
Implementations§
Source§impl DocumentParser
impl DocumentParser
Sourcepub fn detect_format(text: &str) -> DocumentFormat
pub fn detect_format(text: &str) -> DocumentFormat
Heuristically detect the format of the given text.
Sourcepub fn parse_markdown(text: &str) -> ParsedDocument
pub fn parse_markdown(text: &str) -> ParsedDocument
Parse a Markdown document into sections.
Sourcepub fn parse_html(text: &str) -> ParsedDocument
pub fn parse_html(text: &str) -> ParsedDocument
Parse an HTML document into sections.
Sourcepub fn parse_json(text: &str) -> ParsedDocument
pub fn parse_json(text: &str) -> ParsedDocument
Parse a JSON document, extracting string values and keys as content.
Sourcepub fn parse_csv(text: &str) -> ParsedDocument
pub fn parse_csv(text: &str) -> ParsedDocument
Parse a CSV document, treating the header row as section titles.
Sourcepub fn parse(text: &str) -> ParsedDocument
pub fn parse(text: &str) -> ParsedDocument
Auto-detect format and dispatch to the appropriate parser.
Sourcepub fn extract_links(text: &str) -> Vec<String>
pub fn extract_links(text: &str) -> Vec<String>
Extract all URLs (http/https) and Markdown-style links from text.
Sourcepub fn extract_code_blocks(text: &str) -> Vec<(String, String)>
pub fn extract_code_blocks(text: &str) -> Vec<(String, String)>
Extract code blocks as (language, code) pairs.
Sourcepub fn detect_language(text: &str) -> Option<String>
pub fn detect_language(text: &str) -> Option<String>
Simple heuristic language detection based on common words.
Sourcepub fn word_count(text: &str) -> usize
pub fn word_count(text: &str) -> usize
Count words in text.
Strip HTML tags from a string.
Sourcepub fn split_sentences(text: &str) -> Vec<String>
pub fn split_sentences(text: &str) -> Vec<String>
Split text into sentences.
Auto Trait Implementations§
impl Freeze for DocumentParser
impl RefUnwindSafe for DocumentParser
impl Send for DocumentParser
impl Sync for DocumentParser
impl Unpin for DocumentParser
impl UnsafeUnpin for DocumentParser
impl UnwindSafe for DocumentParser
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more