Passing incorrect arguments can be confusing in jellyfish. See the following:
Python 2.7.11 |Anaconda 4.0.0 (x86_64)| (default, Dec 6 2015, 18:57:58)
In [1]: from jellyfish._jellyfish import soundex, nysiis
In [2]: nysiis('jamesturk')
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-2-f6b8e2a0ef35> in <module>()
----> 1 nysiis('jamesturk')
/Users/jonathandebruin/anaconda/lib/python2.7/site-packages/jellyfish/_jellyfish.pyc in nysiis(s)
216 def nysiis(s):
217 if isinstance(s, bytes):
--> 218 raise TypeError(_no_bytes_err)
219 if not s:
220 return ''
TypeError: expected unicode, got str
In [3]: nysiis(u'jamesturk')
Out[3]: u'JANASTARC'
In [4]: nysiis([u'jamesturk', u'Jonathan'])
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-4-d24d43c545bb> in <module>()
----> 1 nysiis([u'jamesturk', u'Jonathan'])
/Users/jonathandebruin/anaconda/lib/python2.7/site-packages/jellyfish/_jellyfish.pyc in nysiis(s)
220 return ''
221
--> 222 s = s.upper()
223 key = []
224
AttributeError: 'list' object has no attribute 'upper'
In [5]: nysiis(10)
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-5-0a8a2a0920ef> in <module>()
----> 1 nysiis(10)
/Users/jonathandebruin/anaconda/lib/python2.7/site-packages/jellyfish/_jellyfish.pyc in nysiis(s)
220 return ''
221
--> 222 s = s.upper()
223 key = []
224
AttributeError: 'int' object has no attribute 'upper'
if IS_PY3 and not isinstance(s, str):
raise TypeError('expected str or unicode, got %s' % type(s).__name__)
elif not IS_PY3 and not isinstance(s, unicode):
raise TypeError('expected unicode, got %s' % type(s).__name__)
In [2]: from jellyfish._jellyfish import soundex, nysiis
In [3]: nysiis('jamesturk')
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-3-f6b8e2a0ef35> in <module>()
----> 1 nysiis('jamesturk')
/Users/jonathandebruin/GitHub/recordlinkage/jellyfish/jellyfish/_jellyfish.py in nysiis(s)
221
222 def nysiis(s):
--> 223 _check_type(s)
224
225 if not s:
/Users/jonathandebruin/GitHub/recordlinkage/jellyfish/jellyfish/_jellyfish.py in _check_type(s)
13 raise TypeError('expected str or unicode, got %s' % type(s).__name__)
14 elif not IS_PY3 and not isinstance(s, unicode):
---> 15 raise TypeError('expected unicode, got %s' % type(s).__name__)
16
17 def levenshtein_distance(s1, s2):
TypeError: expected unicode, got str
In [4]: nysiis(u'jamesturk')
Out[4]: u'JANASTARC'
In [5]: nysiis([u'jamesturk', u'Jonathan'])
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-5-d24d43c545bb> in <module>()
----> 1 nysiis([u'jamesturk', u'Jonathan'])
/Users/jonathandebruin/GitHub/recordlinkage/jellyfish/jellyfish/_jellyfish.py in nysiis(s)
221
222 def nysiis(s):
--> 223 _check_type(s)
224
225 if not s:
/Users/jonathandebruin/GitHub/recordlinkage/jellyfish/jellyfish/_jellyfish.py in _check_type(s)
13 raise TypeError('expected str or unicode, got %s' % type(s).__name__)
14 elif not IS_PY3 and not isinstance(s, unicode):
---> 15 raise TypeError('expected unicode, got %s' % type(s).__name__)
16
17 def levenshtein_distance(s1, s2):
TypeError: expected unicode, got list
In [6]: nysiis(10)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-6-0a8a2a0920ef> in <module>()
----> 1 nysiis(10)
/Users/jonathandebruin/GitHub/recordlinkage/jellyfish/jellyfish/_jellyfish.py in nysiis(s)
221
222 def nysiis(s):
--> 223 _check_type(s)
224
225 if not s:
/Users/jonathandebruin/GitHub/recordlinkage/jellyfish/jellyfish/_jellyfish.py in _check_type(s)
13 raise TypeError('expected str or unicode, got %s' % type(s).__name__)
14 elif not IS_PY3 and not isinstance(s, unicode):
---> 15 raise TypeError('expected unicode, got %s' % type(s).__name__)
16
17 def levenshtein_distance(s1, s2):
TypeError: expected unicode, got int