Latest 0.1.4
Homepage https://github.com/vivqu/SwiftSyllables
License MIT
Platforms ios 8.0
Authors

Version
License
Platform

A lightweight syllable counter written in Swift.

Background

Syllable counting does not have a simple algorithmic solution so this framework takes a combination of dictionary lookups and heuristics, in two parts:

(1) Python’s Natural Language Toolkit includes a wide range of corpus for language processing. Python NLTK takes advantage of the CMU Pronunciation Dictionary which contains pronounciation transcriptions for over 100,000 words. If the word is found within the pronunciation dictionary, the first valid pronunciation is used to find the number of syllables.

(2) If the word is not found within the pronunciation dictionary, SwiftSyllables defaults to a heuristic solution. We used a straightforward implementation of Emre Aydin’s heuristic syllable counting algorithm.

The current most robust algorithmic solution to syllable counting is Frank Liang’s Stanford PhD dissertation — the implementation of the algorithm for this framework is not currently planned.

Requirements

Uses Swift 3.0, run on Xcode 8.

Installation

SwiftSyllables is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "SwiftSyllables"

Example

SwiftSyllables currently has one simple API for getting the syllable count from a string:

open class func getSyllables(_ string: String) -> Int

Simply import the framework and call the getSyllables method.

import SwiftSyllables

...

var syllables : Int = SwiftSyllables.getSyllables(string)

To run the example project, clone the repo, and run pod install from the Example directory first.

Author

License

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

Acknowledgments

Latest podspec

{
    "name": "SwiftSyllables",
    "version": "0.1.4",
    "summary": "A lightweight syllable counter written in Swift.",
    "description": "Simple syllable counter written in Swift using a combination of dictionary lookups and heuristic solution. Uses the CMU Pronunciation Dictionary which contains pronounciation transcriptions for over 100,000 words. If the word is found within the pronunciation dictionary, the first valid pronunciation is used to find the number of syllables. If the word is not found within the pronunciation dictionary, SwiftSyllables defaults to a heuristic solution. We used a straightforward implementation of Emre Aydin's heuristic syllable counting algorithm (http://eayd.in/?p=232).",
    "homepage": "https://github.com/vivqu/SwiftSyllables",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Vivian Qu": "[email protected]"
    },
    "source": {
        "git": "https://github.com/vivqu/SwiftSyllables.git",
        "tag": "0.1.4"
    },
    "social_media_url": "https://twitter.com/vivqu",
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "SwiftSyllables/Classes/**/*",
    "resource_bundles": {
        "CMUDict": [
            "SwiftSyllables/Assets/**/cmudict"
        ]
    },
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This