项目作者: GokulVSD

项目描述 :
提供计算Gunning /常规FOG索引所需的功能。包含一个音节计数器和一个基于字典的复合字分割器。
高级语言: Python
项目地址: git://github.com/GokulVSD/FOGIndex.git
创建时间: 2018-05-01T09:15:38Z
项目社区:https://github.com/GokulVSD/FOGIndex

开源协议:

下载


FOG Index

Provides functions required for calculation of Gunning / regular FOG index

#

Part of an assignment in Software Engineering (SE) during 4th semester BE. These functions were developed as a preliminary solution to meet the deadline. A more accurate and complete version of the Gunning FOG Index calculator may be found here: AnushaB05/Fog-Index

#

The compound word splitter utilises PyEnchant’s dictionary, it tries to split the word into non-compound words containing two or more letters. The simple syllable splitter may not be very accurate, but for the purpose of FOG index calculation, it gets the job done, while being relatively efficient.

#

Install PyEnchant:

  1. # PyEnchant doesn't work with 64 bit Python on Windows
  2. pip install pyenchant

Uses:

Syllable Counter

  1. from SimpleSyllableCounter import syllables
  2. syllables('continuity')
  3. syllables('pierce')
  4. syllables('pain')
  5. syllables('unanimous')
  6. syllables('ancient')
  7. syllables('euphemism')
  8. syllables('oesophagus')

Returns:

  1. 5
  2. 1
  3. 1
  4. 4
  5. 2
  6. 3
  7. 4

Compound Word Splitter

  1. from CompoundWordSplitter import split
  2. split('Undertake','en-UK')
  3. split('daydream','en-US')
  4. split('Nail-Polish')
  5. split('manual')

Returns:

  1. ['Under', 'take']
  2. ['day', 'dream']
  3. ['Nail', 'Polish']
  4. ['manual']