{"action":"opened","issue":{"url":"https://api.github.com/repos/shivam5992/textstat/issues/70","repository_url":"https://api.github.com/repos/shivam5992/textstat","labels_url":"https://api.github.com/repos/shivam5992/textstat/issues/70/labels{/name}","comments_url":"https://api.github.com/repos/shivam5992/textstat/issues/70/comments","events_url":"https://api.github.com/repos/shivam5992/textstat/issues/70/events","html_url":"https://github.com/shivam5992/textstat/issues/70","id":388922434,"node_id":"MDU6SXNzdWUzODg5MjI0MzQ=","number":70,"title":"Incorrect Gunning Fog Calculation","user":{"login":"bradfordlynch","id":5950006,"node_id":"MDQ6VXNlcjU5NTAwMDY=","avatar_url":"https://avatars0.githubusercontent.com/u/5950006?v=4","gravatar_id":"","url":"https://api.github.com/users/bradfordlynch","html_url":"https://github.com/bradfordlynch","followers_url":"https://api.github.com/users/bradfordlynch/followers","following_url":"https://api.github.com/users/bradfordlynch/following{/other_user}","gists_url":"https://api.github.com/users/bradfordlynch/gists{/gist_id}","starred_url":"https://api.github.com/users/bradfordlynch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bradfordlynch/subscriptions","organizations_url":"https://api.github.com/users/bradfordlynch/orgs","repos_url":"https://api.github.com/users/bradfordlynch/repos","events_url":"https://api.github.com/users/bradfordlynch/events{/privacy}","received_events_url":"https://api.github.com/users/bradfordlynch/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-12-08T13:30:00Z","updated_at":"2018-12-08T13:30:00Z","closed_at":null,"author_association":"NONE","body":"In the FOG calculation, complex words are defined as those words having 3 or more syllables. Not that Wikipedia is the best source of information, but see list item 3 [here](https://en.wikipedia.org/wiki/Gunning_fog_index#Calculation). But, as you can see in the snippet below from [_textstat.py_](https://github.com/shivam5992/textstat/blob/master/textstat/textstat.py) the threshold for a difficult word is: not in the easy_word_set and more than one syllable. (Lines 254-255)\r\n\r\n```python\r\n    @repoze.lru.lru_cache(maxsize=128)\r\n    def difficult_words(self, text):\r\n        text_list = re.findall(r\"[\\w\\='‘’]+\", text.lower())\r\n        diff_words_set = set()\r\n        for value in text_list:\r\n            if value not in easy_word_set:\r\n                if self.syllable_count(value) > 1:\r\n                    diff_words_set.add(value)\r\n        return len(diff_words_set)\r\n\r\n    @repoze.lru.lru_cache(maxsize=128)\r\n    def dale_chall_readability_score(self, text):\r\n        word_count = self.lexicon_count(text)\r\n        count = word_count - self.difficult_words(text)\r\n\r\n        try:\r\n            per = float(count) / float(word_count) * 100\r\n        except ZeroDivisionError:\r\n            return 0.0\r\n\r\n        difficult_words = 100 - per\r\n\r\n        score = (\r\n            (0.1579 * difficult_words)\r\n            + (0.0496 * self.avg_sentence_length(text)))\r\n\r\n        if difficult_words > 5:\r\n            score += 3.6365\r\n        return legacy_round(score, 2)\r\n\r\n    @repoze.lru.lru_cache(maxsize=128)\r\n    def gunning_fog(self, text):\r\n        try:\r\n            per_diff_words = (\r\n                (self.difficult_words(text) / self.lexicon_count(text) * 100))\r\n\r\n            grade = 0.4 * (self.avg_sentence_length(text) + per_diff_words)\r\n            return legacy_round(grade, 2)\r\n        except ZeroDivisionError:\r\n            return 0.0`"}}
{"actor":{"display_login":"bradfordlynch"}}