def parse_state_feat_line(line):
  """
  parse single state-feature line
  :param  line:  line
  :return:       (state, feature, weight) tuple. throws RuntimeError when parse failed
  """
  cols = line.split()
  if len(cols) != 5:
    raise RuntimeError('Invalid column number:%d' % len(cols))
  state = cols[3]
  if not state.endswith(':'):
    raise RuntimeError('Colon not found at the end of state')
  return state[:-1], cols[1], float(cols[4])