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.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment