elm.ords.extraction.ngrams.sentence_ngram_containment

sentence_ngram_containment(original, test, n)[source]

Fraction of sentence ngrams from the test text found in the original.

Parameters:
  • original (str) – Original (superset) text. Ngrams from the test text will be checked against this text.

  • test (str) – Test (sub) text. Ngrams from this text will be searched for in the original text, and the fraction of these ngrams that are found in the original text will be returned.

  • n (int) – Number of words to include per ngram.

Returns:

float – Fraction of ngrams from the test input that were found in the original text. Always returns True if test has no ngrams.