Allowed abbrev to accept the dictionary object (good for passing in shelves or PersistentDictionaries).

This commit is contained in:
Jeremy Fincher 2003-11-11 14:16:27 +00:00
parent 94041acb9b
commit 028b23d41c

View File

@ -86,8 +86,9 @@ def eachSubstring(s):
for i in xrange(1, len(s)+1):
yield s[:i]
def abbrev(strings):
def abbrev(strings, d=None):
"""Returns a dictionary mapping unambiguous abbreviations to full forms."""
if d is None:
d = {}
for s in strings:
for abbreviation in eachSubstring(s):