-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
get_top_sumgrams function not working #34
Comments
Hello @willmhowes, Thanks for reporting this. Can you please add the code which you ran to generate this error? I suspect you might have supplied the wrong type for stopword. Ensure to replicate the Python script example: import json
from sumgram.sumgram import get_top_sumgrams
doc_lst = [
{'id': 0, 'text': 'The eye of Category 4 Hurricane Harvey is now over Aransas Bay. A station at Aransas Pass run by the Texas Coastal Observing Network recently reported a sustained wind of 102 mph with a gust to 132 mph. A station at Aransas Wildlife Refuge run by the Texas Coastal Observing Network recently reported a sustained wind of 75 mph with a gust to 99 mph. A station at Rockport reported a pressure of 945 mb on the western side of the eye.'},
{'id': 1, 'text': 'Eye of Category 4 Hurricane Harvey is almost onshore. A station at Aransas Pass run by the Texas Coastal Observing Network recently reported a sustained wind of 102 mph with a gust to 120 mph.'},
{'id': 2, 'text': 'Hurricane Harvey has become a Category 4 storm with maximum sustained winds of 130 mph. Sustained hurricane-force winds are spreading onto the middle Texas coast.'}
]
'''
Use 'add_stopwords' to include list of additional stopwords not included in stopwords list (https://github.com/oduwsdl/sumgram/blob/0224fc9d54034a25e296dd1c43c09c76244fc3c2/sumgram/util.py#L31)
'''
params = {
'top_sumgram_count': 10,
'add_stopwords': ['image'],#<--- add stopwords here.
'no_rank_sentences': True,
'title': 'Top sumgrams for Hurricane Harvey text collection'
}
ngram = 2
sumgrams = get_top_sumgrams(doc_lst, ngram, params=params)
with open('sumgrams.json', 'w') as outfile:
json.dump(sumgrams, outfile) |
Thanks for the response, @anwala. To clarify, I ran the example python script from the README exactly as written and received the error posted above. Are you able to replicate? |
I've been able to successfully run sumgram. I got a different error, which I fixed in the main branch of sumgram. I wasn't able to reproduce your error. So I hope this fix works for you too. Kindly uninstall ( Good luck! |
Running the code from the README, specifically
sumgrams = get_top_sumgrams(doc_lst, ngram, params=params)
, returns the following exception:get_top_sumgrams
appears to be broken.The text was updated successfully, but these errors were encountered: