Vim buffer can be used both as an input and output for other shell commands.
#!/usr/bin/env ruby require 'lingua' input = ARGF.read report = Lingua::EN::Readability.new(input) puts report.report
By the way the file content above has been inserted with
:read ~/lingua.rb. Now getting statistics is as easy as this:
:write ! ruby ~/linuga.rb Number of paragraphs 259 Number of sentences 136 Number of words 1400 Number of characters 9885 Average words per sentence 10.29 Average syllables per word 1.48 Flesch score 70.94 Flesh-Kincaid grade level 5.92 Fog Index 7.75
Please note that the whole buffer content has been redirected to standard input that