def load_entities(geobase_file):
  """Returns list of GeoEntity tuples for geobase entities."""
  # Identifier string to GeoEntity tuple.
  identifiers_to_entities = {}

  with gfile.GFile(geobase_file, "r") as inputfile:
    for line in inputfile:
      # line = line.decode("latin1")
      if line.startswith("state"):
        splits = line.split("'")
        state_name = splits[1]
        state_abbreviation = splits[3]
        city_capital = splits[5]
        city_1 = splits[7]
        city_2 = splits[9]
        city_3 = splits[11]
        city_4 = splits[13]
        _add_state_constant(state_name, identifiers_to_entities)
        for city_name in [city_capital, city_1, city_2, city_3, city_4]:
          _add_city_constants(city_name, state_name, state_abbreviation,
                              identifiers_to_entities)

      elif line.startswith("city"):
        state_name = line.split("'")[1]
        state_abbreviation = line.split("'")[3]
        city_name = line.split("'")[5]
        _add_city_constants(city_name, state_name, state_abbreviation,
                            identifiers_to_entities)

      elif line.startswith("river"):
        river_name = line.split("'")[1]
        _add_river_constant(river_name, identifiers_to_entities)

      elif line.startswith("mountain"):
        mountain_name = line.split("'")[5]
        _add_place_constant(mountain_name, identifiers_to_entities)

      elif line.startswith("highlow"):
        lowpoint_name = line.split("'")[5]
        highpoint_name = line.split("'")[7]
        _add_place_constant(lowpoint_name, identifiers_to_entities)
        _add_place_constant(highpoint_name, identifiers_to_entities)

  # This city is not mentioned in geobase directly, but referenced by a query
  # in the train set.
  _add_city_constants("springfield", "south dakota", "sd",
                      identifiers_to_entities)
  _add_usa(identifiers_to_entities)
  return identifiers_to_entities.values()
Returns list of GeoEntity tuples for geobase entities.
language/compgen/nqg/tasks/geoquery/geobase_utils.py