Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
isnowfy committed Mar 19, 2014
1 parent 1a28cac commit 4512349
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2013 isnowfy
Copyright (c) 2013-2014 isnowfy

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
Expand Down
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,11 @@ s = SnowNLP(text)
s.keywords(3) # [u'语言', u'自然', u'计算机']
s.summary(3) # [u'自然语言处理是一门融语言学、计算机科学、
s.summary(3) # [u'因而它是计算机科学的一部分',
# u'自然语言处理是一门融语言学、计算机科学、
# 数学于一体的科学',
# u'自然语言处理是计算机科学领域与人工智能
# 领域中的一个重要方向',
# u'而在于研制能有效地实现自然语言通信的计
# 算机系统']
# 领域中的一个重要方向']
s.sentences
s = SnowNLP([[u'这篇', u'文章'],
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def read(fname):

setup(
name='snownlp',
version='0.9.8.2',
version='0.9.9',
description='Python library for processing Chinese text',
author='isnowfy',
url='https://github.com/isnowfy/snownlp',
Expand Down
6 changes: 3 additions & 3 deletions snownlp/summary/textrank.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ def __init__(self, docs):
self.top = []

def solve(self):
for doc in self.docs:
for cnt, doc in enumerate(self.docs):
scores = self.bm25.simall(doc)
self.weight.append(scores)
self.weight_sum.append(sum(scores))
self.weight_sum.append(sum(scores)-scores[cnt])
self.vertex.append(1.0)
for _ in range(self.max_iter):
m = []
Expand All @@ -32,7 +32,7 @@ def solve(self):
for j in range(self.D):
if j == i or self.weight_sum[j] == 0:
continue
m[-1] += (self.d*self.weight[i][j]
m[-1] += (self.d*self.weight[j][i]
/ self.weight_sum[j]*self.vertex[j])
if abs(m[-1] - self.vertex[i]) > max_diff:
max_diff = abs(m[-1] - self.vertex[i])
Expand Down

0 comments on commit 4512349

Please sign in to comment.