import io


def load_supersenses(filename):
  """
  Loads a file with a list of all 26 WordNet noun supersenses.
  Returns:
    stoi : A mapping from supersense name (str) to integer id.
    itos : A list of supersense names (str), indices is integer id.
  """
  stoi = {}
  itos = []
  with io.open(filename, 'r') as fp:
    for i, line in enumerate(fp):
      line = line.strip()
      assert line.startswith("noun")
      assert len(line.split()) == 1
      itos.append(line)
      stoi[line] = i
  assert len(itos) == 26
  return stoi, itos