diff --git a/docs/UserGuide.md b/docs/UserGuide.md index d9e66e8033..c497993df6 100644 --- a/docs/UserGuide.md +++ b/docs/UserGuide.md @@ -21,7 +21,8 @@ Here are the list of commands you can use: 8. flowers - Shows a list of flowers associated with said occasion 9. occasion - Shows a list of occasions associated with available flowers. 10. save - Saves a bouquet to an external .txt file -11. bye - Exits the programme +11. recommend - Recommends a bouquet based on the chosen occasion and colour +12. bye - Exits the programme ``` ### Create a new bouquet: `new` @@ -134,16 +135,19 @@ Format: `add /q /to ` - Bouquet must exist in the database Examples: -- `add Rose /q 3 /to Bouquet for mom` +- `add Rose /q 3 /to For Girlfriend` - `add Babys breath /q 2 /to Sister’s graduation` Expected Output: ``` You have successfully added the following: - - 3 x Rose -> Bouquet: For Girlfriend -Here are the list of your saved bouquets: + - 3 x rose -> Bouquet: For Girlfriend +Here is the list of your saved bouquets: 1. For Girlfriend : - 3 x Rose + Total estimated price = $6.00 +____________________________________________________________ +What can I do for you? ``` ### Remove flower: `remove` @@ -162,11 +166,14 @@ Examples: Expected output: ``` -You have successfully added the following: - - 1 x Rose -> Bouquet: For Girlfriend -Here are the list of your saved bouquets: +You have successfully removed the following: + - 1 x rose -> Bouquet: For Girlfriend +Here is the list of your saved bouquets: 1. For Girlfriend : - 2 x Rose + Total estimated price = $4.00 +____________________________________________________________ +What can I do for you? ``` ### List occasions: `occasion` @@ -256,9 +263,58 @@ Expected output: Enjoy your bouquet! Thank you for using Florizz ``` +### Fuzzy Logic + +Florizz uses a type of fuzzy logic to rectifies typos in user input by utilising the Damerau-Levenshtein Distance +to measure the similarity between the user input and a valid command/item/occasion. + +The Damerau-Levenshtein distance measures the minimum number of single-character edits required to change one string +into another. These edits can be insertions, deletions, substitutions and transpositions of individual characters. + +When a typo is detected, Florizz will make a calculated guess as to the valid commands that a user is actually calling. + +Examples: +- `newq mybouquet1` +- `adds Chysanthenum /q 10 /to mybouquet1` +- `delate mybouquet1` + +Expected output: + +``` +newq mybouquet1 +--> Your input is [newq] but I am guessing you mean [new] +Added new bouquet to list: +mybouquet1 +____________________________________________________________ +What can I do for you? +``` +``` +adds Chysanthenum /q 10 /to mybouquet1 +--> Your input is [adds] but I am guessing you mean [add] +--> Your input is [Chysanthenum] but I am guessing you mean [Chrysanthemum] +You have successfully added the following: + - 10 x chrysanthemum -> Bouquet: mybouquet1 +Here is the list of your saved bouquets: +1. mybouquet1 : + - 10 x Chrysanthemum + Total estimated price = $10.00 +____________________________________________________________ +What can I do for you? +``` + +``` +delate mybouquet1 +--> Your input is [delate] but I am guessing you mean [delete] +Deleted bouquet: +mybouquet1 +____________________________________________________________ +What can I do for you? +``` + ### Autosave Florizz automatically backs up all your bouquet data onto your device in a `FlorizzBouquets.txt` file. As such the user can transfer their bouquet data between devices by simply moving the text file to the `florizz-out/data/` folder. However, editing this text file is not recommended as the format is very specific, so users should do so at their own risk + diff --git a/src/main/java/florizz/core/Ui.java b/src/main/java/florizz/core/Ui.java index 7c45b8389a..e77833a0a6 100644 --- a/src/main/java/florizz/core/Ui.java +++ b/src/main/java/florizz/core/Ui.java @@ -130,7 +130,8 @@ public void printHelpMessage() { System.out.println("8. flowers - Shows a list of flowers associated with said occasion"); System.out.println("9. occasion - Shows a list of occasions associated with available flowers."); System.out.println("10. save - Saves a bouquet to an external .txt file"); - System.out.println("11. bye - Exits the programme"); + System.out.println("11. recommend - Recommends a bouquet based on the chosen occasion and colour."); + System.out.println("12. bye - Exits the programme"); printBreakLine(); }