[−][src]Struct parattice::parattice::PaRattice
Implementations
impl<'a> PaRattice<'a>
[src]
pub fn new(dict: Vec<Vec<Vec<&'a str>>>) -> PaRattice<'a>
[src]
Returns PaRattice with the given paraphrase corpus.
Arguments
dict
- A paraphrase corpus
Example
use parattice::PaRattice; let paradict = vec![ vec![ vec!["blood", "stem", "cell"], vec!["造血", "幹", "細胞"], vec!["hematopoietic", "stem", "cell"], ], vec![ vec!["造血", "幹", "細胞", "移植"], vec!["hematopoietic", "stem", "cell", "transplantation"], ], vec![vec!["stem", "cell"], vec!["幹", "細胞"]], vec![ vec!["幹", "細胞", "移植"], vec!["rescue", "transplant"], vec!["stem", "cell", "rescue"], ], vec![vec!["rescue"], vec!["救命"]], vec![vec!["blood"], vec!["血液"]], ]; let parattice = PaRattice::new(paradict);
pub fn get_lattice(
&self,
words: &[&'a str],
shrink: bool,
max_depth: usize
) -> Lattice<'a>
[src]
&self,
words: &[&'a str],
shrink: bool,
max_depth: usize
) -> Lattice<'a>
Returns a recursive paraphrase lattice of the given sentence.
Arguments
words
- A sentenceshrink
- If true, duplicated edges are shrinkedmax_depth
- A number of recursion
Example
use parattice::PaRattice; let paradict = vec![ vec![ vec!["blood", "stem", "cell"], vec!["造血", "幹", "細胞"], vec!["hematopoietic", "stem", "cell"], ], vec![ vec!["造血", "幹", "細胞", "移植"], vec!["hematopoietic", "stem", "cell", "transplantation"], ], vec![vec!["stem", "cell"], vec!["幹", "細胞"]], vec![ vec!["幹", "細胞", "移植"], vec!["rescue", "transplant"], vec!["stem", "cell", "rescue"], ], vec![vec!["rescue"], vec!["救命"]], vec![vec!["blood"], vec!["血液"]], ]; let parattice = PaRattice::new(paradict); let words = vec!["造血", "幹", "細胞", "移植"]; let lattice = parattice.get_lattice(&words, true, 2);
Auto Trait Implementations
impl<'a> RefUnwindSafe for PaRattice<'a>
impl<'a> Send for PaRattice<'a>
impl<'a> Sync for PaRattice<'a>
impl<'a> Unpin for PaRattice<'a>
impl<'a> UnwindSafe for PaRattice<'a>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,