Skip to content

Exception has occurred: AttributeError // module 'pytextrank' has no attribute 'TextRank' #263

Discussion options

You must be logged in to vote

Hi @isabel-martin-pineiro ,

The way to use a spaCy pipeline is different. In the code shown above, the tr = pytextrank.TextRank() kind of pattern is not supported by spaCy pipelines.

If I understand your use case correctly, instead a typical use would be more like:

import spacy
import pytextrank

# load the language model needed
nlp = spacy.load("es_core_news_sm")  # or replace with another for `es`

# configure the stop words
# see:
# https://derwen.ai/docs/ptr/sample/#stop-words
# https://derwen.ai/docs/ptr/ref/#__init__-method
es_stopwords = "path/to/stop/words/file"  # replace with file path

nlp.add_pipe(
    "textrank",
    config = {
        "stopwords": es_stopwords,
    },
)

# g…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@isabel-martin-pineiro
Comment options

Answer selected by ceteri
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants