diff options
| author | Mattias Andrée <maandree@kth.se> | 2016-11-26 02:52:48 +0100 |
|---|---|---|
| committer | Mattias Andrée <maandree@kth.se> | 2016-11-26 02:52:48 +0100 |
| commit | cfdd4dbab72cdc18b64e95551e35bc1da8b11d60 (patch) | |
| tree | ac9de3c9bd5db36fb0e0c798e61fce13cf62d89a /example/dlurc | |
| parent | small improvements (diff) | |
| download | dlu-cfdd4dbab72cdc18b64e95551e35bc1da8b11d60.tar.gz dlu-cfdd4dbab72cdc18b64e95551e35bc1da8b11d60.tar.bz2 dlu-cfdd4dbab72cdc18b64e95551e35bc1da8b11d60.tar.xz | |
Add example
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
| -rw-r--r-- | example/dlurc | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/example/dlurc b/example/dlurc new file mode 100644 index 0000000..9e13f7c --- /dev/null +++ b/example/dlurc @@ -0,0 +1,19 @@ +# -*- python -*- + +def list_dictionaries(): + return sorted(dicts.keys()) + +def load_dictionary(d): + global get + if d in dicts: + get = dicts[d] + return True + return False + +def get_list(d): + with open(d, 'rb') as file: + return [wordmod(w) for w in file.read().decode('utf-8', 'strict').split('\n') if w != ''] + +dicts = { + 'dict' : (lambda : ('dict.pdf', get_list('dict'), lambda p : p + 2)) +} |
