question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"IndexError: string index out of range" on trying to stem the word "oing"

See original GitHub issue

Easy to reproduce:

>>> from nltk import PorterStemmer
>>> stemmer = PorterStemmer()
>>> stemmer.stem('oing')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/peterbe/virtualenvs/songsearch/lib/python3.5/site-packages/nltk/stem/porter.py", line 665, in stem
    stem = self._step1b(stem)
  File "/Users/peterbe/virtualenvs/songsearch/lib/python3.5/site-packages/nltk/stem/porter.py", line 376, in _step1b
    lambda stem: (self._measure(stem) == 1 and
  File "/Users/peterbe/virtualenvs/songsearch/lib/python3.5/site-packages/nltk/stem/porter.py", line 258, in _apply_rule_list
    if suffix == '*d' and self._ends_double_consonant(word):
  File "/Users/peterbe/virtualenvs/songsearch/lib/python3.5/site-packages/nltk/stem/porter.py", line 214, in _ends_double_consonant
    word[-1] == word[-2] and
IndexError: string index out of range
>>> import nltk
>>> nltk.__version__
'3.2.2'

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:2
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
g-laz77commented, May 8, 2017

So, has the issue been resolved?

2reactions
jayvdbcommented, Mar 29, 2017

Close as fixed?

Read more comments on GitHub >

github_iconTop Results From Across the Web

IndexError: string index out of range - Net-Informations.Com
The string index out of range means that the index you are trying to access does not exist. In a string, that means...
Read more >
How to fix IndexError: String index out of range - Python
I am trying to make a parser for my text adventure. I used a text file called test.txt. I keep getting IndexError: string...
Read more >
Python error: string index out of range python - Intellipaat
The string index out of range means that the index you are trying to access does not exist. In a string, that means...
Read more >
IndexError: String Index out of Range - The Renegade Coder
According to Python documentation, an IndexError is raised whenever “a sequence subscript is out of range.” Of course, what does that really ...
Read more >
Python TypeError: string index out of range Solution
The “TypeError: string index out of range” error is raised when you try to access an item at an index position that does...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found