NGrams — super-collator 0.0.2 documentation

# NGrams

This module implements the NGrams class.

class NGrams(user_data=None)

  A class that compares two strings using N-Grams.

  __init__(user_data=None)
  load(s: str, n: int) → super_collator.ngrams.NGrams

    Split a string into N-Grams.

    Parameters

      - s – the string to split into N-Grams

      - n – puts the N in N-Grams

  __str__() → str

    Return str(self).

  static similarity(a: super_collator.ngrams.NGrams, b: super_collator.ngrams.NGrams) → float

    Return similarity between two NGrams objects.

    The similarity score is 2 times the count of common N-Grams divided by the total count of N-Grams.