pub fn is_a_unique_acronym(subject: &Text, acronym_size: usize) -> bool {
    let mut count = 0;
    let len = subject.len();

    // Assume one acronym every (at most) ACRONYM_FREQUENCY characters
    // on average. This is done to filter long paths
    if len > (ACRONYM_FREQUENCY * acronym_size) {
        return false;
    }

    let mut index = 0;

    while index < len {
        if is_start_of_word(subject, index) {
            // only start of word graphemes are considered part of an acronym
            count += 1;

            // If the acronym count is more than acronym_size
            // then we do not have 1:1 relationship
            if count > acronym_size {
                return false;
            }
        }

        index += 1;
    }

    true
}
/// Check whether the subject has a unique acronym of the given size
Check whether the subject has a unique acronym of the given size
Check whether the subject has a unique acronym of the given size
pub fn is_a_unique_acronym(subject: &Text, acronym_size: usize) -> bool {
    let mut count = 0;
    let len = subject.len();
    // Assume one acronym every (at most) ACRONYM_FREQUENCY characters
    // on average. This is done to filter long paths
    if len > (ACRONYM_FREQUENCY * acronym_size) {
        return false;
    }
    let mut index = 0;
    while index < len {
        if is_start_of_word(subject, index) {
            // only start of word graphemes are considered part of an acronym
            count += 1;
            // If the acronym count is more than acronym_size
            // then we do not have 1:1 relationship
            if count > acronym_size {
                return false;
            }
        }
        index += 1;
    }
    true
}
pub fn is_a_unique_acronym ( subject : & Text , acronym_size : usize ) -> bool { let mut count = 0 ; let len = subject . len ( ) ; // Assume one acronym every (at most) ACRONYM_FREQUENCY characters // on average. This is done to filter long paths if len > ( ACRONYM_FREQUENCY * acronym_size ) { return false ; } let mut index = 0 ; while index < len { if is_start_of_word ( subject , index ) { // only start of word graphemes are considered part of an acronym count += 1 ; // If the acronym count is more than acronym_size // then we do not have 1:1 relationship if count > acronym_size { return false ; } } index += 1 ; } true }
Check whether the subject has a unique acronym of the given size
Check whether the subject has a unique acronym of the given size
subject
&Text
acronym_size
usize