Skip to content

IndexError at snowball.py (SpanishStemmer) #85

@edelgadop

Description

@edelgadop

Error:

File "D:\...\summa\preprocessing\snowball.py", line 3510, in stem if word[-2:] == "gu" and rv[-1] == "u": IndexError: string index out of range

The issue is in the SpanishStemmer, in this section:

 # STEP 3: Residual suffix
        for suffix in self.__step3_suffixes:
            if rv.endswith(suffix):
                if suffix in ("e", "\xE9"):
                    word = word[:-len(suffix)]
                    rv = rv[:-len(suffix)]

                    if word[-2:] == "gu" and rv[-1] == "u":
                        word = word[:-1]
                else:
                    word = word[:-len(suffix)]
                break

If the 'rv' string has length == 1 , the line:

rv = rv[:-len(suffix)]

at runtime is trying to do

rv = rv[:-1]

which is a statement that gives an empty list as a result and makes this check fail:

 if word[-2:] == "gu" and rv[-1] == "u":

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions