Matching¶

class autocomplete.matching.ExactMatch¶

A class that implements exact matching, looking for results that contains the exact question sample.

async match(question: str, language: str = None)¶

Return a list of results obtained by applying the matching process.

Parameters:
  • question (str) – User input to match with database entries

  • language (str, optional) – Language of the question and answers

Returns:

List of dictionaries containing the matching results

Return type:

list of dict

class autocomplete.matching.FuzzyMatch(threshold: int = 100)¶

A class that implements fuzzy matching through levenshtein, return results with the lowest distance first. The levenshtein distance is defined as the number of changes required to get to the target string.

async match(question: str, language: str = None)¶

Return a list of results obtained by applying the matching process.

Parameters:
  • question (str) – User input to match with database entries

  • language (str, optional) – Language of the question and answers

Returns:

List of dictionaries containing the matching results

Return type:

list of dict

class autocomplete.matching.Matching(match_type: str)¶

Abstract class for matching classes

abstract async match(question: str, language: str = None)¶

Return a list of results obtained by applying the matching process.

Parameters:
  • question (str) – User input to match with database entries

  • language (str, optional) – Language of the question and answers

Returns:

List of dictionaries containing the matching results

Return type:

list of dict

class autocomplete.matching.SemanticMatch¶

A class that implements semantic similarity matching, return results with the lowest distance first. The distance is defined as the cosine distance between question and results embedding.

async match(question: str, language: str = None)¶

Return a list of results obtained by applying the matching process.

Parameters:
  • question (str) – User input to match with database entries

  • language (str, optional) – Language of the question and answers

Returns:

List of dictionaries containing the matching results

Return type:

list of dict

autocomplete.matching.INF = 0¶

Value for matches limit, equivalent to infinity (return all results)