Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update userguide for fuzzy logic #106

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 63 additions & 7 deletions docs/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ Here are the list of commands you can use:
8. flowers <occasion> - Shows a list of flowers associated with said occasion
9. occasion - Shows a list of occasions associated with available flowers.
10. save <bouquetName> - Saves a bouquet to an external <bouquetName>.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`
Expand Down Expand Up @@ -134,16 +135,19 @@ Format: `add <flowerName> /q <quantity> /to <bouquetName>`
- 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`
Expand All @@ -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`
Expand Down Expand Up @@ -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


3 changes: 2 additions & 1 deletion src/main/java/florizz/core/Ui.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ public void printHelpMessage() {
System.out.println("8. flowers <occasion> - 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 <bouquetName> - Saves a bouquet to an external <bouquetName>.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();
}

Expand Down
Loading