Skip to content

A string similarity metric diffing algorithm invented by splinestein for chat bot use.

License

Notifications You must be signed in to change notification settings

splinestein/splinestein-diffing-algorithm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

splinestein-diffing-algorithm

A string similarity metric diffing algorithm invented by splinestein for primitive chat bot use.

How to use?

  1. Put the module into ReplicatedStorage.
  2. In your script, require it with: local sdiff = require(game:GetService("ReplicatedStorage"):FindFirstChild("StringDiff"))
  3. Run it with ratio, _ = sdiff.compare("Hey is this working?, "Hey this is working?")
  4. First return value is the ratio from 0 - 100, second optional return value is the longest match.
  5. print(ratio)

I've tested this for primitive chat bot use and it's working nicely.

It is worth mentioning that this will have O(n) complexity if iterating over any dataset, so keep the dataset small unless you use better querying techniques on the dataset like FTS.

Hope you enjoy. Feel free to suggest any changes.

About

A string similarity metric diffing algorithm invented by splinestein for chat bot use.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published