Skip to content

Gunning Fog returns zero #40

@bottlehall

Description

@bottlehall

Odyssey.analyze_all(text)

Executes and returns good results for Flesh-Kincaid GL but zero for the Gunning Fog index, whatever is supplied as text.

Odyssey.flesch_kincaid_gl(text)

Again, works as expected, but:

Odyssey.gunning_fog(text)

Errors with:

/opt/homebrew/lib/ruby/gems/3.2.0/gems/odyssey-0.3.2/lib/odyssey/engine.rb:189:in merge_scores_with_sentences': undefined method length' for 0:Integer (NoMethodError)

  for i in 0..@score_by_sentence.length-1
                                ^^^^^^^

from /opt/homebrew/lib/ruby/gems/3.2.0/gems/odyssey-0.3.2/lib/odyssey/engine.rb:181:in get_stats' from /opt/homebrew/lib/ruby/gems/3.2.0/gems/odyssey-0.3.2/lib/odyssey.rb:14:in analyze'
from /opt/homebrew/lib/ruby/gems/3.2.0/gems/odyssey-0.3.2/lib/odyssey.rb:47:in method_missing' from /Users/npr/test-fog-workflow/lib/fkgl.rb:11:in block in initialize'
from /Users/npr/test-fog-workflow/lib/fkgl.rb:9:in map' from /Users/npr/test-fog-workflow/lib/fkgl.rb:9:in initialize'
from bin/readability:22:in new' from bin/readability:22:in index'
from /opt/homebrew/lib/ruby/gems/3.2.0/gems/thor-1.3.0/lib/thor/command.rb:28:in run' from /opt/homebrew/lib/ruby/gems/3.2.0/gems/thor-1.3.0/lib/thor/invocation.rb:127:in invoke_command'
from /opt/homebrew/lib/ruby/gems/3.2.0/gems/thor-1.3.0/lib/thor.rb:527:in dispatch' from /opt/homebrew/lib/ruby/gems/3.2.0/gems/thor-1.3.0/lib/thor/base.rb:584:in start'
from bin/readability:27:in `

'

There seems to be some discrepancy in the way the Gunning Fog is described, sometimes 'Gunning Fog' and sometimes 'Gunning Fog Score', but trying both gives zero in:

Odyssey.analyze(text,'Gunning Fog')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions