text: def cast_result(filename, options = 0):
      """
      filename(str): filename of GIZA++
      options(int):
      """
      if options == 0:
          f = open(filename, 'r')
          lines = f.readlines()
  
      output = []
  
      for idx, value in enumerate(lines):
          if (idx+1) % 3 == 0:
              b = value.split(' ')
              count, line_output, pointer, n, begin = 0, "", 0, len(b), False
              while pointer < n:
                  if b[pointer] == '({':
                      begin = True
                      pointer += 1
                      continue
                  elif b[pointer] == '})':
                      begin = False
                      count += 1
                      pointer += 1
                      continue
  
                  if begin:
                      if count == 0:
                          pointer += 1
                          continue
                      # line_output += str(int(b[pointer]) - 1) + '-' + str(count - 1) + ' ' e-f
                      line_output += str(count-1) + '-' + str(int(b[pointer]) - 1) + ' '
  
                  pointer += 1
              line_output += '\n'
              output.append(line_output)
      f.close()
      return output
  
  
  
  
  output = cast_result('ALIGNED.VA3.final')
  g = open("test2", 'w')
  g.writelines((output))
  g.close()
  