[][src]Struct parattice::parattice::PaRattice

pub struct PaRattice<'a> { /* fields omitted */ }

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]

Returns a recursive paraphrase lattice of the given sentence.

Arguments

  • words - A sentence
  • shrink - If true, duplicated edges are shrinked
  • max_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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.