JMUnidecode-Swift 1.0.0

JMUnidecode-Swift 1.0.0

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Sep 2017
SwiftSwift Version 3.0
SPMSupports SPM

Maintained by Jota Melo.



JMUnidecode

JMUnidecode is a Swift port of the Python library unidecode (which is a Python port of the Text::Unidecode Perl module). It’s currently used on jMusic’s matching algorithm and I’ve finally decided to open source it. The same tests from the Python version were also ported.

There’s also an Objective-C version

From the unidecode README:

What Unidecode provides is a function that takes Unicode data and tries to represent it in ASCII characters (i.e., the universally displayable characters between 0x00 and 0x7F). The representation is almost always an attempt at transliteration – i.e., conveying, in Roman letters, the pronunciation expressed by the text in some other writing system.

Usage

import JMUnidecode
print(JMUnidecode.unidecode("北亰")) // Prints "Bei Jing" 
print(JMUnidecode.unidecode("ⓗⓘ ⓖⓘⓣⓗⓤⓑ")) // Prints "hi github"
print(JMUnidecode.unidecode("Olá, GitHub")) // Prints "Ola, GitHub"

Installation

Manual

Just drop the JMUnidecode.swift and JMUnidecodeData.json files in your project and you’re all set!

Author

Jota Melo, [email protected]

License

JMUnidecode is available under the MIT license. See the LICENSE file for more info.