odyssey icon indicating copy to clipboard operation
odyssey copied to clipboard

Gunning Fog returns zero

Open bottlehall opened this issue 1 year ago • 0 comments

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')

bottlehall avatar Jan 09 '24 11:01 bottlehall