def check_spelling(spell_check_text, command, lang)
      xml_response_values = Array.new
      spell_check_text = spell_check_text.join(' ') if command == 'checkWords'
      logger.debug("Spellchecking via:  echo \"#{spell_check_text}\" | #{ASPELL_PATH} -a -l #{lang}")
      spell_check_response = `echo "#{spell_check_text}" | #{ASPELL_PATH} -a -l #{lang}`
      return xml_response_values if spell_check_response.blank?
      spelling_errors = spell_check_response.split("\n").slice(1..-1)
      for error in spelling_errors
        error.strip!
        if (match_data = error.match(ASPELL_WORD_DATA_REGEX))
          if (command == 'checkWords')
            arr = match_data[0].split(' ')
            xml_response_values << arr[1]
          elsif (command == 'getSuggestions')
            xml_response_values << error.split(',')[1..-1].collect(&:strip!)
            xml_response_values = xml_response_values.first
          end
        end
      end
      return xml_response_values
    end
def check_spelling(spell_check_text, command, lang)
      xml_response_values = Array.new
      spell_check_text = spell_check_text.join(' ') if command == 'checkWords'
      logger.debug("Spellchecking via:  echo \"#{spell_check_text}\" | #{ASPELL_PATH} -a -l #{lang}")
      spell_check_response = `echo "#{spell_check_text}" | #{ASPELL_PATH} -a -l #{lang}`
      return xml_response_values if spell_check_response.blank?
      spelling_errors = spell_check_response.split("\n").slice(1..-1)
      for error in spelling_errors
        error.strip!
        if (match_data = error.match(ASPELL_WORD_DATA_REGEX))
          if (command == 'checkWords')
            arr = match_data[0].split(' ')
            xml_response_values << arr[1]
          elsif (command == 'getSuggestions')
            xml_response_values << error.split(',')[1..-1].collect(&:strip!)
            xml_response_values = xml_response_values.first
          end
        end
      end
      return xml_response_values
    end
This method is called by the spellchecker action.
 Is sends a command to the system, and parses the output
 Returns different value depending on the command (checking words, or getting suggestions)