From cc4944bc3ce1a170c59662895d00ebe2c667ad26 Mon Sep 17 00:00:00 2001 From: Sergio Grau Puerto Date: Tue, 11 Sep 2012 16:25:27 +0100 Subject: [PATCH] Checking input is string or list of strings --- keywords/keywords.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/keywords/keywords.py b/keywords/keywords.py index 6a019b9..5245c1c 100644 --- a/keywords/keywords.py +++ b/keywords/keywords.py @@ -17,7 +17,11 @@ 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: + listSentences = input for line in input: for w in line.split(): w = w.lower()