class State: def __init__(self, cards): self.PrizeCards = [] self.format = Format.STANDARD self.standard_cards = cards self.expanded_cards = [] def cards(self): if (self.format == Format.STANDARD): return self.standard_cards return self.expanded_cards def to_standard(self): self.format = Format.STANDARD self.entry = Autocomplete(self.card_names(), selected, root, width = 40) self.entry.grid(row=0, column=0) def to_expanded(self): if not self.expanded_cards: self.expanded_cards = card_fetcher.fetch(False) self.format = Format.EXPANDED self.entry = Autocomplete(self.card_names(), selected, root, width = 40) self.entry.grid(row=0, column=0) def card_names(self): return [card_helper.unique_name(card) for card in self.cards()]
def __init__(self): self.lastkeytime = 0 self.listbox = False self.listwalker = False self.consolemonitor = False self.edit = False self.getApiClient() self.autocomplete = Autocomplete(self)
def test_initilize_from_filename(self): testfile = os.path.abspath('test/input.json') a = Autocomplete(filename=testfile) a.rebuild_index() results = a.search_query(u'你 轻轻') self.assertEqual(len(results), 2) self.assertEqual(results[0]['id'], '1') self.assertEqual(results[1]['id'], '2')
def test_initilize_from_filename (self): testfile = os.path.abspath('test/input.json') a=Autocomplete(filename=testfile) a.rebuild_index () results=a.search_query (u'你 轻轻') self.assertEqual(len(results),2) self.assertEqual(results[0]['id'],'1') self.assertEqual(results[1]['id'],'2')
def setUp (): auto=Autocomplete("university") auto.del_index() with open("data", "r") as f: for num, line in enumerate(f,1): item = {"uid":num, "score":1000-num, "term": line} print item auto.add_item (item)
class testAutocomplete(unittest.TestCase): def setUp(self): self.items=['{"score": "9", "id": "1", "title": "轻轻地你走了"}', \ '{"score": "8", "id": "2", "title": "正如你轻轻地来"}', \ '{"score": "8.5", "id": "3", "title": "你挥一挥衣袖,不带走一片云彩"}'] self.index_mapping = { 'term': 'title', 'id': 'id', } self.a = Autocomplete(jsonitems=self.items, mapping=self.index_mapping) self.a.rebuild_index() def test_initilize_from_filename(self): testfile = os.path.abspath('test/input.json') a = Autocomplete(filename=testfile) a.rebuild_index() results = a.search_query(u'你 轻轻') self.assertEqual(len(results), 2) self.assertEqual(results[0]['id'], '1') self.assertEqual(results[1]['id'], '2') def test_search_query1(self): results = self.a.search_query(u'你 轻轻') self.assertEqual(len(results), 2) self.assertEqual(results[0]['id'], '1') self.assertEqual(results[1]['id'], '2') def test_search_query2(self): results = self.a.search_query(u'轻轻') self.assertEqual(len(results), 2) self.assertEqual(results[0]['id'], '1') self.assertEqual(results[1]['id'], '2') def test_search_query3(self): results = self.a.search_query(u'你 带走') self.assertEqual(len(results), 1) self.assertEqual(results[0]['id'], '3') def test_search_query4(self): results = self.a.search_query(u'你挥一挥衣袖,不带走一片云彩') self.assertEqual(len(results), 1) self.assertEqual(results[0]['id'], '3') def test_index_mapping(self): self.index_mapping = { 'term': lambda x: x.get('title') + x.get('id'), 'id': 'id', } self.a = Autocomplete(jsonitems=self.items, mapping=self.index_mapping) self.a.rebuild_index() results = self.a.search_query(u'1') self.assertEqual(len(results), 1) self.assertEqual(results[0]['id'], '1') results = self.a.search_query(u'2') self.assertEqual(len(results), 1) self.assertEqual(results[0]['id'], '2')
def setUp (self): self.items=[{"uid":'1', "score":9, "term": u"轻轻地你走了"}, {"uid":'2', "score":10, "term": u"正如你轻轻地来"}, {"uid":'3', "score":8.5, "term":u"你挥一挥衣袖,不带走一片云彩"}, ] self.a=Autocomplete("scope") self.a.del_index() for item in self.items: self.a.add_item (item)
def setUp(self): self.items=['{"score": "9", "id": "1", "title": "轻轻地你走了"}', \ '{"score": "8", "id": "2", "title": "正如你轻轻地来"}', \ '{"score": "8.5", "id": "3", "title": "你挥一挥衣袖,不带走一片云彩"}'] self.index_mapping = { 'term': 'title', 'id': 'id', } self.a = Autocomplete(jsonitems=self.items, mapping=self.index_mapping) self.a.rebuild_index()
class testAutocomplete (unittest.TestCase): def setUp (self): self.items=['{"score": "9", "id": "1", "title": "轻轻地你走了"}', \ '{"score": "8", "id": "2", "title": "正如你轻轻地来"}', \ '{"score": "8.5", "id": "3", "title": "你挥一挥衣袖,不带走一片云彩"}'] self.index_mapping={'term':'title', 'id':'id', } self.a=Autocomplete(jsonitems=self.items,mapping=self.index_mapping) self.a.rebuild_index () def test_initilize_from_filename (self): testfile = os.path.abspath('test/input.json') a=Autocomplete(filename=testfile) a.rebuild_index () results=a.search_query (u'你 轻轻') self.assertEqual(len(results),2) self.assertEqual(results[0]['id'],'1') self.assertEqual(results[1]['id'],'2') def test_search_query1 (self): results=self.a.search_query (u'你 轻轻') self.assertEqual(len(results),2) self.assertEqual(results[0]['id'],'1') self.assertEqual(results[1]['id'],'2') def test_search_query2 (self): results=self.a.search_query (u'轻轻') self.assertEqual(len(results),2) self.assertEqual(results[0]['id'],'1') self.assertEqual(results[1]['id'],'2') def test_search_query3 (self): results=self.a.search_query (u'你 带走') self.assertEqual(len(results),1) self.assertEqual(results[0]['id'],'3') def test_search_query4 (self): results=self.a.search_query (u'你挥一挥衣袖,不带走一片云彩') self.assertEqual(len(results),1) self.assertEqual(results[0]['id'],'3') def test_index_mapping (self): self.index_mapping={ 'term':lambda x:x.get('title')+x.get('id'), 'id':'id', } self.a=Autocomplete(jsonitems=self.items,mapping=self.index_mapping) self.a.rebuild_index () results=self.a.search_query (u'1') self.assertEqual(len(results),1) self.assertEqual(results[0]['id'],'1') results=self.a.search_query (u'2') self.assertEqual(len(results),1) self.assertEqual(results[0]['id'],'2')
def autocomplete_api(word): start_time = time.time() autocomplete = Autocomplete(word) j, status = autocomplete.get_json() num_results = autocomplete.get_num_results() elapsed_time = time.time() - start_time logging.debug( f"/autocomplete for '{word}': {num_results} results, time: {elapsed_time:.2f}s" ) return json_answer_status(j, status)
def test_index_mapping(self): self.index_mapping = { 'term': lambda x: x.get('title') + x.get('id'), 'id': 'id', } self.a = Autocomplete(jsonitems=self.items, mapping=self.index_mapping) self.a.rebuild_index() results = self.a.search_query(u'1') self.assertEqual(len(results), 1) self.assertEqual(results[0]['id'], '1') results = self.a.search_query(u'2') self.assertEqual(len(results), 1) self.assertEqual(results[0]['id'], '2')
def test_assignment_example04(): """Testing with the example vocabulary.""" from autocomplete import Autocomplete vocabulary = [ 'fix', 'fax', 'fit', 'fist', 'full', 'finch', 'final', 'finial' ] complete_me = Autocomplete(vocabulary, 4) assert complete_me('finally') == []
def __init__(self, connectionname): self.connectionname = connectionname self.lastkeytime = 0 self.listbox = False self.listwalker = False self.consolemonitor = False self.edit = False self.getApiClient() self.autocomplete = Autocomplete(self)
def setUp (self): self.items=['{"score": "9", "id": "1", "title": "轻轻地你走了"}', \ '{"score": "8", "id": "2", "title": "正如你轻轻地来"}', \ '{"score": "8.5", "id": "3", "title": "你挥一挥衣袖,不带走一片云彩"}'] self.index_mapping={'term':'title', 'id':'id', } self.a=Autocomplete(jsonitems=self.items,mapping=self.index_mapping) self.a.rebuild_index ()
def test_index_mapping (self): self.index_mapping={ 'term':lambda x:x.get('title')+x.get('id'), 'id':'id', } self.a=Autocomplete(jsonitems=self.items,mapping=self.index_mapping) self.a.rebuild_index () results=self.a.search_query (u'1') self.assertEqual(len(results),1) self.assertEqual(results[0]['id'],'1') results=self.a.search_query (u'2') self.assertEqual(len(results),1) self.assertEqual(results[0]['id'],'2')
def setUp(): auto = Autocomplete("university") auto.del_index() with open("data", "r") as f: for num, line in enumerate(f, 1): item = {"uid": num, "score": 1000 - num, "term": line} print item auto.add_item(item)
def setUp(self): self.items = [ { "uid": '1', "score": 9, "term": u"Alex" }, { "uid": '2', "score": 10, "term": u"Piter" }, { "uid": '3', "score": 8.5, "term": u"Alexey" }, ] self.a = Autocomplete("scope") self.a.del_index() for item in self.items: self.a.add_item(item)
def autocompleteData(string): list1 = [] list_dict = [] count = 0 if dict_data.get(string): for index in dict_data[string]: if count < 5: list_dict.append({"index": index, "score": 2*len(string)}) count = count+1 if count < 5: changeInput(string, count, list_dict) else: changeInput(string, count, list_dict) i = 0 for dict in list_dict: if i < 5: i = i+1 list1.append(Autocomplete(listString[dict["index"]]["sentence"], dictFile[listString[dict["index"]]["source"]], listString[dict["index"]]["offset"], dict["score"])) return list1
class Processor(object): shard = 'shard0' lastkey = False apiclient = False aliases = { 'theme': 'themes', 'time': 'Game.time', 'help': 'list' } def __init__(self, connectionname): self.connectionname = connectionname self.lastkeytime = 0 self.listbox = False self.listwalker = False self.consolemonitor = False self.edit = False self.getApiClient() self.autocomplete = Autocomplete(self) def setDisplayWidgets(self, loop, frame, listbox, listwalker, edit, consolemonitor): self.listbox = listbox # console self.listwalker = listwalker self.edit = edit self.loop = loop self.consolemonitor = consolemonitor def getApiClient(self): return settings.getApiClient(self.connectionname) def onInput(self, key): lastkeytime = self.lastkeytime self.lastkeytime = calendar.timegm(time.gmtime()) if self.lastkeytime - lastkeytime > 1: self.lastkey = False lastkey = self.lastkey self.lastkey = key if not self.listbox: return if key == 'enter': self.onEnter(key) return if key == 'tab' and lastkey == 'tab': self.onTab(key) return if key == 'page up': self.onPageUp(key) return if key == 'page down': self.onPageDown(key) return if key == 'meta up': self.onMetaUp(key) return if key == 'meta down': self.onMetaDown(key) return return def onEnter(self, key): self.listbox.setAutoscroll(True) userInput = self.edit user_text = userInput.get_edit_text() # Check for builtin commands before passing to the screeps api. user_command_split = user_text.split(' ') first_command = user_command_split[0] # Check to see if command is actually an alias if first_command in self.aliases: first_command = self.aliases[first_command] user_command_split[0] = first_command user_text = ' '.join(user_command_split) # Look for built in commands before attempting API call. builtin = Builtin() if hasattr(builtin, first_command): self.listwalker.append( urwid.Text(('logged_input', '> ' + user_text))) builtin_command = getattr(builtin, first_command) builtin_command(self) self.listbox.autoscroll() userInput.set_edit_text('') return # Send command to Screeps API. Output will come from the console stream. if len(user_text) > 0: self.listwalker.append( urwid.Text(('logged_input', '> ' + user_text))) self.listbox.scrollBottom() userInput.set_edit_text('') apiclient = self.getApiClient() apiclient.console(user_text, self.shard) def onTab(self, key): self.autocomplete.complete() pass def onPageUp(self, key): info = self.loop.screen.get_cols_rows() self.listbox.scrollUp(int(info[1] / 3)) def onPageDown(self, key): info = self.loop.screen.get_cols_rows() self.listbox.scrollDown(int(info[1] / 3)) def onMetaUp(self, key): self.listbox.scrollUp(1) def onMetaDown(self, key): self.listbox.scrollDown(1)
def to_expanded(self): if not self.expanded_cards: self.expanded_cards = card_fetcher.fetch(False) self.format = Format.EXPANDED self.entry = Autocomplete(self.card_names(), selected, root, width = 40) self.entry.grid(row=0, column=0)
def to_standard(self): self.format = Format.STANDARD self.entry = Autocomplete(self.card_names(), selected, root, width = 40) self.entry.grid(row=0, column=0)
def test_setup01(): """Making sure the foundation is solid.""" from autocomplete import Autocomplete words = ['ant', 'banana', 'fruit', 'queen'] t = Autocomplete(words) assert t.vocab.contains('ant')
def long_dict_trie(): """A trie filled with words from the short dictionary.""" return Autocomplete(long_dictionary)
class testAutocomplete(unittest.TestCase): def setUp(self): self.items = [ { "uid": '1', "score": 9, "term": u"Alex" }, { "uid": '2', "score": 10, "term": u"Piter" }, { "uid": '3', "score": 8.5, "term": u"Alexey" }, ] self.a = Autocomplete("scope") self.a.del_index() for item in self.items: self.a.add_item(item) def test_search_query2(self): results = self.a.search_query(u'Al') self.assertEqual(len(results), 2) self.assertEqual(results[0]['uid'], '1') self.assertEqual(results[1]['uid'], '3') def test_search_query3(self): results = self.a.search_query(u'Piter') self.assertEqual(len(results), 1) self.assertEqual(results[0]['uid'], '2') def test_search_query4(self): results = self.a.search_query(u'Alexey') self.assertEqual(len(results), 1) self.assertEqual(results[0]['uid'], '3') def test_update_item(self): item = {"uid": '1', "score": 13, "term": u"Alex"} self.a.update_item(item) results = self.a.search_query(u'Al') self.assertEqual(len(results), 2) self.assertEqual(results[0]['uid'], '1') self.assertEqual(results[1]['uid'], '3') def test_del_item(self): item = {"uid": '1', "score": 9, "term": u"Alex"} self.a.del_item(item) results = self.a.search_query(u'Al') self.assertEqual(len(results), 1) self.assertEqual(results[0]['uid'], '3')
def __init__(self, json_dir): self.json_dir = json_dir self.index_letters = 0 self.search = Search() self.autocomplete = Autocomplete() self.indexletter = IndexLetter()
from flask_cors import CORS from flask_caching import Cache from connection_pool import ConnectionPool from autocomplete import Autocomplete import engine app = Flask(__name__) CORS(app) # tell Flask to use the above defined config app.config['CACHE_TYPE'] = 'simple' app.cache = Cache(app) # creat connection pool object connection_pool = ConnectionPool() title_autocomplete = Autocomplete() @app.cache.memoize(timeout=100) def get_similar_titles(query): return title_autocomplete.get_similar_titles(query) def get_full_recommendations_data(recs): result = [] # buffered=True allows to read the result as buffered db_connection = connection_pool.get_pool_connection() cursor = db_connection.cursor(buffered=True) for movie in recs: sql = """ SELECT * FROM full_movies_data WHERE title = %s """ cursor.execute(sql, (movie, ))
#-*-coding:utf-8-*- from autocomplete import Autocomplete import os import json testfile = os.path.abspath('licai.json') a = Autocomplete(filename=testfile,) a.rebuild_index() results = a.search_query(u'宝') a = u'宝' print a, type(a) print results #json_data = json.JSONEncoder().encode(results) #print json_data, type(json_data)
from autocomplete import Autocomplete import sys, os if __name__ == "__main__": ac = Autocomplete('test.txt') while True: user_input = raw_input("Enter input: ").strip('\n') if ac.is_word(user_input): print "lol it's a word" else: print ac.closest_word(user_input) if user_input == ':q': sys.exit(0)
class testAutocomplete(unittest.TestCase): def setUp(self): self.items = [ { "uid": '1', "score": 9, "term": u"轻轻地你走了" }, { "uid": '2', "score": 10, "term": u"正如你轻轻地来" }, { "uid": '3', "score": 8.5, "term": u"你挥一挥衣袖,不带走一片云彩" }, ] self.a = Autocomplete("scope") self.a.del_index() for item in self.items: self.a.add_item(item) def test_search_query2(self): results = self.a.search_query(u'轻轻') self.assertEqual(len(results), 2) self.assertEqual(results[0]['uid'], '2') self.assertEqual(results[1]['uid'], '1') def test_search_query3(self): results = self.a.search_query(u'你 带走') self.assertEqual(len(results), 1) self.assertEqual(results[0]['uid'], '3') def test_search_query4(self): results = self.a.search_query(u'你挥一挥衣袖,不带走一片云彩') self.assertEqual(len(results), 1) self.assertEqual(results[0]['uid'], '3') def test_update_item(self): item = {"uid": '1', "score": 13, "term": u"轻轻地你走了"} self.a.update_item(item) results = self.a.search_query(u'轻轻') self.assertEqual(len(results), 2) self.assertEqual(results[0]['uid'], '1') self.assertEqual(results[1]['uid'], '2') def test_del_item(self): item = {"uid": '1', "score": 9, "term": u"轻轻地你走了"} self.a.del_item(item) results = self.a.search_query(u'轻轻') self.assertEqual(len(results), 1) self.assertEqual(results[0]['uid'], '2')
from flask.json import jsonify from autocomplete import Autocomplete import startup as startup import pypiscraper as pypiscraper app = Flask(__name__) @app.route("/package_info") def package_info(): return jsonify(pypiscraper.get_meta(request.args["pkg_name"])) @app.route("/autocomplete") def autocomplete(): return jsonify(ac.search(request.args["word"])) def main(): startup.startup() ac = Autocomplete() app.run(host="localhost", port=5000) if __name__ == "__main__": startup.startup() ac = Autocomplete() app.run(host="localhost", port=5000)
def test_error_if_not_string(): """Test that you get a TypeError if you try to input a nonstring.""" with pytest.raises(TypeError): Breakit = Autocomplete([1, 2, 3])
def main(): startup.startup() ac = Autocomplete() app.run(host="localhost", port=5000)
def test_setup02(): """Confirming property works..""" from autocomplete import Autocomplete words = ['ant', 'an', 'antennae', 'anno', 'antagonize'] t = Autocomplete(words) assert t('a') == ['an', 'ant', 'antennae', 'antagonize', 'anno']
class testAutocomplete (unittest.TestCase): def setUp (self): self.items=[{"uid":'1', "score":9, "term": u"轻轻地你走了"}, {"uid":'2', "score":10, "term": u"正如你轻轻地来"}, {"uid":'3', "score":8.5, "term":u"你挥一挥衣袖,不带走一片云彩"}, ] self.a=Autocomplete("scope") self.a.del_index() for item in self.items: self.a.add_item (item) def test_search_query2 (self): results=self.a.search_query (u'轻轻') self.assertEqual(len(results),2) self.assertEqual(results[0]['uid'],'2') self.assertEqual(results[1]['uid'],'1') def test_search_query3 (self): results=self.a.search_query (u'你 带走') self.assertEqual(len(results),1) self.assertEqual(results[0]['uid'],'3') def test_search_query4 (self): results=self.a.search_query (u'你挥一挥衣袖,不带走一片云彩') self.assertEqual(len(results),1) self.assertEqual(results[0]['uid'],'3') def test_update_item (self): item = {"uid":'1', "score":13, "term": u"轻轻地你走了"} self.a.update_item (item) results=self.a.search_query (u'轻轻') self.assertEqual(len(results),2) self.assertEqual(results[0]['uid'],'1') self.assertEqual(results[1]['uid'],'2') def test_del_item (self): item = {"uid":'1', "score":9, "term": u"轻轻地你走了"} self.a.del_item (item) results=self.a.search_query (u'轻轻') self.assertEqual(len(results),1) self.assertEqual(results[0]['uid'],'2')
class Processor(object): lastkey = False apiclient = False aliases = {'theme': 'themes', 'time': 'Game.time', 'help': 'list'} def __init__(self): self.lastkeytime = 0 self.listbox = False self.listwalker = False self.consolemonitor = False self.edit = False self.getApiClient() self.autocomplete = Autocomplete(self) def setDisplayWidgets(self, loop, frame, listbox, listwalker, edit, consolemonitor): self.listbox = listbox # console self.listwalker = listwalker self.edit = edit self.loop = loop self.consolemonitor = consolemonitor def getApiClient(self): if not self.apiclient: settings = getSettings() self.apiclient = screepsapi.API(u=settings['screeps_username'], p=settings['screeps_password'], ptr=settings['screeps_ptr'], host=settings['screeps_host']) return self.apiclient def onInput(self, key): lastkeytime = self.lastkeytime self.lastkeytime = calendar.timegm(time.gmtime()) if self.lastkeytime - lastkeytime > 1: self.lastkey = False lastkey = self.lastkey self.lastkey = key if not self.listbox: return if key == 'enter': self.onEnter(key) return if key == 'tab' and lastkey == 'tab': self.onTab(key) return if key == 'page up': self.onPageUp(key) return if key == 'page down': self.onPageDown(key) return if key == 'meta up': self.onMetaUp(key) return if key == 'meta down': self.onMetaDown(key) return return def onEnter(self, key): self.listbox.setAutoscroll(True) userInput = self.edit user_text = userInput.get_edit_text() # Check for builtin commands before passing to the screeps api. user_command_split = user_text.split(' ') first_command = user_command_split[0] # Check to see if command is actually an alias if first_command in self.aliases: first_command = self.aliases[first_command] user_command_split[0] = first_command user_text = ' '.join(user_command_split) # Look for built in commands before attempting API call. builtin = Builtin() if hasattr(builtin, first_command): self.listwalker.append( urwid.Text(('logged_input', '> ' + user_text))) builtin_command = getattr(builtin, first_command) builtin_command(self) self.listbox.autoscroll() userInput.set_edit_text('') return # Send command to Screeps API. Output will come from the console stream. if len(user_text) > 0: self.listwalker.append( urwid.Text(('logged_input', '> ' + user_text))) self.listbox.scrollBottom() userInput.set_edit_text('') apiclient = self.getApiClient() apiclient.console(user_text) def onTab(self, key): self.autocomplete.complete() pass def onPageUp(self, key): info = self.loop.screen.get_cols_rows() self.listbox.scrollUp(int(info[1] / 3)) def onPageDown(self, key): info = self.loop.screen.get_cols_rows() self.listbox.scrollDown(int(info[1] / 3)) def onMetaUp(self, key): self.listbox.scrollUp(1) def onMetaDown(self, key): self.listbox.scrollDown(1)
# implementation adapted from https://www.acmesystems.it/python_http from http.server import BaseHTTPRequestHandler, HTTPServer from urllib.parse import urlparse, parse_qs from autocomplete import Autocomplete import json PORT_NUMBER = 8080 ac = Autocomplete(load=True) # This class will handles any incoming request from # the browser class AutocompleteServer(BaseHTTPRequestHandler): # Handler for the GET requests def do_GET(self): query = urlparse(self.path).query query_components = parse_qs(urlparse(self.path).query) if "q" in query_components: phrase = query_components["q"][0] results = json.dumps( {"Completions": ac.generate_completions(phrase)}) print(results) self.send_response(200) self.send_header("Content-type", "text/html") self.end_headers() self.wfile.write(results.encode()) print("END OF REQUEST")
left_padding = 10 root = tk.Tk() root.title("Pokemon TCG Prize Cam") create_menu(root) # a little more than width and height of image w = (photo_width + left_padding) * 2 h = (photo_height + top_padding) * 3 + 40 x = 80 y = 100 # use width x height + x_offset + y_offset (no spaces!) root.geometry("%dx%d+%d+%d" % (w, h, x, y)) start_time = dt.now() state.entry = Autocomplete(state.card_names(), selected, root, width = 40) state.entry.grid(row=0, column=0) button = tk.Button(root, text = "Reset Prizes", command = reset_cards, width=35) button.grid(row=0, column=1) state.backphoto = get_back_photo() state.takenphoto = get_taken_photo() for row in range(1, 4): for col in range(2): pc = PrizeCard(tk.Button(root, image=state.backphoto)) pc.button.configure(command=lambda r = row, c = col: prize_click(r, c)) state.PrizeCards.append(pc) redraw_cards() root.resizable(False, False) root.mainloop()
def long_dict_very_big_max(): """A trie filled with words from the short dictionary, max_compl = 7.""" return Autocomplete(long_dictionary, max_completions=15)
def short_dict_big_max(): """A trie filled with words from the short dictionary, max_compl = 7.""" return Autocomplete(short_dictionary, max_completions=7)