ZebulonFrantzich / DoubleMetaphoneSwift

A Swift implementation of the Double Metaphone algorithm

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DoubleMetaphoneSwift

This is an implementation of the Double Metaphone algorithm in Swift. The algorithm was originally coded by Lawrence Philips.

Setting up with CocoaPods

source 'https://github.com/CocoaPods/Specs.git'
pod 'DoubleMetaphoneSwift', '~> 0.0.1'

Usage

Import DoubleMetaphoneSwift at the top of the Swift file.

import DoubleMetaphoneSwift

The returned Double Metaphone calculation returns the primary and secondary calculations as a tuple.

guard let (primary, secondary) = DoubleMetaphoneSwift.calculate(input: "Hello World!") else {
    print("Failed to calculate...")
    return
}

print("Primary: \(primary)")      // Primary: HLRL
print("Secondary: \(secondary)")  // Secondary: HLRL

About

A Swift implementation of the Double Metaphone algorithm

License:MIT License


Languages

Language:C 83.0%Language:Swift 8.1%Language:Ruby 5.6%Language:Objective-C 3.0%Language:C++ 0.3%