Trait OovProviderPlugin

Source
pub trait OovProviderPlugin: Sync + Send {
    // Required methods
    fn set_up(
        &mut self,
        settings: &Value,
        config: &Config,
        grammar: &mut Grammar<'_>,
    ) -> SudachiResult<()>;
    fn provide_oov(
        &self,
        input_text: &InputBuffer,
        offset: usize,
        other_words: CreatedWords,
        result: &mut Vec<Node>,
    ) -> SudachiResult<usize>;
}
Expand description

Trait of plugin to provide oov node during tokenization

Required Methods§

Source

fn set_up( &mut self, settings: &Value, config: &Config, grammar: &mut Grammar<'_>, ) -> SudachiResult<()>

Loads necessary information for the plugin

Source

fn provide_oov( &self, input_text: &InputBuffer, offset: usize, other_words: CreatedWords, result: &mut Vec<Node>, ) -> SudachiResult<usize>

Generate a list of oov nodes offset - char idx

Trait Implementations§

Source§

impl PluginCategory for dyn OovProviderPlugin

Source§

type BoxType = Box<dyn OovProviderPlugin + Send + Sync>

Boxed type of the plugin. Should be Box.
Source§

type InitFnType = unsafe fn() -> Result<<dyn OovProviderPlugin as PluginCategory>::BoxType, SudachiError>

Type of the initialization function. It must take 0 arguments and return SudachiResult<Self::BoxType>.
Source§

fn configurations(cfg: &Config) -> &[Value]

Extract plugin configurations from the config
Source§

fn bundled_impl(name: &str) -> Option<Self::BoxType>

Create bundled plugin for plugin name Instead of full name like com.worksap.nlp.sudachi.ProlongedSoundMarkPlugin should handle only the short one: ProlongedSoundMarkPlugin Read more
Source§

fn do_setup( ptr: &mut Self::BoxType, settings: &Value, config: &Config, grammar: &mut Grammar<'_>, ) -> SudachiResult<()>

Perform initial setup. We can’t call set_up of the plugin directly in the default implementation of this method because we do not know the specific type yet

Implementors§