Skip to content

Commit

Permalink
Merge pull request #111 from pavlin99th/patch-1
Browse files Browse the repository at this point in the history
Fix terms overlap test in doc.to_terms_list
  • Loading branch information
bdewilde authored Jun 15, 2017
2 parents a7ad803 + d6f3d3d commit 5b91cf7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions tests/test_readme.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ def test_term_counting(self):
# sort by term ascending, then count descending
observed_2 = sorted(bot.items(), key=itemgetter(1, 0), reverse=True)[:10]
expected_2 = [
('nation', 6), ('world', 4), ('u.s.', 4), ('incarceration', 4),
('decade', 4), ('system', 3), ('state', 3), ('record', 3),
('problem', 3), ('people', 3)]
('nation', 6), ('world', 4), ('incarceration', 4), ('system', 3),
('state', 3), ('problem', 3), ('people', 3), ('minimum', 3),
('mandatory', 3), ('lead', 3)]
self.assertEqual(observed_1, expected_1)
self.assertEqual(observed_2, expected_2)
2 changes: 1 addition & 1 deletion textacy/doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ def to_terms_list(self, ngrams=(1, 2, 3), named_entities=True,
if n == 1:
terms.append(
(word for word in textacy.extract.words(self, **ngram_kwargs)
if (word.idx, word.idx + 1) not in ent_idxs))
if (word.i, word.i + 1) not in ent_idxs))
else:
terms.append(
(ngram for ngram in textacy.extract.ngrams(self, n, **ngram_kwargs)
Expand Down

0 comments on commit 5b91cf7

Please sign in to comment.