/// Transform the given text into integers for usage in `SAIS`.
Transform the given text into integers for usage in `SAIS`.
Transform the given text into integers for usage in ` SAIS ` .
fn transform_text<T: Integer + Unsigned + NumCast + Copy + Debug>(
    text: &[u8],
    alphabet: &Alphabet,
    sentinel_count: usize,
) -> Vec<T> {
    let sentinel = sentinel(text);
    let transform = RankTransform::new(alphabet);
    let offset = sentinel_count - 1;
    let mut transformed: Vec<T> = Vec::with_capacity(text.len());
    let mut s = sentinel_count;
    for &a in text.iter() {
        if a == sentinel {
            s -= 1;
            transformed.push(cast(s).unwrap());
        } else {
            transformed
                .push(cast(*(transform.ranks.get(a as usize)).unwrap() as usize + offset).unwrap());
        }
    }
    transformed
}
fn transform_text < T : Integer + Unsigned + NumCast + Copy + Debug > ( text : & [ u8 ] , alphabet : & Alphabet , sentinel_count : usize , ) -> Vec < T > { let sentinel = sentinel ( text ) ; let transform = RankTransform :: new ( alphabet ) ; let offset = sentinel_count - 1 ; let mut transformed : Vec < T > = Vec :: with_capacity ( text . len ( ) ) ; let mut s = sentinel_count ; for & a in text . iter ( ) { if a == sentinel { s -= 1 ; transformed . push ( cast ( s ) . unwrap ( ) ) ; } else { transformed . push ( cast ( * ( transform . ranks . get ( a as usize ) ) . unwrap ( ) as usize + offset ) . unwrap ( ) ) ; } } transformed }
Transform the given text into integers for usage in `SAIS`.
Transform the given text into integers for usage in ` SAIS ` .
text
&[u8]
alphabet
&Alphabet
sentinel_count
usize