[][src]Function common_substrings::get_substrings

pub fn get_substrings(
    input: Vec<&str>,
    min_occurrences: usize,
    min_length: usize
) -> Vec<Substring>

The function used to get all the common strings in the strings list,

Arguments

  • input - The target input string vector.
  • min_occurrences The minimal occurrence of the captured common substrings.
  • min_leng The minial length of the captured common substrings.

Example

 use common_substrings::get_substrings;
 let input_strings = vec!["java", "javascript", "typescript", "coffeescript", "coffee"];
 let result_substrings = get_substrings(input_strings, 2, 3);

which gives the result list of

Substring(sources: {2, 3}, name: escript, weight: 14)
Substring(sources: {1, 0}, name: java, weight: 8)
Substring(sources: {4, 3}, name: coffee, weight: 12)