Skip to content

Instantly share code, notes, and snippets.

@Dmitra
Created June 26, 2019 12:06
Show Gist options
  • Save Dmitra/57f3c8136925e2002624e41414a9c3da to your computer and use it in GitHub Desktop.
Save Dmitra/57f3c8136925e2002624e41414a9c3da to your computer and use it in GitHub Desktop.

Revisions

  1. Dmitra created this gist Jun 26, 2019.
    17 changes: 17 additions & 0 deletions transform encoding.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    class DataController
    def normalize
    @result = ""
    file = File.open("params", "w")
    file << params[:data]
    file.close
    `iconv -c -f UTF-8 -t WINDOWS-1251 params > in`
    `./mystem -l in out`
    `iconv -c -f WINDOWS-1251 -t UTF-8 out > result`
    file = File.open("result", "r")
    file.each {|line|
    @result << line
    }
    file.close
    @result.gsub!(/\{|\}/, ' ')
    end
    end