<reponame>kingwongf/finBERT10K
import spacy
import pytextrank

# example text
text = "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 " \
       "for components of a minimal set of solutions and algorithms of construction of" \
       " minimal generating sets of solutions for all types of systems are given. " \
       "These criteria and the corresponding algorithms for constructing a minimal supporting set of " \
       "solutions can be used in solving all the considered types systems and systems of mixed types."

# load a spaCy model, depending on language, scale, etc.
nlp = spacy.load("en_core_web_sm")

# add PyTextRank to the spaCy pipeline
tr = pytextrank.TextRank()
nlp.add_pipe(tr.PipelineComponent, name="textrank", last=True)

doc = nlp(text)

# examine the top-ranked phrases in the document
for p in doc._.phrases:
    print("{:.4f} {:5d}  {}".format(p.rank, p.count, p.text))
    print(p.chunks)
import spacy
import pytextrank

# example text
text = "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 " \
       "for components of a minimal set of solutions and algorithms of construction of" \
       " minimal generating sets of solutions for all types of systems are given. " \
       "These criteria and the corresponding algorithms for constructing a minimal supporting set of " \
       "solutions can be used in solving all the considered types systems and systems of mixed types."

# load a spaCy model, depending on language, scale, etc.
nlp = spacy.load("en_core_web_sm")

# add PyTextRank to the spaCy pipeline
tr = pytextrank.TextRank()
nlp.add_pipe(tr.PipelineComponent, name="textrank", last=True)

doc = nlp(text)

# examine the top-ranked phrases in the document
for p in doc._.phrases:
    print("{:.4f} {:5d}  {}".format(p.rank, p.count, p.text))
    print(p.chunks)
# example text # load a spaCy model, depending on language, scale, etc. # add PyTextRank to the spaCy pipeline # examine the top-ranked phrases in the document