Skip to content

IndexError when parsing 'e and e' #66

Closed

Description

@fjsj
from nameparser import HumanName
HumanName('e and e')

gives:

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-11-7c118e4228d6> in <module>()
----> 1 HumanName('e and e')

/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nameparser/parser.pyc in __init__(self, full_name, constants, encoding, string_format)
     79         self.string_format = string_format or self.C.string_format
     80         # full_name setter triggers the parse
---> 81         self.full_name = full_name
     82 
     83     def __iter__(self):

/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nameparser/parser.pyc in full_name(self, value)
    357         if isinstance(value, binary_type):
    358             self._full_name = value.decode(self.ENCODING)
--> 359         self.parse_full_name()
    360 
    361     def collapse_whitespace(self, string):

/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nameparser/parser.pyc in parse_full_name(self)
    452             #            part[0]
    453 
--> 454             pieces = self.parse_pieces(parts)
    455             p_len = len(pieces)
    456             for i, piece in enumerate(pieces):

/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nameparser/parser.pyc in parse_pieces(self, parts, additional_parts_count)
    616                     continue
    617 
--> 618         return self.join_on_conjunctions(output, additional_parts_count)
    619 
    620     def join_on_conjunctions(self, pieces, additional_parts_count=0):

/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nameparser/parser.pyc in join_on_conjunctions(self, pieces, additional_parts_count)
    694             if i is 0:
    695                 new_piece = " ".join(pieces[i:i+2])
--> 696                 if self.is_title(pieces[i+1]):
    697                     # when joining to a title, make new_piece a title too
    698                     self.C.titles.add(new_piece)

IndexError: list index out of range

Activity

  1. added this to the v1.0 milestone on Oct 25, 2017
  2. modified the milestones: v1.0, v0.5.4 on Dec 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions