From cfdd4dbab72cdc18b64e95551e35bc1da8b11d60 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sat, 26 Nov 2016 02:52:48 +0100 Subject: Add example MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- example/dlurc | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 example/dlurc (limited to 'example/dlurc') 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)) +} -- cgit v1.2.3-70-g09d2