count-syllable


Namecount-syllable JSON
Version 0.1.0 PyPI version JSON
download
home_pagehttps://github.com/ShinyaAkagiI/count_syllable
SummaryCount syllables in English
upload_time2024-03-31 17:23:33
maintainerNone
docs_urlNone
authorShinya Akagi
requires_pythonNone
licensePSF
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 概要

英語の音節数を計算するツールです。  
nltkのcmudict(カーネギーメロン大学が作成した発音辞書)をベースとして、非収録語にもある程度対応できるアルゴリズムを採用しています。  

# セットアップ
```
pip install count-syllable
```

# アンインストール
```
pip uninstall count-syllable nltk
```

# 使用方法
```
from count_syllable import count_syllable

data = count_syllable("anyone")

print(data)
```

# アルゴリズム

前方単語ブロック、後方単語ブロック、中間単語ブロックに分けて考える  

(1)単語がcmudictに存在するか参照しあればその音節数を前方単語ブロックの音節数とする、なければ後方文字を一文字削減して再度参照し、2文字以下になるまで繰り返す
(2)2文字以下になった場合は、母音の数を計算し、前方単語ブロックの音節数とする
(3)前方単語ブロックを除いた単語がcmudictに存在するか参照しあればその音節数を後方単語ブロックの音節数とする、なければ前方文字を一文字削減して再度参照し、2文字以下になるまで繰り返す
(4)2文字以下になった場合は、母音の数を計算し、後方単語ブロックの音節数とする
(5)前方単語ブロック、後方単語ブロックを除いた単語について、母音の数を計算し、中間単語ブロックの音節数とする
(6)2文字以下になった単語をまとめて、二重母音の数を計算する
(7)前方単語ブロック、後方単語ブロック、中間単語ブロックの音節数を加算し、二重母音の数を減算して、単語の音節数を求める

# 関連ツール、関連サイト

## Sylco: https://github.com/eaydin/sylco
独自アルゴリズムで英語の音節数を計算するツール。
ライセンスが非記載のため、利用用途は限られるが、アルゴリズムは参考になる。
  
## How Many Syllables: https://www.howmanysyllables.com
5つの手法を用いて英語の音節数を計算するサイト。  
詳細な使用アルゴリズムは不明だが、多くの英単語に対応している。  
  
# 論文

論文化、または、学会発表を予定してます。  


# ライセンス
- count-syllable
	- Python Software Foundation License
	- Copyright (C) 2024 Shinya Akagi
- nltk
	- Apache License 2.0
	- Copyright (C) 2001-2023 NLTK Project
