Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

textrank算法的困惑,请解惑,非常感谢! #30

Closed
37814084 opened this issue Jan 29, 2015 · 2 comments
Closed

textrank算法的困惑,请解惑,非常感谢! #30

37814084 opened this issue Jan 29, 2015 · 2 comments

Comments

@37814084
Copy link

您好,关于textrank算法中,感觉有点问题,以keywordTextRank为例,
当计算节点k的rank值时,您的代码是
for k, v in self.words.items():
m[k] = 1-self.d
for j in v:
if k == j or len(self.words[j]) == 0:
continue
m[k] += (self.d/len(self.words[j])*self.vertex[j])
if abs(m[k] - self.vertex[k]) > max_diff:
max_diff = abs(m[k] - self.vertex[k])
根据k,v的关系,v中包含的是指向节点k的所有节点集合,如果这样,在内循环中的len(self.words[j]这里算的是节点j的入度,即指向节点j的数量。但实际的textrank算法中,这里应该是节点j的出度,即节点j外链接的数量。请问作者,这里的代码是否有问题?感谢!

@isnowfy
Copy link
Owner

isnowfy commented Jan 29, 2015

我这里用的都是双向连接,所以入度和出度都是一样的

@isnowfy isnowfy closed this as completed Jan 29, 2015
@37814084
Copy link
Author

恩,谢谢,原来您这里建的是无向图,我没搞清楚。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants