[−][src]Struct parattice::lattice::Lattice
Fields
lattice: Vec<LatticeNode<'a>>
trunk: HashMap<usize, usize>
capacity: usize
Implementations
impl<'a> Lattice<'a>
[src]
pub fn new_from_bytes(data: &'a [u8]) -> Lattice<'a>
[src]
Returns a lattice from the given binary data.
Arguments
data
- A byte array
Example
use parattice::PaRattice; use parattice::Lattice; 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); let bytes = lattice.to_bytes(); let new_lattice = Lattice::new_from_bytes(&bytes);
pub fn to_bytes(&self) -> Vec<u8>
[src]
Returns binary data of the lattice.
Example
use parattice::PaRattice; use parattice::Lattice; 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); let bytes = lattice.to_bytes(); let new_lattice = Lattice::new_from_bytes(&bytes);
pub fn dump_dot(&self, is_numbered: bool) -> String
[src]
Returns graphviz of the lattice.
Arguments
is_numbered
- If true, node numbers are printed.
Example
use parattice::PaRattice; use parattice::Lattice; 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); let dot = lattice.dump_dot(true); println!("{}", dot);
pub fn get_trunk_span(
&self,
path: Vec<(&'a str, usize)>
) -> Vec<(&'a str, usize)>
[src]
&self,
path: Vec<(&'a str, usize)>
) -> Vec<(&'a str, usize)>
Returns a trunk path of the given path.
Arguments
path
- A path of the lattice. (e.g. a result of LatticeKMP)
pub fn get_trunk_spans(&self) -> Vec<(usize, usize)>
[src]
Returns trunk node IDs for each node ID.
pub fn dump_for_search_index(&self) -> Vec<SearchIndexNode>
[src]
Returns a vector of SearchIndexNode for the search index such as Elasticsearch.
Trait Implementations
impl<'a> Debug for Lattice<'a>
[src]
impl<'a> Eq for Lattice<'a>
[src]
impl<'a> PartialEq<Lattice<'a>> for Lattice<'a>
[src]
impl<'a> StructuralEq for Lattice<'a>
[src]
impl<'a> StructuralPartialEq for Lattice<'a>
[src]
Auto Trait Implementations
impl<'a> RefUnwindSafe for Lattice<'a>
impl<'a> Send for Lattice<'a>
impl<'a> Sync for Lattice<'a>
impl<'a> Unpin for Lattice<'a>
impl<'a> UnwindSafe for Lattice<'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>,