[][src]Struct finalfusion::subword::ExplicitIndexer

pub struct ExplicitIndexer { /* fields omitted */ }

Indexer for explicitly stored NGrams.

Methods

impl ExplicitIndexer[src]

pub fn ngrams(&self) -> &[String][src]

impl ExplicitIndexer[src]

pub fn new(ngrams: impl Into<Vec<String>>) -> Self[src]

Construct a new explicit indexer.

Panics when there are duplicate ngrams.

pub fn new_with_indices(ngram_tuples: Vec<(String, u64)>) -> Self[src]

Construct a new explicit indexer with given indices.

The (String, u64) tuples resemble the original subword -> index mapping. This mapping does not need to be perfect, i.e. multiple subwords can map to the same index as it is common with bucketed indexing.

This constructor numbers the original indices as they appear and assigns a new index accordingly. After construction, subwords that originally had the same index will still be indexed by a common number. It is guaranteed that the new indices cover (0..n_original_indices) where n_original_indices is the number of unique indices in the subword -> index mapping.

Panics when there are duplicate ngrams.

Trait Implementations

impl Clone for ExplicitIndexer[src]

impl Debug for ExplicitIndexer[src]

impl Eq for ExplicitIndexer[src]

impl Indexer for ExplicitIndexer[src]

impl PartialEq<ExplicitIndexer> for ExplicitIndexer[src]

impl StructuralEq for ExplicitIndexer[src]

impl StructuralPartialEq for ExplicitIndexer[src]

Auto Trait Implementations

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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,