Update documentation for EDIT_DISTANCE function - #10255
Update documentation for EDIT_DISTANCE function#10255Simon Sabin (simonsabin) wants to merge 3 commits into
Conversation
Clarified the definition and behavior of the EDIT_DISTANCE function, including details on maximum distance computation and return values.
|
Simon Sabin (@simonsabin) : Thanks for your contribution! The author(s) and reviewer(s) have been notified to review your proposed change. |
|
Learn Build status updates of commit b1e42c1: ✅ Validation status: passed
For more details, please refer to the build report. |
|
Can you review the proposed changes? IMPORTANT: When the changes are ready for publication, adding a #label:"aq-pr-triaged" |
There was a problem hiding this comment.
Pull request overview
This PR updates the documentation for the EDIT_DISTANCE function to provide clearer explanations of its behavior and parameters. The changes focus on improving the description of how the function calculates edit distance and how the maximum_distance parameter affects computation.
Key changes:
- Clarified the function's purpose to emphasize it calculates "distance" as the number of transformations
- Improved explanation of the maximum_distance parameter behavior
- Reorganized the Return value and Remarks sections for better clarity
- Added a second example demonstrating the maximum_distance parameter usage
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
Learn Build status updates of commit 9973739: ✅ Validation status: passed
For more details, please refer to the build report. |
|
Learn Build status updates of commit b697f0c: ✅ Validation status: passed
For more details, please refer to the build report. |
|
#assign:rwestMSFT |
|
Simon Sabin (@simonsabin) Since this edit removes a lot of existing information from There's an internal PR that takes your suggestions into consideration, which is in review. When that merges, this one will close automatically. |
Abhiman Tiwari (abhimantiwari)
left a comment
There was a problem hiding this comment.
Added my comments.
| #### *maximum_distance* | ||
|
|
||
| The maximum distance that should be computed. *maximum_distance* is an integer. If greater than or equal to zero, then the function returns the actual distance value or a distance value that is greater than *maxiumum_distance* value. If the actual distance is greater than *maximum_distance*, then the function might return a value greater than or equal to *maximum_distance*. If the parameter isn't specified or if *maximum_distance* is negative, then the function returns the actual number of transformations needed. If the value is NULL, then the function returns NULL. | ||
| The maximum distance that should be computed. *maximum_distance* is an integer. If greater than or equal to zero, then the function stops calculating the distance when the *maximum_distance* is reached. |
There was a problem hiding this comment.
| The maximum distance that should be computed. *maximum_distance* is an integer. If greater than or equal to zero, then the function stops calculating the distance when the *maximum_distance* is reached. | |
| An optional integer that specifies the maximum edit distance to calculate. When *maximum_distance* is greater than or equal to `0`, the function may stop processing once it determines that the edit distance exceeds the specified value. | |
| If the actual edit distance is less than or equal to *maximum_distance*, the function returns the actual distance. Otherwise, the function returns *maximum_distance* + `1`. | |
| If *maximum_distance* isn't specified, or if it's negative, the function returns the actual edit distance. If *maximum_distance* is `NULL`, the function returns `NULL`. |
| ## Remarks | ||
|
|
||
| This function implements the Damerau-Levenshtein algorithm. If any of the inputs is `NULL` then the function returns a `NULL` value. Otherwise, the function returns an integer value from 0 to the number of transformations or *maximum_distance* value. | ||
| If the actual distance is greater than *maximum_distance*, then the function might return a value greater than or equal to *maximum_distance*. |
There was a problem hiding this comment.
This is not required here since we have clarified this in the maximum_distance definition.
|
|
||
| **int** | ||
|
|
||
| Returns the distance between the two *character_expressions* using Damerau-Levenshtein algorithm, or *maximum_distance* value if that is smaller. |
There was a problem hiding this comment.
Would like to clarify further on the library details.
Returns the distance between the two *character_expressions* using Damerau-Levenshtein (Optimal String Alignment) algorithm, or *maximum_distance* value if that is smaller.
Randolph West MSFT (@rwestMSFT) You can take the call, as per the docs standard whether to have this under "Return value* or under Remarks? Also the library name - Damerau-Levenshtein (Optimal String Alignment) should be updated on the EDIT_DISTANCE_SIMILARITY page as well.
| ```output | ||
| Source Target ActualDistance LimitedDistance | ||
| --------- --------- -------------- --------------- | ||
| Chocolate Sweets 8 2 |
There was a problem hiding this comment.
Result should be as below -
Source Target ActualDistance LimitedDistance
Chocolate Sweets 8 3
|
I'm going to pull this into an internal PR and close this. Thank you, Simon, for the contribution. We'll make sure you get the appropriate credit. #please-close |
Clarified the definition and behavior of the EDIT_DISTANCE function, including details on maximum distance computation and return values.