module Translator

A Module that kind of acts as an interface where the methods expected out of each vendor is encapsulated into

To use for a new vendor, simply include this module and provide caption specific implementations

Constants

AWS_KEYS

Keys for each Engine

ENGINE_AWS

Constants For Engines

ENGINE_GCP
ENGINE_KEYS
GCP_KEYS

Public Instance Methods

infer_language(text) click to toggle source

Method to infer the language by inspecting the text passed as argument

  • text - String whose language needs to be inferred

Returns

  • The ISO 639-1 Letter Language code

# File lib/engines/translator.rb, line 42
def infer_language(text)
  raise "Not Implemented. Class #{self.class.name} doesn't implement infer_language"
end
translate(input_text, src_lang, target_lang, output_file) click to toggle source

Method to translate from given language to another

  • input_text - Text which needs to be translated

  • src_lang - can be inferred using infer_language method

  • target_lang - Target 2 letter ISO language code to which the source needs to be translated in to.

# File lib/engines/translator.rb, line 55
def translate(input_text, src_lang, target_lang)
  raise "Not Implemented. Class #{self.class.name} doesn't implement translate"
end