pub fn score_pattern(
    count: usize,
    len: usize,
    same_case: usize,
    is_start: bool,
    is_end: bool,
) -> f32 {
    let mut sc = count;
    let mut bonus = 6;

    if same_case == count {
        bonus += 2;
    }

    if is_start {
        bonus += 3;
    }

    if is_end {
        bonus += 1;
    }

    if count == len {
        if is_start {
            if same_case == len {
                sc += 2;
            } else {
                sc += 1;
            }
        }

        if is_end {
            bonus += 1;
        }
    }

    (same_case + (sc * (sc + bonus))) as f32
}
/// Shared logic to calculate scores in different scenarios:
///   * exact match
///   * acronyms
///   * consecutive matches
///
/// Ensure that the pattern length dominates the score, then refine it
/// to take into account case sensitive matches.
///
/// It also takes into account structural quality of the pattern with word
/// boundaries (start and end).
Shared logic to calculate scores in different scenarios:
exact match
acronyms
consecutive matches

Ensure that the pattern length dominates the score, then refine it
to take into account case sensitive matches.

It also takes into account structural quality of the pattern with word
boundaries (start and end).
Shared logic to calculate scores in different scenarios : exact match acronyms consecutive matches Ensure that the pattern length dominates the score then refine it to take into account case sensitive matches . It also takes into account structural quality of the pattern with word boundaries ( start and end ) .
pub fn score_pattern(
    count: usize,
    len: usize,
    same_case: usize,
    is_start: bool,
    is_end: bool,
) -> f32 {
    let mut sc = count;
    let mut bonus = 6;
    if same_case == count {
        bonus += 2;
    }
    if is_start {
        bonus += 3;
    }
    if is_end {
        bonus += 1;
    }
    if count == len {
        if is_start {
            if same_case == len {
                sc += 2;
            } else {
                sc += 1;
            }
        }
        if is_end {
            bonus += 1;
        }
    }
    (same_case + (sc * (sc + bonus))) as f32
}
pub fn score_pattern ( count : usize , len : usize , same_case : usize , is_start : bool , is_end : bool , ) -> f32 { let mut sc = count ; let mut bonus = 6 ; if same_case == count { bonus += 2 ; } if is_start { bonus += 3 ; } if is_end { bonus += 1 ; } if count == len { if is_start { if same_case == len { sc += 2 ; } else { sc += 1 ; } } if is_end { bonus += 1 ; } } ( same_case + ( sc * ( sc + bonus ) ) ) as f32 }
Shared logic to calculate scores in different scenarios:
 exact match
 acronyms
 consecutive matches
Shared logic to calculate scores in different scenarios : exact match acronyms consecutive matches
count
usize
len
usize
same_case
usize
is_start
bool
is_end
bool