expected = [
"new york times jerusalem bureau", "new york times", "friedman",
"foreign reporting", "international reporting"]
observed = [
term for term, _
in keyterms.singlerank(self.spacy_doc, normalize="lower", n_keyterms=5)]
self.assertEqual(len(expected), len(observed))
// can"t do this owing to randomness of results
// for e, o in zip(expected, observed):
// self.assertEqual(e, o)
for term in observed:
self.assertEqual(term, term.lower())
def test_singlegrank_norm_none(self):
expected = [
"New York Times Jerusalem", "New York Times", "Friedman",
"Pulitzer Prize", "foreign reporting"]