Navigation Menu

Skip to content

Commit

Permalink
Reading file directly
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergio Grau Puerto committed Sep 12, 2012
1 parent 45c51f6 commit b43f964
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions keywords/keywords.py
Expand Up @@ -17,8 +17,8 @@ def keywords_and_ngrams(input, nKeywords=100, thresholdLL=19, nBigrams=25, thres
fdistText = defaultdict(int)
sumText = 0
listWords = []

listSentences = []

if isinstance(input,str):
listSentences = [input]
else:
Expand Down Expand Up @@ -73,6 +73,6 @@ def keywords_and_ngrams(input, nKeywords=100, thresholdLL=19, nBigrams=25, thres
if len(sys.argv) < 2:
sys.stderr.write("Usage: python %s <text.txt>\n" % (sys.argv[0],))
else:
d = keywords_and_ngrams(open(os.path.join(os.path.dirname(__file__), sys.argv[1]),"r").readlines(), 100, 19, 25, 2)
d = keywords_and_ngrams(open(sys.argv[1]),"r").readlines(), 100, 19, 25, 2)
print json.dumps(d)

0 comments on commit b43f964

Please sign in to comment.