Charlock_Holmes not returning anything in Ruby? -
i'm trying use gem charlock_holmes (https://github.com/brianmario/charlock_holmes) detect , correct character formatting errors. however, program doesn't return anything.
my code is:
require 'charlock_holmes' contents = file.read('./myfile.csv') detection = charlockholmes::encodingdetector.detect(contents) # => {:encoding => 'utf-8', :confidence => 100, :type => :text} as specified in documentation.
when run in directory, nothing @ all:
user$ ruby detector.rb user$ expected behavior returns detected encoding (and, if desired, can change well). i've got gems installed, think, , i've tried under both 1.9.2 , 2.0.0.
any ideas i'm doing wrong or how find out? i'm afraid i'm new ruby, have tried pretty comprehensive search before asking , have come blank.
i think should put p detection in file detector.rb.
save code below :
require 'charlock_holmes' contents = file.read('./myfile.csv') detection = charlockholmes::encodingdetector.detect(contents) p detection now run ran earlier.
Comments
Post a Comment