question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ImportError: cannot import name 'degree_centrality_scores' from 'lexrank'

See original GitHub issue

Got this issue on MacBook Pro. Python version: 3.7.4

Reproducibility:

python3 -m venv env
source env/bin/activate
pip3 install lexrank
python3 -c "from lexrank import degree_centrality_scores"

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
hansharhoffcommented, May 13, 2022

I endend up using this example which has copied the relevant code to a single file:

https://github.com/UKPLab/sentence-transformers/tree/master/examples/applications/text-summarization

1reaction
LozanoAlvarezbcommented, Jan 15, 2021

Currently, the degree_centrality_scores function’s code is only on dev. So the easiest would be to just clone the repository somewhere near your own code, checkout dev, and just import the function like that:

import sys
sys.path.append("../../lexrank/")
from lexrank.lexrank import  degree_centrality_score

Just for anyone who is here with the same problem

The import is

from lexrank.lexrank import degree_centrality_scores

with an “s”

Also, in the README there is a typo. Change every instance of “thershold” for “threshold”

Read more comments on GitHub >

github_iconTop Results From Across the Web

cannot import name 'degree_centrality_scores' from 'lexrank ...
Hi all I initially got this error: "ModuleNotFoundError: No module named 'LexRank'" So I searched online and used 'pip install lexrank' ...
Read more >
lexrank - PyPI
LexRank is an unsupervised approach to text summarization based on graph-based centrality scoring of sentences.
Read more >
LexRank: Graph-based Lexical Centrality as Salience in Text ...
In this paper, we will take graph-based methods in NLP one step further. We will discuss how random walks on sentence-based graphs can...
Read more >
ImportError: cannot import name - python - Stack Overflow
The problem is that you have a circular import: in app.py from mod_login import mod_login. in mod_login.py from app import app. This is...
Read more >
How to Fix : “ImportError: Cannot import name X” in Python
In Python "ImportError: cannot import name" error generally occurs when the imported class is not accessible, or the imported class is in a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found