fix for Android

This commit is contained in:
polv committed 2026-03-09 19:31:26 +07:00
1 parent 7b75d6302e
commit 653eacf8d4
5 files changed
+30 -36

No files matched your search

+4 -4
View File
@@ -1,7 +1,6 @@
use std::path::Path;
use std::{fs::File, io::BufReader, path::Path};
use serde::Serialize;
use vibrato_rkyv::CacheStrategy;
use crate::CJDicError;
@@ -28,8 +27,9 @@ pub struct Tokenizer {
impl Tokenizer {
pub fn new(vibrato_dict: impl AsRef<Path>) -> Result<Self, CJDicError> {
let dictionary =
vibrato_rkyv::Dictionary::from_zstd(vibrato_dict, CacheStrategy::GlobalCache)?;
let file = BufReader::new(File::open(vibrato_dict)?);
let reader = zstd::Decoder::new(file)?;
let dictionary = vibrato_rkyv::Dictionary::read(reader)?;
Ok(Self {
ja_tokenizer: vibrato_rkyv::Tokenizer::new(dictionary),
})