From 08b37aba4ce8e747bf39387d9ee504a2edf53207 Mon Sep 17 00:00:00 2001 From: Mike Schutte Date: Tue, 18 Oct 2016 18:06:40 -0600 Subject: [PATCH] Update complete_me.markdown Proposes change in suggestion ordering based on alphabetical ordering and selection weights. Talked with Beth before making changes. --- source/projects/complete_me.markdown | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/source/projects/complete_me.markdown b/source/projects/complete_me.markdown index 31158a9e6..81060a6e2 100644 --- a/source/projects/complete_me.markdown +++ b/source/projects/complete_me.markdown @@ -100,7 +100,8 @@ completion.count => 235886 completion.suggest("piz") -=> ["pizza", "pizzeria", "pizzicato", "pizzle", "pize"] +=> ["pize", "pizza", "pizzeria", "pizzicato", "pizzle"] +#this is in alphabetical order, the order in which the words would be pulled. The old order was in neither alphabetical nor reverse alpha. ``` ### Usage Weighting @@ -131,12 +132,13 @@ dictionary = File.read("/usr/share/dict/words") completion.populate(dictionary) completion.suggest("piz") -=> ["pizza", "pizzeria", "pizzicato"] +=> ["pize", "pizza", "pizzeria", "pizzicato", "pizzle"] completion.select("piz", "pizzeria") completion.suggest("piz") -=> ["pizzeria", "pizza", "pizzicato"] +=> ["pizzeria", "pize", "pizza", "pizzicato", "pizzle"] +#appends dictionary suggestions after weighted suggestion. ``` ## Spec Harness @@ -191,10 +193,11 @@ completion.select("pi", "pizza") completion.select("pi", "pizzicato") completion.suggest("piz") -=> ["pizzeria", "pizza", "pizzicato"] +=> ["pizzeria", "pize", "pizza", "pizzicato", "pizzle"] -completion.suggest("pi") -=> ["pizza", "pizzicato","pizzeria"] +completion.suggest("pi").first(5) +=> ["pizza", "pizzicato", "pi", "pia", "piaba"] + #There are 1189 suggestions for "pi". We (David and I) spoke with Beth, and she said she just wants the dictionary suggestions appended to the weighted suggestions for the given substring. We think only displaying the first five makes it more user friendly. ``` In this example, against the substring "piz" we choose @@ -239,7 +242,7 @@ will need to provide your own tests that demonstrate this functionality. ## Extensions ### 1. Denver Addresses - +(This file is relocated, we couldn't find it elsewhere). Working with words was interesting, but what about a bigger dataset? Check out [this data file](http://data.denvergov.org/dataset/city-and-county-of-denver-addresses) (you'll want the CSV version) that contains all the known addresses in the city of Denver. Use the `full_address` field that's last in the row. Can you make your autocomplete work with that dataset? ### 2. Substrings @@ -252,6 +255,8 @@ Can you create a graphical user interface for your code? Something that a "norma ### 4. Automated Reporting +Is this the same as the simplecov request on line 157? + * Setup [SimpleCov](https://github.com/colszowka/simplecov) to monitor test coverage along the way ## Evaluation Rubric