re: Build a quick Summarizer with Python and NLTK VIEW POST

VIEW PARENT COMMENT VIEW FULL DISCUSSION

Hey! You may have a sentence that is lower than 12 characters. In this case, you can set the index of the word value to sentence[:10], or a lower number depending on your shortest sentence.

Lowering the number of characters used to hash the sentence value can bring some issues -- two sentences with the same 7,8,9 starting characters will then store/retrieve their value from the same index on the dictionary, that's why it's important to keep the sentence length for hashing as high as you can

any number i use gives the same error

sentenceValue[sentence[:2]] += wordValue[1]

IndexError: string index out of range

Interesting. For debugging it, I would print all your sentences and find if there's an empty one (or a very short one), I think that may be the issue.

Let me know if that works or if you found the issue

i am also facing string index out of range problemm.,,what is the issue

You may have a string that is less than your string length sentence[:2]. I would recommend printing the strings and see if this is the case

i have solved it..it was acctually puncutation problem..in my case...i just handle dot(.) character while giving words as value..

Could you please help me , i'm facing same problem here and i can't handle it , tahnk you.

code of conduct - report abuse