TreeTokenizer

Struct TreeTokenizer 

Source
pub struct TreeTokenizer {
    pub universe: Universe,
    pub tree: HashMap<String, Lapper<u32, u32>>,
}
Expand description

A tokenizer that uses an interval tree to find overlaps

§Attributes

  • universe - the universe of regions
  • tree - the interval tree

§Methods

  • from - create a new TreeTokenizer from a bed file
  • tokenize_region - tokenize a region into the vocabulary of the tokenizer
  • tokenize_region_set - tokenize a region set into the vocabulary of the tokenizer
  • tokenize_bed_set - tokenize a bed set into the vocabulary of the tokenizer
  • unknown_token - get the unknown token

Fields§

§universe: Universe§tree: HashMap<String, Lapper<u32, u32>>

Implementations§

Trait Implementations§

Source§

impl From<&Path> for TreeTokenizer

Source§

fn from(value: &Path) -> Self

§Arguments
  • value - the path to the bed file
§Returns

A new TreeTokenizer

Source§

impl Tokenizer for TreeTokenizer

Source§

fn tokenize_region(&self, region: &Region) -> Option<TokenizedRegionSet<'_>>

§Arguments
  • region - the region to be tokenized
§Returns

A TokenizedRegionSet that corresponds to one or more regions in the tokenizers vocab (or universe).

Source§

fn tokenize_region_set( &self, region_set: &RegionSet, ) -> Option<TokenizedRegionSet<'_>>

Tokenize a region set into the vocabulary of the tokenizer Read more
Source§

fn padding_token(&self) -> Region

Source§

fn unknown_token(&self) -> Region

Source§

fn tokenize_bed_set( &self, bed_set: &BedSet, ) -> Option<Vec<TokenizedRegionSet<'_>>>

Tokenize a bed set into the vocabulary of the tokenizer 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.