Skip to content

Commit

Permalink
Applying Rustfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
aignatovich committed Jul 8, 2024
1 parent 0bccf7b commit 1872257
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
10 changes: 5 additions & 5 deletions charabia/src/normalizer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ pub use self::japanese::JapaneseNormalizer;
pub use self::lowercase::LowercaseNormalizer;
use self::nonspacing_mark::NonspacingMarkNormalizer;
use self::quote::QuoteNormalizer;
#[cfg(feature = "russian")]
pub use self::russian::RussianNormalizer;
#[cfg(feature = "swedish-recomposition")]
use self::swedish_recomposition::SwedishRecompositionNormalizer;
#[cfg(feature = "vietnamese")]
pub use self::vietnamese::VietnameseNormalizer;
#[cfg(feature = "russian")]
pub use self::russian::RussianNormalizer;
use crate::segmenter::SegmentedTokenIter;
use crate::Token;

Expand All @@ -39,12 +39,12 @@ mod japanese;
mod lowercase;
mod nonspacing_mark;
mod quote;
#[cfg(feature = "russian")]
mod russian;
#[cfg(feature = "swedish-recomposition")]
mod swedish_recomposition;
#[cfg(feature = "vietnamese")]
mod vietnamese;
#[cfg(feature = "russian")]
mod russian;

mod ae_oe_normalizer;

Expand Down Expand Up @@ -76,7 +76,7 @@ pub static LOSSY_NORMALIZERS: Lazy<Vec<Box<dyn Normalizer>>> = Lazy::new(|| {
#[cfg(feature = "vietnamese")]
Box::new(VietnameseNormalizer),
#[cfg(feature = "russian")]
Box::new(RussianNormalizer)
Box::new(RussianNormalizer),
]
});

Expand Down
11 changes: 5 additions & 6 deletions charabia/src/normalizer/russian.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
use std::borrow::Cow;

use super::{Normalizer, NormalizerOption};
use crate::{Script, Token};
use aho_corasick::AhoCorasick;
use once_cell::sync::Lazy;
use crate::{Script, Token};

pub struct RussianNormalizer;

static MATCHING_STR: Lazy<AhoCorasick> = Lazy::new(|| {
AhoCorasick::new([\u{308}", \u{308}"]).unwrap()
});
static MATCHING_STR: Lazy<AhoCorasick> =
Lazy::new(|| AhoCorasick::new([\u{308}", \u{308}"]).unwrap());

impl Normalizer for RussianNormalizer {
fn normalize<'o>(&self, mut token: Token<'o>, options: &NormalizerOption) -> Token<'o> {
Expand Down Expand Up @@ -111,8 +110,8 @@ mod test {
lemma: Owned("Ёё".to_string()),
char_end: 2,
byte_end: 2,
script: Script::Cyrillic,
char_map: None,
script: Script::Cyrillic,
char_map: None,
..Default::default()
}]
}
Expand Down

0 comments on commit 1872257

Please sign in to comment.