mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-24 11:42:52 +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,8 +86,9 @@ def eachSubstring(s):
|
|||||||
for i in xrange(1, len(s)+1):
|
for i in xrange(1, len(s)+1):
|
||||||
yield s[:i]
|
yield s[:i]
|
||||||
|
|
||||||
def abbrev(strings):
|
def abbrev(strings, d=None):
|
||||||
"""Returns a dictionary mapping unambiguous abbreviations to full forms."""
|
"""Returns a dictionary mapping unambiguous abbreviations to full forms."""
|
||||||
|
if d is None:
|
||||||
d = {}
|
d = {}
|
||||||
for s in strings:
|
for s in strings:
|
||||||
for abbreviation in eachSubstring(s):
|
for abbreviation in eachSubstring(s):
|
||||||
|
Loading…
Reference in New Issue
Block a user