-
Notifications
You must be signed in to change notification settings - Fork 103
Open
Description
when i run the code the result was 0 for all words
first issue is idfDict = dict.fromkeys(docList[0].keys(), 0)
i changed it to idfDict = dict.fromkeys(list(wordDict.keys())[0], 0)
OR idfDict = dict.fromkeys(wordDict.keys()), 0)
_second the problem comes from the computeidf func
AttributeError Traceback (most recent call last)
in
4 idfDict = dict.fromkeys(list(wordDict.keys())[0], 0)
5 for doc in wordDict:
----> 6 for word, val in doc.items():
7 if val > 0:
8 idfDict[word] += 1
AttributeError: 'str' object has no attribute 'items'_
str here means the doc
Metadata
Metadata
Assignees
Labels
No labels