use std::rc::Rc;
use crate::hyphenation::{Hyphenator, LiangHyphenator};
use super::counter::SyllableCounter;
pub struct TexSyllableCounter {
hyphenator: Rc<LiangHyphenator>,
}
impl TexSyllableCounter {
pub fn new(hyphenator: Rc<LiangHyphenator>) -> Self {
TexSyllableCounter { hyphenator }
}
}
impl SyllableCounter for TexSyllableCounter {
fn count_syllables(&self, word: &str) -> i64 {
self.hyphenator.count_syllables(word)
}
fn split_syllables(&self, word: &str) -> Vec<String> {
self.hyphenator.hyphenate(word)
}
}