I am running the following code
from rake_nltk import rake
import operator
stoppath = 'data/stoplists/SmartStoplist.txt'
rake_object = rake.Rake("SmartStopList.txt",5,3,2)
But when i run the last line i get the below error
rake_object = rake.Rake("SmartStopList.txt",5,3,2)
Traceback (most recent call last):
File "<ipython-input-12-595e49e89adb>", line 1, in <module>
rake_object = rake.Rake("SmartStopList.txt",5,3,2)
File "C:\Users\kris\Anaconda3\lib\site-packages\rake_nltk\rake.py", line 64, in __init__
self.to_ignore = set(chain(self.stopwords, self.punctuations))
TypeError: 'int' object is not iterable
I am nt sure why am i getting this error. Need help on the same
Have a look at the __init__
def __init__(
self,
stopwords=None,
punctuations=None,
language="english",
ranking_metric=Metric.DEGREE_TO_FREQUENCY_RATIO,
max_length=100000,
min_length=1,
)
The 5 is going to punctuations
parameter which is expected to be a list, not to ranking_metric
. Use the parameter names
rake_object = rake.Rake("SmartStopList.txt", ranking_metric=5, max_length=3, min_length=2)
By the way stopwords
is also expected to be a list, you are sending string.