mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-23 19:22:45 +01:00
Allowed abbrev to accept the dictionary object (good for passing in shelves or PersistentDictionaries).
This commit is contained in:
parent
94041acb9b
commit
028b23d41c
@ -86,9 +86,10 @@ 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."""
|
||||
d = {}
|
||||
if d is None:
|
||||
d = {}
|
||||
for s in strings:
|
||||
for abbreviation in eachSubstring(s):
|
||||
if abbreviation not in d:
|
||||
|
Loading…
Reference in New Issue
Block a user