fix(documentation): Update documentation and migration guide with standardized method names and deprecation notices.

This commit is contained in:
2025-05-15 08:56:05 +00:00
parent a24a02fc97
commit 76926a2170
4 changed files with 29 additions and 12 deletions

View File

@@ -34,12 +34,20 @@ const mySmartFuzzy = new Smartfuzzy(myDictionary);
mySmartFuzzy.addToDictionary('Microsoft');
mySmartFuzzy.addToDictionary(['Google', 'Facebook']);
// Getting the closest match
const searchResult = mySmartFuzzy.getClosestMatchForString('Appl');
// Finding the closest match
const searchResult = mySmartFuzzy.findClosestMatch('Appl');
console.log(searchResult); // Output: "Apple Inc."
// Calculate similarity scores for all dictionary entries
const scores = mySmartFuzzy.calculateScores('Appl');
console.log(scores);
// Output: { 'Sony': 4, 'Deutsche Bahn': 11, 'Apple Inc.': 5, ... }
// Lower scores indicate better matches
```
This example demonstrates how to instantiate the `Smartfuzzy` class with a list of strings (dictionary) and add more entries to it. You can then use it to get the closest match for a given search string.
This example demonstrates how to instantiate the `Smartfuzzy` class with a list of strings (dictionary) and add more entries to it. You can then use it to find the closest match or calculate similarity scores for a given search string.
> **Note:** The older method names `getClosestMatchForString` and `getChangeScoreForString` are still available for backward compatibility but are deprecated. It's recommended to use the new method names `findClosestMatch` and `calculateScores` instead.
### Advanced Object Sorting