pub fn similar_syllabary_strings(original: &str) -> Vec<String> {
        // For each character of the string, list out similar looking characters.
        // This yields from "GFT" => [['G', 'C', 'O'], ['F', 'E'], ['T', 'I']]
        let potential_chars: Vec<Vec<char>> = original
            .chars()
            .map(Self::similar_syllabary_chars)
            .collect();

        // Now produce the list of combinations.
        // [['G', 'C', 'O'], ['F', 'E'], ['T', 'I']] => ["GFT", "CFT", "OFT", ...]
        let mut results: Vec<String> = Vec::new();
        for group in potential_chars {
            if results.is_empty() {
                results = group.into_iter().map(|c| c.to_string()).collect();
            } else {
                // For each string in the list, make a new version for each next character.
                // ["G", "C", "O"] => ["GF", "GE", "CF", "CE", "OF", "OE"]
                results = results
                    .into_iter()
                    .flat_map(|in_progress| {
                        group.iter().map(move |c| {
                            let mut new_thing = in_progress.clone();
                            new_thing.push(*c);
                            new_thing
                        })
                    })
                    .collect();
            }
        }

        results
    }
/// Return a list of possible misspellings of the given syllabary string,
/// based on which characters look the most similar.
Return a list of possible misspellings of the given syllabary string,
based on which characters look the most similar.
Return a list of possible misspellings of the given syllabary string based on which characters look the most similar .
pub fn similar_syllabary_strings(original: &str) -> Vec<String> {
        // For each character of the string, list out similar looking characters.
        // This yields from "GFT" => [['G', 'C', 'O'], ['F', 'E'], ['T', 'I']]
        let potential_chars: Vec<Vec<char>> = original
            .chars()
            .map(Self::similar_syllabary_chars)
            .collect();
        // Now produce the list of combinations.
        // [['G', 'C', 'O'], ['F', 'E'], ['T', 'I']] => ["GFT", "CFT", "OFT", ...]
        let mut results: Vec<String> = Vec::new();
        for group in potential_chars {
            if results.is_empty() {
                results = group.into_iter().map(|c| c.to_string()).collect();
            } else {
                // For each string in the list, make a new version for each next character.
                // ["G", "C", "O"] => ["GF", "GE", "CF", "CE", "OF", "OE"]
                results = results
                    .into_iter()
                    .flat_map(|in_progress| {
                        group.iter().map(move |c| {
                            let mut new_thing = in_progress.clone();
                            new_thing.push(*c);
                            new_thing
                        })
                    })
                    .collect();
            }
        }
        results
    }
pub fn similar_syllabary_strings ( original : & str ) -> Vec < String > { // For each character of the string, list out similar looking characters. // This yields from "GFT" => [['G', 'C', 'O'], ['F', 'E'], ['T', 'I']] let potential_chars : Vec < Vec < char > > = original . chars ( ) . map ( Self :: similar_syllabary_chars ) . collect ( ) ; // Now produce the list of combinations. // [['G', 'C', 'O'], ['F', 'E'], ['T', 'I']] => ["GFT", "CFT", "OFT", ...] let mut results : Vec < String > = Vec :: new ( ) ; for group in potential_chars { if results . is_empty ( ) { results = group . into_iter ( ) . map ( | c | c . to_string ( ) ) . collect ( ) ; } else { // For each string in the list, make a new version for each next character. // ["G", "C", "O"] => ["GF", "GE", "CF", "CE", "OF", "OE"] results = results . into_iter ( ) . flat_map ( | in_progress | { group . iter ( ) . map ( move | c | { let mut new_thing = in_progress . clone ( ) ; new_thing . push ( * c ) ; new_thing } ) } ) . collect ( ) ; } } results }
Return a list of possible misspellings of the given syllabary string,
based on which characters look the most similar.
Return a list of possible misspellings of the given syllabary string based on which characters look the most similar .
original
&str