Skip to content

if len(word['solution']) > 1: TypeError: list indices must be integers or slices, not str #4

@nassera2014

Description

@nassera2014

Hi ;

Thank ypu for ypour great work . when i execute your code i get this error :

/home/nassera/PycharmProjects/MyProject/TM_FB/Arabycia.py:246: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if returnval is "pos": return str[1]
[nltk_data] Downloading package punkt to /home/nassera/nltk_data...
[nltk_data]   Package punkt is already up-to-date!
loading dictPrefixes ... loaded 299 entries
loading dictStems ... loaded 38600 lemmas and 82158 entries
loading dictSuffixes ... loaded 618 entries
Traceback (most recent call last):
  File "/home/nassera/PycharmProjects/MyProject/TM_FB/Arabycia.py", line 297, in <module>
    print(arabycia.analyze())
  File "/home/nassera/PycharmProjects/MyProject/TM_FB/Arabycia.py", line 17, in analyze
    self.find_ambiguity()
  File "/home/nassera/PycharmProjects/MyProject/TM_FB/Arabycia.py", line 134, in find_ambiguity
    if len(word['solution']) > 1:
TypeError: list indices must be integers or slices, not str

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions