pub trait PathRewritePlugin: Sync + Send {
// Required methods
fn set_up(
&mut self,
settings: &Value,
config: &Config,
grammar: &Grammar<'_>,
) -> SudachiResult<()>;
fn rewrite(
&self,
text: &InputBuffer,
path: Vec<ResultNode>,
lattice: &Lattice,
) -> SudachiResult<Vec<ResultNode>>;
}
Expand description
Trait of plugin to rewrite the path from lattice
Required Methods§
sourcefn set_up(
&mut self,
settings: &Value,
config: &Config,
grammar: &Grammar<'_>,
) -> SudachiResult<()>
fn set_up( &mut self, settings: &Value, config: &Config, grammar: &Grammar<'_>, ) -> SudachiResult<()>
Loads necessary information for the plugin
sourcefn rewrite(
&self,
text: &InputBuffer,
path: Vec<ResultNode>,
lattice: &Lattice,
) -> SudachiResult<Vec<ResultNode>>
fn rewrite( &self, text: &InputBuffer, path: Vec<ResultNode>, lattice: &Lattice, ) -> SudachiResult<Vec<ResultNode>>
Returns a rewritten path
Trait Implementations§
source§impl PluginCategory for dyn PathRewritePlugin
impl PluginCategory for dyn PathRewritePlugin
source§type BoxType = Box<dyn PathRewritePlugin + Sync + Send>
type BoxType = Box<dyn PathRewritePlugin + Sync + Send>
Boxed type of the plugin. Should be Box.
source§type InitFnType = unsafe fn() -> Result<<dyn PathRewritePlugin as PluginCategory>::BoxType, SudachiError>
type InitFnType = unsafe fn() -> Result<<dyn PathRewritePlugin 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]
fn configurations(cfg: &Config) -> &[Value]
Extract plugin configurations from the config