class Glaemscribe::API::TranscriptionPostProcessor

Attributes

out_space[RW]

Public Instance Methods

apply(tokens, out_charset) click to toggle source
# File lib/api/transcription_pre_post_processor.rb, line 123
def apply(tokens, out_charset)
  
  out_space_str     = " "
  out_space_str     = @out_space.map{ |token| out_charset[token].str }.join("") if @out_space
   
  # Apply filters
  @operators.each{ |operator|
    tokens = operator.apply(tokens,out_charset)
  } 
  
  # Convert output
  ret = ""
  tokens.each{ |token|
    case token 
      when ""
      when "*UNKNOWN"
         ret += UNKNOWN_CHAR_OUTPUT
      when "*SPACE"
          ret += out_space_str
      when "*LF"
         ret += "\n"
      else
        c = out_charset[token]       
        ret += (c.nil?)?(UNKNOWN_CHAR_OUTPUT):c.str
    end        
  }
  ret
end