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

Feature/36/levenshtein #32

Merged
merged 4 commits into from
Dec 11, 2016
Merged

Feature/36/levenshtein #32

merged 4 commits into from
Dec 11, 2016

Conversation

amelie-certin
Copy link
Contributor

Leveinshtein

* \param b Integer
* \return Integer the lower value between the two given Integers
*/
int min(int a, int b) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Peux tu l'appeller minInt ?

int last_cost = i + 1;
for (size_t j = 0; j < size2; j++) {
int sub_cost = (str1[i] == str2[j]) ? 0 : 1;
int cost = min(min(last_cost + 1, val[j + 1] + 1), val[j] + sub_cost);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trop long

Copy link
Contributor

@TristanEduProjet TristanEduProjet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simple mais efficace.

* \return Integer the distance between the two given strings
*/
int levenshtein(char *str1, char *str2) {
if (strcmp(str1, str2) == 0) {
Copy link
Contributor

@TristanEduProjet TristanEduProjet Dec 11, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Il serait peut-être mieux d'utiliser strcasecmp pour ne pas être sensible à la case ?

@alex-lairan alex-lairan merged commit bd4d5fa into develop Dec 11, 2016
@alex-lairan alex-lairan deleted the feature/36/levenshtein branch December 11, 2016 23:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants