Yomguithereal / talisman

Straightforward fuzzy matching, information retrieval and NLP building blocks for JavaScript.
https://yomguithereal.github.io/talisman/
MIT License
704 stars 47 forks source link

Prevent fingerprint from sorting #179

Closed david-raine-mns closed 3 years ago

david-raine-mns commented 3 years ago

Is there any way to use fingerprint without the final alphabetic sort phase? It looks like it uses a tokenizer that appears to have a "sort: true" in the options, but I can't seem to figure out how to pass that through.

Yomguithereal commented 3 years ago

Yes, there is a way, albeit undocumented (sorry about that :) ). You need to create your own tokenizer/keyer using the exported factory function thusly:

import {createKeyer} from 'talisman/keyers/fingerprint';
// Or if you want to create a fingerprint tokenizer
import {createTokenizer} from 'talisman/tokenizers/fingerprint';

const fingerprint = createKeyer({sort: true});

The full list of options can be found here if you need.

david-raine-mns commented 3 years ago

That is perfect and works a treat. Many thanks for this wonderful library.