GithubHelp home page GithubHelp logo

isabella232 / fuzzywuzzy_swift Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lxian/fuzzywuzzy_swift

0.0 0.0 0.0 102 KB

Fuzzy String Matching in Swift using Levenshtein Distance. Ported from the python fuzzywuzzy library https://github.com/seatgeek/fuzzywuzzy

License: MIT License

Ruby 6.11% Swift 90.63% Objective-C 3.26%

fuzzywuzzy_swift's Introduction

Fuzzywuzzy_swift

Fuzzy String Matching in Swift using Levenshtein Distance. Ported from the python fuzzywuzzy library https://github.com/seatgeek/fuzzywuzzy

It has no external dependancies. And thanks to Swift String, it can support multi-language.

Installation

Carthage

Add the following line to your Cartfile. And run carthage update

github "lxian/Fuzzywuzzy_swift"

Cocoapod

Add the following line to your Podfile. And run pod install

pod 'Fuzzywuzzy_swift', :git=> 'https://github.com/lxian/Fuzzywuzzy_swift.git'

Manually

drag the Fuzzywuzzy_swift folder into your project

Usage

import Fuzzywuzzy_swift

Simple Ratio

String.fuzzRatio(str1: "some text here", str2: "same text here!") // => 93

Partial Ratio

Partial Ratio tries to match the shoter string to a substring of the longer one

String.fuzzPartialRatio(str1: "some text here", str2: "I found some text here!") // => 100

Token Sort Ratio

Split strings by white space into arrays of tokens. Sort two arrays of Tokens. Calculate the effort needed to transform on arry of token into another. Characters other than letters and numbers are removed as a pre-processing by default.

String.fuzzTokenSortRatio(str1: "fuzzy wuzzy was a bear", str2: "wuzzy fuzzy was a bear") // => 100

String.fuzzTokenSortRatio(str1: "fuzzy+wuzzy(was) a bear", str2: "wuzzy fuzzy was a bear") // => 100

set fullProcess to false to remove this pre-processing

String.fuzzTokenSortRatio(str1: "fuzzy+wuzzy(was) a bear", str2: "wuzzy fuzzy was a bear", fullProcess: false) // => 77

Token Set Ratio

Similiar to token sort ratio while it put tokens into a set trying to remove duplicated tokens.

String.fuzzTokenSortRatio(str1: "fuzzy was a bear", str2: "fuzzy fuzzy was a bear") // => 84

String.fuzzTokenSetRatio(str1: "fuzzy was a bear", str2: "fuzzy fuzzy was a bear") // => 100

fuzzywuzzy_swift's People

Contributors

aaastorga avatar lxian avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.