Skip to content

happtic/rite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rite

rite: be equal, similar (to something else).

He rite te tikanga o tēnei ki tō runga ake nei. / The meaning of this is similar to that of the above.

A string similarity library. It finds degree of similarity between strings, based on Dice’s Coefficient, which is mostly better than Levenshtein distance.

Why?

This is a clojurescript port of the javascript string-similarity library. It was built for a few reasons:

  • Learning.
  • We use string-similarity within BeeCastle and had an issue with older versions of Internet Explorer, and wanted something that would work in that environment.
  • It was also an exercise in converting a very imperative, mutable state driven algorithm to a functional, immutable one.

Usage

CLJS

Require the namespace

(ns example.core
  (:require [rite.core :as rite]))

Get best match to a given string from a set of other strings

(-> (rite.find-best-match "healed" ["mailed" "edward" "sealed" "theatre"])
    :best-match
    :target) ;; => "sealed"

Node/Browser

var rite = require('./build/rite');
rite.findBestMatch('healed', ['mailed', 'edward', 'sealed', 'theatre']).bestMatch.target; // 'sealed'

About

A clojurescript port of the javascript `string-similarity` library.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published