ritwik12 / Virtual-Assistant

A linux based Virtual assistant on Artificial Intelligence in C
GNU General Public License v3.0
128 stars 95 forks source link

Issue #38: Replacing nested IF/ELSE block with loop #40

Closed rthugh02 closed 4 years ago

rthugh02 commented 6 years ago

I created a struct to hold the name of the class and the score that was calculated in the already existing for loops. Then put them in an array that I iterate over to determine the max, and pass the max's name to the result.

ritwik12 commented 5 years ago

@rthugh02 This looks really good and clean

ritwik12 commented 5 years ago

@rthugh02 Good approach but I tested your code and I noticed that it is giving priority to weather functionality in most of the cases.

rthugh02 commented 5 years ago

Looking over it that's to be expected given that the default max is set to be the weather struct. If it's favoring weather, then it must be that the weather score is zero or equal to another classes' score. I will begin designing a change to account for this bias. Possibly if the weather score is zero or is equal to a different classes' score but is still max, prompt the user to phrase the question more clearly? How does that sound?

speedy-software-ch commented 5 years ago

@rthugh02 why wouldn't we actually work with a switch() with a default section not favoring any option?

rthugh02 commented 5 years ago

@rthugh02 why wouldn't we actually work with a switch() with a default section not favoring any option?

Switch cases can only compare based on exact values (and ranges if you use an extension library), not conditions.

pavan-pan commented 5 years ago

Is this issue resolved ? can i take it up ?

ritwik12 commented 5 years ago

@pavan-pan You can take this up as it's still not resolved.

ritwik12 commented 4 years ago

Closing this due to lack of Activity!!