pub struct StatisticalAnalyzer { /* private fields */ }Expand description
Statistical language model-based analyzer for encoding detection.
Uses statistical models and language patterns to improve encoding detection accuracy beyond simple byte frequency analysis.
Implementations§
Source§impl StatisticalAnalyzer
impl StatisticalAnalyzer
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new StatisticalAnalyzer with pre-built language models.
Initializes language models for various character encodings to enable statistical analysis of text patterns.
Sourcepub fn analyze_with_models(&self, data: &[u8]) -> Result<HashMap<Charset, f32>>
pub fn analyze_with_models(&self, data: &[u8]) -> Result<HashMap<Charset, f32>>
Analyzes byte data using language models to determine encoding likelihood.
§Arguments
data- The byte data to analyze
§Returns
Returns a HashMap mapping each charset to its likelihood score. Higher scores indicate higher likelihood that the data is encoded in that character set.
§Errors
Returns an error if the model scoring calculation fails.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for StatisticalAnalyzer
impl RefUnwindSafe for StatisticalAnalyzer
impl Send for StatisticalAnalyzer
impl Sync for StatisticalAnalyzer
impl Unpin for StatisticalAnalyzer
impl UnwindSafe for StatisticalAnalyzer
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