IndexBuilder

Struct IndexBuilder 

Source
pub struct IndexBuilder { /* private fields */ }
Expand description

A builder for opening or creating an Index.

Implementations§

Source§

impl IndexBuilder

Source

pub fn new() -> IndexBuilder

Create a new builder with a default configuration.

Source

pub fn open<P1: AsRef<Path>, P2: AsRef<Path>>( &self, data_dir: P1, index_dir: P2, ) -> Result<Index>

Use the current configuration to open an existing index. If the index does not exist, or if there was a problem opening it, then this returns an error.

Generally, this method is cheap to call. It opens some file descriptors, but otherwise does no work.

data_dir should be the directory containing decompressed IMDb tsv files. See: https://www.imdb.com/interfaces/

index_dir should be the directory containing a previously created index using Index::create.

Note that settings for index creation are ignored.

Source

pub fn create<P1: AsRef<Path>, P2: AsRef<Path>>( &self, data_dir: P1, index_dir: P2, ) -> Result<Index>

Use the current configuration to create a new index.

Calling this method is expensive, and one should expect this to take dozens of seconds or more to complete.

data_dir should be the directory containing decompressed IMDb tsv files. See: https://www.imdb.com/interfaces/

index_dir should be the directory containing a previously created index using Index::create.

This will overwrite any previous index that may have existed in index_dir.

Source

pub fn ngram_type(&mut self, ngram_type: NgramType) -> &mut IndexBuilder

Set the type of ngram generation to use.

The default type is Window.

Source

pub fn ngram_size(&mut self, ngram_size: usize) -> &mut IndexBuilder

Set the ngram size on this index.

When creating an index, ngrams with this size will be used.

Trait Implementations§

Source§

impl Debug for IndexBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for IndexBuilder

Source§

fn default() -> IndexBuilder

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.