-
-
Notifications
You must be signed in to change notification settings - Fork 1
FAQ
This page answers common questions and recurring issues when using the CmpStr npm package. If your question is not covered here, consult the API Reference, Extending CmpStr, or open an issue on GitHub.
See the Installation & Setup page for details.
In short:
npm install cmpstrUse the CmpStr class:
import { CmpStr } from 'cmpstr';
const cmp = CmpStr.create( { metric: 'levenshtein' } );
const result = cmp.test( 'kitten', 'sitting' );For a step-by-step introduction, see Quick Start and the API Reference.
Specify the metric or processors.phonetic option when creating or configuring a CmpStr instance.
Available options are documented under Similarity Metrics and Phonetic Algorithms.
Use normalization flags (flags) for standard preprocessing, or the filter system for custom logic.
See Normalization & Filtering for details and examples.
Use the extension API exposed via cmpstr/root.
A complete guide is available on the Extending CmpStr page.
Yes. Use the CmpStrAsync class for fully Promise-based, non-blocking operations.
See the Asynchronous API page.
Open an issue to discuss bugs or feature ideas.
Pull requests are welcome for bug fixes and well-scoped improvements.
Ensure a valid map option is provided for the selected phonetic algorithm, or rely on its default mapping if available.
Example:
cmp.setProcessors( { phonetic: { algo: 'soundex', opt: { map: 'en' } } } );This typically indicates invalid option merging in user code.
Make sure you are not:
- Passing primitive values instead of objects
- Passing frozen or immutable objects
If the issue appears to originate from CmpStr itself, please report it on GitHub.
By default, CmpStr throws an error when given empty inputs, as no comparison can be performed.
You can enable a “safe” mode by setting the safeEmpty option to return an empty array instead of throwing:`
const cmp = CmpStr.create( { safeEmpty: true } );
cmp.batchTest( [], [ 'foo' ] ); // returns []Make sure your implementation is registered at runtime using the appropriate registry:
MetricRegistryPhoneticRegistry
Do not modify files inside node_modules/cmpstr.
See Extending CmpStr for correct usage.
Use the Normalizer and Filter classes directly to test individual steps of your preprocessing pipeline.
Check the Normalization & Filtering page for examples and tips.
First, check the API Reference and relevant documentation pages.
If the problem persists, open an issue on GitHub and include a minimal reproducible example.
See the Changelog and License & Credits pages.
If your question is not answered here, please:
- Review the API Reference and documentation pages.
- Search or open an issue on GitHub.
CmpStr is actively maintained and community feedback is welcome!
CmpStr 3.2 / API Reference • FAQ • npm Package • jsDelivr • DevDocs
CmpStr is a lightweight, fast and well performing package for calculating string similarity.
Getting Started
Installation & Setup
Quick Start
API Reference
Documentation
Similarity Metrics
Phonetic Algorithms
Normalization & Filtering
Comparison Modes
Structured Data
Asynchronous API
Diff & Text Analysis
Extending CmpStr
Project Management