pub struct ValidatingExtractor<'a> { /* private fields */ }Expand description
An Extract implementation that extracts entities and provides TwitterTextParseResults validation data.
Implementations§
Source§impl<'a> ValidatingExtractor<'a>
impl<'a> ValidatingExtractor<'a>
Sourcepub fn new(configuration: &Configuration) -> ValidatingExtractor<'_>
pub fn new(configuration: &Configuration) -> ValidatingExtractor<'_>
Create a new Extractor. ValidatingExtractor::prep_input must be called prior to extract.
Sourcepub fn prep_input(&mut self, s: &str) -> String
pub fn prep_input(&mut self, s: &str) -> String
Initialize the ValidatingExtractor text length data.
Sourcepub fn new_with_nfc_input(
configuration: &'a Configuration,
s: &str,
) -> ValidatingExtractor<'a>
pub fn new_with_nfc_input( configuration: &'a Configuration, s: &str, ) -> ValidatingExtractor<'a>
Create a new Extractor from text that is already nfc-normalized. There’s no need to call ValidatingExtractor::prep_input for this text.
Trait Implementations§
Source§impl<'a> Extract<'a> for ValidatingExtractor<'a>
impl<'a> Extract<'a> for ValidatingExtractor<'a>
Source§type T = ExtractResult<'a>
type T = ExtractResult<'a>
The result type returned from the various extract methods.
Source§type Mention = MentionResult<'a>
type Mention = MentionResult<'a>
The result type returned from the various mention extract methods.
Source§fn get_extract_url_without_protocol(&self) -> bool
fn get_extract_url_without_protocol(&self) -> bool
Get whether the extractor will detect URLs without schemes, such as “example.com”.
Source§fn set_extract_url_without_protocol(
&mut self,
extract_url_without_protocol: bool,
)
fn set_extract_url_without_protocol( &mut self, extract_url_without_protocol: bool, )
Set whether the extractor will detect URLs without schemes, such as “example.com”.
Source§fn extract(&self, s: &'a str, r_match: fn(Rule) -> bool) -> Self::T
fn extract(&self, s: &'a str, r_match: fn(Rule) -> bool) -> Self::T
Extract entities from the source text that match rules allowed by r_match.
Source§fn create_result(
&self,
s: &'a str,
count: usize,
scanned: &mut Vec<UnprocessedEntity<'a>>,
) -> ExtractResult<'a>
fn create_result( &self, s: &'a str, count: usize, scanned: &mut Vec<UnprocessedEntity<'a>>, ) -> ExtractResult<'a>
Create the result type. The concrete type varies by implementation.
Source§fn extract_reply_username(&self, s: &'a str) -> MentionResult<'a>
fn extract_reply_username(&self, s: &'a str) -> MentionResult<'a>
Create the mention result type. The concrete type varies by implementation.
Source§fn mention_result(
&self,
s: &'a str,
pair: Option<Pair<'a, Rule>>,
) -> MentionResult<'a>
fn mention_result( &self, s: &'a str, pair: Option<Pair<'a, Rule>>, ) -> MentionResult<'a>
Create a mention result type from a pest::Pair.
Source§fn empty_result(&self) -> ExtractResult<'a>
fn empty_result(&self) -> ExtractResult<'a>
Returns an empty result. Used when the input is invalid.
fn extract_impl(&self, s: &'a str, r_match: fn(Rule) -> bool) -> Self::T
Source§fn extract_urls_with_indices(&self, s: &'a str) -> Self::T
fn extract_urls_with_indices(&self, s: &'a str) -> Self::T
Extract all URLs from the text, subject to value returned by Extract::get_extract_url_without_protocol.
Extract all Hashtags from the text
Extract all Cashtags from the text
Source§fn extract_mentioned_screennames(&self, s: &'a str) -> Self::T
fn extract_mentioned_screennames(&self, s: &'a str) -> Self::T
Extract all usernames from the text. The same
as Extract::extract_mentioned_screennames_with_indices, but included for compatibility.
Source§fn extract_mentioned_screennames_with_indices(&self, s: &'a str) -> Self::T
fn extract_mentioned_screennames_with_indices(&self, s: &'a str) -> Self::T
Extract all usernames from the text.
Source§fn extract_mentions_or_lists_with_indices(&self, s: &'a str) -> Self::T
fn extract_mentions_or_lists_with_indices(&self, s: &'a str) -> Self::T
Extract all usernames and lists from the text.
Source§fn extract_reply_username_impl(&self, s: &'a str) -> Self::Mention
fn extract_reply_username_impl(&self, s: &'a str) -> Self::Mention
Extract a “reply”–a username that appears at the beginning of a tweet.
Source§fn extract_entities_with_indices(&self, s: &'a str) -> Self::T
fn extract_entities_with_indices(&self, s: &'a str) -> Self::T
Extract all entities from the text (Usernames, Lists, Hashtags, Cashtags, and URLs).
Source§fn extract_scan(&self, s: &'a str) -> Self::T
fn extract_scan(&self, s: &'a str) -> Self::T
Parse the text without extracting any entities.
fn entity_from_pair( &self, ue: UnprocessedEntity<'a>, start: i32, end: i32, ) -> Option<Entity<'a>>
Auto Trait Implementations§
impl<'a> Freeze for ValidatingExtractor<'a>
impl<'a> RefUnwindSafe for ValidatingExtractor<'a>
impl<'a> Send for ValidatingExtractor<'a>
impl<'a> Sync for ValidatingExtractor<'a>
impl<'a> Unpin for ValidatingExtractor<'a>
impl<'a> UnsafeUnpin for ValidatingExtractor<'a>
impl<'a> UnwindSafe for ValidatingExtractor<'a>
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