-
-
Notifications
You must be signed in to change notification settings - Fork 46.5k
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 levenshtein_distance.py #11171
Update levenshtein_distance.py #11171
Conversation
strings/levenshtein_distance.py
Outdated
first_word (str): The first word to measure the difference. | ||
second_word (str): The second word to measure the difference. | ||
|
||
Returns: | ||
int: The Levenshtein distance between the two words. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a standard way to document parameters and return values. Please do not repeat the datatypes that are in the function signature because mypy validates them and readers will be confused if one is change and the other is not.
first_word (str): The first word to measure the difference. | |
second_word (str): The second word to measure the difference. | |
Returns: | |
int: The Levenshtein distance between the two words. | |
:param first_word: the first word to measure the difference. | |
:param second_word: the second word to measure the difference. | |
:return: the Levenshtein distance between the two words. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep both levenshtein_distance()
and levenshtein_distance_optimized()
in this file and please add a timeit benchmark that proves the enhanced performance of the latter.
Hi There,
Could you please help me how I can do ? Thanks,
Best regards,
Pedram
________________________________
From: Christian Clauss ***@***.***>
Sent: Saturday, November 25, 2023 2:52 PM
To: TheAlgorithms/Python ***@***.***>
Cc: Pedram_Mohajer ***@***.***>; Author ***@***.***>
Subject: Re: [TheAlgorithms/Python] Update levenshtein_distance.py (PR #11171)
@cclauss commented on this pull request.
________________________________
In strings/levenshtein_distance.py<#11171 (comment)>:
+ first_word (str): The first word to measure the difference.
+ second_word (str): The second word to measure the difference.
+
+ Returns:
+ int: The Levenshtein distance between the two words.
This is a standard way to document parameters and return values. Please do not repeat the datatypes that are in the function signature because mypy validates them and readers will be confused if one is change and the other is not.
⬇️ Suggested change
- first_word (str): The first word to measure the difference.
- second_word (str): The second word to measure the difference.
-
- Returns:
- int: The Levenshtein distance between the two words.
+ :param first_word: the first word to measure the difference.
+ :param second_word: the second word to measure the difference.
+ :return: the Levenshtein distance between the two words.
—
Reply to this email directly, view it on GitHub<#11171 (review)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ALVSFOXVX3R4GNFPU3C7XTDYGHIHBAVCNFSM6AAAAAA7T5NZVWVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMYTONBYHAYTSMZVGQ>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
* Update levenshtein_distance.py * Update levenshtein_distance.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update levenshtein_distance.py * Update levenshtein_distance.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update levenshtein_distance.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update levenshtein_distance.py * Update levenshtein_distance.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Christian Clauss <cclauss@me.com>
* Update levenshtein_distance.py * Update levenshtein_distance.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update levenshtein_distance.py * Update levenshtein_distance.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update levenshtein_distance.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update levenshtein_distance.py * Update levenshtein_distance.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Christian Clauss <cclauss@me.com>
* Update levenshtein_distance.py * Update levenshtein_distance.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update levenshtein_distance.py * Update levenshtein_distance.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update levenshtein_distance.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update levenshtein_distance.py * Update levenshtein_distance.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Christian Clauss <cclauss@me.com>
Describe your change:
Checklist: