[−][src]Trait twitter_text::extractor::Extract
A common Trait implemented by the two Extractors, Extractor and ValidatingExtractor.
Associated Types
type T
The result type returned from the various extract methods.
type Mention
The result type returned from the various mention extract methods.
Required methods
fn get_extract_url_without_protocol(&self) -> bool
Get whether the extractor will detect URLs without schemes, such as "example.com".
fn set_extract_url_without_protocol(
&mut self,
extract_url_without_protocol: bool
)
&mut self,
extract_url_without_protocol: bool
)
Set whether the extractor will detect URLs without schemes, such as "example.com".
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.
fn create_result(
&self,
s: &'a str,
entity_count: usize,
pairs: &mut Vec<UnprocessedEntity<'a>>
) -> Self::T
&self,
s: &'a str,
entity_count: usize,
pairs: &mut Vec<UnprocessedEntity<'a>>
) -> Self::T
Create the result type. The concrete type varies by implementation.
fn extract_reply_username(&self, s: &'a str) -> Self::Mention
Create the mention result type. The concrete type varies by implementation.
fn mention_result(
&self,
s: &'a str,
pairs: Option<Pair<'a, Rule>>
) -> Self::Mention
&self,
s: &'a str,
pairs: Option<Pair<'a, Rule>>
) -> Self::Mention
Create a mention result type from a pest::Pair.
fn empty_result(&self) -> Self::T
Returns an empty result. Used when the input is invalid.
Provided methods
fn extract_impl(&self, s: &'a str, r_match: fn(_: Rule) -> bool) -> 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.
fn extract_hashtags(&self, s: &'a str) -> Self::T
Extract all Hashtags from the text
fn extract_cashtags(&self, s: &'a str) -> Self::T
Extract all Cashtags from the text
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.
fn extract_mentioned_screennames_with_indices(&self, s: &'a str) -> Self::T
Extract all usernames from the text.
fn extract_mentions_or_lists_with_indices(&self, s: &'a str) -> Self::T
Extract all usernames and lists from the text.
fn extract_reply_username_impl(&self, s: &'a str) -> Self::Mention
Extract a "reply"--a username that appears at the beginning of a tweet.
fn extract_entities_with_indices(&self, s: &'a str) -> Self::T
Extract all entities from the text (Usernames, Lists, Hashtags, Cashtags, and URLs).
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>>
&self,
ue: UnprocessedEntity<'a>,
start: i32,
end: i32
) -> Option<Entity<'a>>
Implementors
impl<'a> Extract<'a> for Extractor
[src]
type T = Vec<Entity<'a>>
Extractor returns a vector of entities with no validation data.
type Mention = Option<Entity<'a>>
Extractor returns a single mention entity with no validation data.
fn get_extract_url_without_protocol(&self) -> bool
[src]
fn set_extract_url_without_protocol(
&mut self,
extract_url_without_protocol: bool
)
[src]
&mut self,
extract_url_without_protocol: bool
)
fn extract(&self, s: &'a str, r_match: fn(_: Rule) -> bool) -> Vec<Entity<'a>>
[src]
fn create_result(
&self,
s: &'a str,
count: usize,
scanned: &mut Vec<UnprocessedEntity<'a>>
) -> Vec<Entity<'a>>
[src]
&self,
s: &'a str,
count: usize,
scanned: &mut Vec<UnprocessedEntity<'a>>
) -> Vec<Entity<'a>>
fn extract_reply_username(&self, s: &'a str) -> Option<Entity<'a>>
[src]
fn mention_result(
&self,
s: &'a str,
entity: Option<Pair<'a, Rule>>
) -> Option<Entity<'a>>
[src]
&self,
s: &'a str,
entity: Option<Pair<'a, Rule>>
) -> Option<Entity<'a>>
fn empty_result(&self) -> Vec<Entity<'a>>
[src]
impl<'a> Extract<'a> for ValidatingExtractor<'a>
[src]
type T = ExtractResult<'a>
type Mention = MentionResult<'a>
fn get_extract_url_without_protocol(&self) -> bool
[src]
fn set_extract_url_without_protocol(
&mut self,
extract_url_without_protocol: bool
)
[src]
&mut self,
extract_url_without_protocol: bool
)
fn extract(&self, s: &'a str, r_match: fn(_: Rule) -> bool) -> Self::T
[src]
fn create_result(
&self,
s: &'a str,
count: usize,
scanned: &mut Vec<UnprocessedEntity<'a>>
) -> ExtractResult<'a>
[src]
&self,
s: &'a str,
count: usize,
scanned: &mut Vec<UnprocessedEntity<'a>>
) -> ExtractResult<'a>
fn extract_reply_username(&self, s: &'a str) -> MentionResult<'a>
[src]
fn mention_result(
&self,
s: &'a str,
pair: Option<Pair<'a, Rule>>
) -> MentionResult<'a>
[src]
&self,
s: &'a str,
pair: Option<Pair<'a, Rule>>
) -> MentionResult<'a>