Skip to content

Latest commit

 

History

History
65 lines (49 loc) · 1.45 KB

README.md

File metadata and controls

65 lines (49 loc) · 1.45 KB

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:

# PyEnchant doesn't work with 64 bit Python on Windows

pip install pyenchant

Uses:

Syllable Counter

from SimpleSyllableCounter import syllables

  syllables('continuity')
  syllables('pierce')
  syllables('pain')
  syllables('unanimous')
  syllables('ancient')
  syllables('euphemism')
  syllables('oesophagus')

Returns:

5
1
1
4
2
3
4

Compound Word Splitter

from CompoundWordSplitter import split

  split('Undertake','en-UK')
  split('daydream','en-US')
  split('Nail-Polish')
  split('manual')

Returns:

['Under', 'take']
['day', 'dream']
['Nail', 'Polish']
['manual']