Skip to content
Browse files


  • Loading branch information...
boudinfl committed Apr 16, 2019
1 parent 89eb550 commit 6d94fc1be84721724a5c2d0db63c8763aa4d566f
Showing with 9 additions and 16 deletions.
  1. +9 −16 tests/
@@ -5,41 +5,34 @@

import pke

text = u"Compatibility of systems of linear constraints over the set of natural\
numbers. Criteria of compatibility of a system of linear Diophantine equations\
, strict inequations, and nonstrict inequations are considered. Upper bounds fo\
r components of a minimal set of solutions and algorithms of construction of mi\
nimal generating sets of solutions for all types of systems are given. These cr\
iteria and the corresponding algorithms for constructing a minimal supporting s\
et of solutions can be used in solving all the considered types systems and sys\
tems of mixed types."

test_file = 'tests/data/1939.xml'
pos = {'NOUN', 'PROPN', 'ADJ'}

def test_textrank():
"""Test TextRank for keyword extraction using original paper's example."""

extractor = pke.unsupervised.TextRank()
extractor.candidate_weighting(top_percent=.33, pos=pos)
keyphrases = [k for k, s in extractor.get_n_best(n=3)]
assert keyphrases == ['linear diophantine',
'natural numbers',
'upper bounds',

def test_textrank_with_candidate_selection():
"""Test TextRank with longest-POS-sequences candidate selection."""

extractor = pke.unsupervised.TextRank()
keyphrases = [k for k, s in extractor.get_n_best(n=3)]
keyphrases = [k
for k, s in extractor.get_n_best(n=3)]
assert keyphrases == ['linear diophantine equations',
'minimal generating sets',
'mixed types']
'minimal supporting set',
'nonstrict inequations']

if __name__ == '__main__':

0 comments on commit 6d94fc1

Please sign in to comment.
You can’t perform that action at this time.