https://github.com/sagiavinash/partial-match
a search util that gives match strength of a query against a sentence
https://github.com/sagiavinash/partial-match
algorithm autocomplete automation javascript npm-package search
Last synced: 7 months ago
JSON representation
a search util that gives match strength of a query against a sentence
- Host: GitHub
- URL: https://github.com/sagiavinash/partial-match
- Owner: sagiavinash
- License: mit
- Created: 2017-08-04T06:52:44.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-10-11T07:15:49.000Z (about 8 years ago)
- Last Synced: 2024-04-25T04:01:52.218Z (over 1 year ago)
- Topics: algorithm, autocomplete, automation, javascript, npm-package, search
- Language: JavaScript
- Size: 3.91 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Partial Match
- Get fullly & partially matched strings for a given query
- Primary use case being sorting autocomplete suggestions- Uses number of words matched as scoring algorithm
- Need to implement index at which the word matched as secondary sorting algorithm## Usage
```javascript
var partialMatchFactory = require('partial-match');var partialMatch = partialMatchFactory({
caseInsensitive: true,
splitByTokens: ['-', '_'],
});var sentences = [
'hello-africa',
'world is round',
'hello world',
'our_world_is_a_beautiful_world',
'7 continents',
];console.log(partialMatch.getSuggestedMatches(sentences, 'hello world'));
/* output
[
"hello world",
"our_world_is_a_beautiful_world",
"hello-africa",
"world is round",
]
*/
```