Latest 0.1.1
Homepage https://github.com/yichizhang/StringScore_Swift
License MIT
Platforms ios 8.0, osx 10.9, tvos 9.0, requires ARC
Authors

StringScore_Swift is a Swift library which provides fast fuzzy string matching/scoring. Based on the JavaScript library of the same name, by Joshaven Potter.

Screenshot

Screenshot

Examples

"hello world".score(word: "axl")    // ->0.0
"hello world".score(word: "ow") // ->0.354545454545455
"hello world".score(word: "e")  // ->0.109090909090909
"hello world".score(word: "h")  // ->0.586363636363636
"hello world".score(word: "he") // ->0.622727272727273
"hello world".score(word: "hel")    // ->0.659090909090909
"hello world".score(word: "hell")   // ->0.695454545454545
"hello world".score(word: "hello")  // ->0.731818181818182
"hello world".score(word: "hello worl") // ->0.913636363636364
"hello world".score(word: "hello world")    // ->1.0
"hello world".score(word: "hello wor1") // ->0.0
"hello world".score(word: "h")  // ->0.586363636363636
"hello world".score(word: "H")  // ->0.531818181818182
"hello world".score(word: "HiMi")   // ->0.0
"hello world".score(word: "Hills")  // ->0.0
"hello world".score(word: "Hillsd") // ->0.0

"He".score(word: "h")   // ->0.675
"He".score(word: "H")   // ->0.75

"Hello".score(word: "hell") // ->0.8475
"Hello".score(word: "hello")    // ->0.93
"Hello".score(word: "hello worl")   // ->0.0
"Hello".score(word: "hello world")  // ->0.0
"Hello".score(word: "hello wor1")   // ->0.0

"hello world".score(word: "hello worl", fuzziness:0.5)  // ->0.913636363636364
"hello world".score(word: "hello world", fuzziness:0.5) // ->1.0
"hello world".score(word: "hello wor1", fuzziness:0.5)  // ->0.608181818181818

"Hillsdale Michigan".score(word: "HiMi", fuzziness:1.0) // ->0.669444444444444
"Hillsdale Michigan".score(word: "Hills", fuzziness:1.0)    // ->0.661111111111111
"Hillsdale Michigan".score(word: "Hillsd", fuzziness:1.0)   // ->0.683333333333333

Parameters

Fuzziness

A number between 0 and 1 which varys how fuzzy/ the calculation is.
Defaults to nil (fuzziness disabled).

License

Licensed under the MIT license.

Latest podspec

{
    "name": "StringScore_Swift",
    "version": "0.1.1",
    "summary": "Swift string search and fuzzy ranking. Score of 0 for no match; up to 1 for perfect.",
    "description": "Swift string search and fuzzy ranking. Score of 0 for no match; up to 1 for perfect. StringScore_Swift is a Swift library which provides fast fuzzy string matching/scoring. Based on the JavaScript library of the same name, by Joshaven Potter.",
    "homepage": "https://github.com/yichizhang/StringScore_Swift",
    "license": "MIT",
    "authors": {
        "Yichi Zhang": "[email protected]"
    },
    "source": {
        "git": "https://github.com/yichizhang/StringScore_Swift.git",
        "tag": "0.1.1"
    },
    "social_media_url": "https://twitter.com/nsyichi",
    "requires_arc": true,
    "source_files": "Source/**/*",
    "platforms": {
        "ios": "8.0",
        "osx": "10.9",
        "tvos": "9.0"
    }
}

Pin It on Pinterest

Share This