- cmudict
	- BSD License
	- Copyright (C) 1998 Carnegie Mellon University
  

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/ShinyaAkagiI/count_syllable",
    "name": "count-syllable",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": null,
    "author": "Shinya Akagi",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/e7/9a/58614ab6e9e6df6affe176ee47010ea1e4a9e7f22fb0104b71936c47617a/count-syllable-0.1.0.tar.gz",
    "platform": null,
    "description": "# \u6982\u8981\n\n\u82f1\u8a9e\u306e\u97f3\u7bc0\u6570\u3092\u8a08\u7b97\u3059\u308b\u30c4\u30fc\u30eb\u3067\u3059\u3002  \nnltk\u306ecmudict(\u30ab\u30fc\u30cd\u30ae\u30fc\u30e1\u30ed\u30f3\u5927\u5b66\u304c\u4f5c\u6210\u3057\u305f\u767a\u97f3\u8f9e\u66f8)\u3092\u30d9\u30fc\u30b9\u3068\u3057\u3066\u3001\u975e\u53ce\u9332\u8a9e\u306b\u3082\u3042\u308b\u7a0b\u5ea6\u5bfe\u5fdc\u3067\u304d\u308b\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u3092\u63a1\u7528\u3057\u3066\u3044\u307e\u3059\u3002  \n\n# \u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\n```\npip install count-syllable\n```\n\n# \u30a2\u30f3\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\n```\npip uninstall count-syllable nltk\n```\n\n# \u4f7f\u7528\u65b9\u6cd5\n```\nfrom count_syllable import count_syllable\n\ndata = count_syllable(\"anyone\")\n\nprint(data)\n```\n\n# \u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\n\n\u524d\u65b9\u5358\u8a9e\u30d6\u30ed\u30c3\u30af\u3001\u5f8c\u65b9\u5358\u8a9e\u30d6\u30ed\u30c3\u30af\u3001\u4e2d\u9593\u5358\u8a9e\u30d6\u30ed\u30c3\u30af\u306b\u5206\u3051\u3066\u8003\u3048\u308b  \n\n(1)\u5358\u8a9e\u304ccmudict\u306b\u5b58\u5728\u3059\u308b\u304b\u53c2\u7167\u3057\u3042\u308c\u3070\u305d\u306e\u97f3\u7bc0\u6570\u3092\u524d\u65b9\u5358\u8a9e\u30d6\u30ed\u30c3\u30af\u306e\u97f3\u7bc0\u6570\u3068\u3059\u308b\u3001\u306a\u3051\u308c\u3070\u5f8c\u65b9\u6587\u5b57\u3092\u4e00\u6587\u5b57\u524a\u6e1b\u3057\u3066\u518d\u5ea6\u53c2\u7167\u3057\u30012\u6587\u5b57\u4ee5\u4e0b\u306b\u306a\u308b\u307e\u3067\u7e70\u308a\u8fd4\u3059\n(2)2\u6587\u5b57\u4ee5\u4e0b\u306b\u306a\u3063\u305f\u5834\u5408\u306f\u3001\u6bcd\u97f3\u306e\u6570\u3092\u8a08\u7b97\u3057\u3001\u524d\u65b9\u5358\u8a9e\u30d6\u30ed\u30c3\u30af\u306e\u97f3\u7bc0\u6570\u3068\u3059\u308b\n(3)\u524d\u65b9\u5358\u8a9e\u30d6\u30ed\u30c3\u30af\u3092\u9664\u3044\u305f\u5358\u8a9e\u304ccmudict\u306b\u5b58\u5728\u3059\u308b\u304b\u53c2\u7167\u3057\u3042\u308c\u3070\u305d\u306e\u97f3\u7bc0\u6570\u3092\u5f8c\u65b9\u5358\u8a9e\u30d6\u30ed\u30c3\u30af\u306e\u97f3\u7bc0\u6570\u3068\u3059\u308b\u3001\u306a\u3051\u308c\u3070\u524d\u65b9\u6587\u5b57\u3092\u4e00\u6587\u5b57\u524a\u6e1b\u3057\u3066\u518d\u5ea6\u53c2\u7167\u3057\u30012\u6587\u5b57\u4ee5\u4e0b\u306b\u306a\u308b\u307e\u3067\u7e70\u308a\u8fd4\u3059\n(4)2\u6587\u5b57\u4ee5\u4e0b\u306b\u306a\u3063\u305f\u5834\u5408\u306f\u3001\u6bcd\u97f3\u306e\u6570\u3092\u8a08\u7b97\u3057\u3001\u5f8c\u65b9\u5358\u8a9e\u30d6\u30ed\u30c3\u30af\u306e\u97f3\u7bc0\u6570\u3068\u3059\u308b\n(5)\u524d\u65b9\u5358\u8a9e\u30d6\u30ed\u30c3\u30af\u3001\u5f8c\u65b9\u5358\u8a9e\u30d6\u30ed\u30c3\u30af\u3092\u9664\u3044\u305f\u5358\u8a9e\u306b\u3064\u3044\u3066\u3001\u6bcd\u97f3\u306e\u6570\u3092\u8a08\u7b97\u3057\u3001\u4e2d\u9593\u5358\u8a9e\u30d6\u30ed\u30c3\u30af\u306e\u97f3\u7bc0\u6570\u3068\u3059\u308b\n(6)2\u6587\u5b57\u4ee5\u4e0b\u306b\u306a\u3063\u305f\u5358\u8a9e\u3092\u307e\u3068\u3081\u3066\u3001\u4e8c\u91cd\u6bcd\u97f3\u306e\u6570\u3092\u8a08\u7b97\u3059\u308b\n(7)\u524d\u65b9\u5358\u8a9e\u30d6\u30ed\u30c3\u30af\u3001\u5f8c\u65b9\u5358\u8a9e\u30d6\u30ed\u30c3\u30af\u3001\u4e2d\u9593\u5358\u8a9e\u30d6\u30ed\u30c3\u30af\u306e\u97f3\u7bc0\u6570\u3092\u52a0\u7b97\u3057\u3001\u4e8c\u91cd\u6bcd\u97f3\u306e\u6570\u3092\u6e1b\u7b97\u3057\u3066\u3001\u5358\u8a9e\u306e\u97f3\u7bc0\u6570\u3092\u6c42\u3081\u308b\n\n# \u95a2\u9023\u30c4\u30fc\u30eb\u3001\u95a2\u9023\u30b5\u30a4\u30c8\n\n## Sylco: https://github.com/eaydin/sylco\n\u72ec\u81ea\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u3067\u82f1\u8a9e\u306e\u97f3\u7bc0\u6570\u3092\u8a08\u7b97\u3059\u308b\u30c4\u30fc\u30eb\u3002\n\u30e9\u30a4\u30bb\u30f3\u30b9\u304c\u975e\u8a18\u8f09\u306e\u305f\u3081\u3001\u5229\u7528\u7528\u9014\u306f\u9650\u3089\u308c\u308b\u304c\u3001\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u306f\u53c2\u8003\u306b\u306a\u308b\u3002\n  \n## How Many Syllables: https://www.howmanysyllables.com\n5\u3064\u306e\u624b\u6cd5\u3092\u7528\u3044\u3066\u82f1\u8a9e\u306e\u97f3\u7bc0\u6570\u3092\u8a08\u7b97\u3059\u308b\u30b5\u30a4\u30c8\u3002  \n\u8a73\u7d30\u306a\u4f7f\u7528\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u306f\u4e0d\u660e\u3060\u304c\u3001\u591a\u304f\u306e\u82f1\u5358\u8a9e\u306b\u5bfe\u5fdc\u3057\u3066\u3044\u308b\u3002  \n  \n# \u8ad6\u6587\n\n\u8ad6\u6587\u5316\u3001\u307e\u305f\u306f\u3001\u5b66\u4f1a\u767a\u8868\u3092\u4e88\u5b9a\u3057\u3066\u307e\u3059\u3002  \n\n\n# \u30e9\u30a4\u30bb\u30f3\u30b9\n- count-syllable\n\t- Python Software Foundation License\n\t- Copyright (C) 2024 Shinya Akagi\n- nltk\n\t- Apache License 2.0\n\t- Copyright (C) 2001-2023 NLTK Project\n- cmudict\n\t- BSD License\n\t- Copyright (C) 1998 Carnegie Mellon University\n  \n",
    "bugtrack_url": null,
    "license": "PSF",
    "summary": "Count syllables in English",
    "version": "0.1.0",
    "project_urls": {
        "Homepage": "https://github.com/ShinyaAkagiI/count_syllable"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e32aa209b48437a748e88f97069cf1fc12c88feccde464553af2e75a4d087bca",
                "md5": "cdb5e06db8300c10880e9cb99b022f82",
                "sha256": "80b10f0738e628f41c664c5a943a3fedab428d59d3a2336b46d886949fec5bef"
            },
            "downloads": -1,
            "filename": "count_syllable-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "cdb5e06db8300c10880e9cb99b022f82",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 2960,
            "upload_time": "2024-03-31T17:23:31",
            "upload_time_iso_8601": "2024-03-31T17:23:31.897669Z",
            "url": "https://files.pythonhosted.org/packages/e3/2a/a209b48437a748e88f97069cf1fc12c88feccde464553af2e75a4d087bca/count_syllable-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e79a58614ab6e9e6df6affe176ee47010ea1e4a9e7f22fb0104b71936c47617a",
                "md5": "05301e1c07d5f2eb0cdd7fec35f801ff",
                "sha256": "64e07b7138ca15af59d64f2048b8ac3de4c86b0940c0be664347d31beae52467"
            },
            "downloads": -1,
            "filename": "count-syllable-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "05301e1c07d5f2eb0cdd7fec35f801ff",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 3030,
            "upload_time": "2024-03-31T17:23:33",
            "upload_time_iso_8601": "2024-03-31T17:23:33.744252Z",
            "url": "https://files.pythonhosted.org/packages/e7/9a/58614ab6e9e6df6affe176ee47010ea1e4a9e7f22fb0104b71936c47617a/count-syllable-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-31 17:23:33",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ShinyaAkagiI",
    "github_project": "count_syllable",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "count-syllable"
}
        
Elapsed time: 0.34052s