Skip to main content

Count syllables in English

Project description

概要

英語の音節数を計算するツールです。
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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

count-syllable-0.1.0.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

count_syllable-0.1.0-py3-none-any.whl (3.0 kB view details)

Uploaded Python 3

File details

Details for the file count-syllable-0.1.0.tar.gz.

File metadata

  • Download URL: count-syllable-0.1.0.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.9

File hashes

Hashes for count-syllable-0.1.0.tar.gz
Algorithm Hash digest
SHA256 64e07b7138ca15af59d64f2048b8ac3de4c86b0940c0be664347d31beae52467
MD5 05301e1c07d5f2eb0cdd7fec35f801ff
BLAKE2b-256 e79a58614ab6e9e6df6affe176ee47010ea1e4a9e7f22fb0104b71936c47617a

See more details on using hashes here.

File details

Details for the file count_syllable-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for count_syllable-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 80b10f0738e628f41c664c5a943a3fedab428d59d3a2336b46d886949fec5bef
MD5 cdb5e06db8300c10880e9cb99b022f82
BLAKE2b-256 e32aa209b48437a748e88f97069cf1fc12c88feccde464553af2e75a4d087bca

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page