You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: change_word.rb
    path of file: ./repos/ruby/test/did_you_mean/tree_spell
    
    the code of the file until where you have to start completion: module TreeSpell
  # Changes a word with one of four actions:
  # insertion, substitu
    
    def transposition(i_place, direction)
      @word = input.dup
      w = word.dup
      return  swap_first_two(w) if i_place + direction < 0
      return  swap_last_two(w) if i_place + direction >= len
      swap_two(w, i_place, direction)
      w
    end