def load_kb(kb_filename):
  """Load KB into dictionary.

  Args:
    kb_filename: kb filename

  Returns:
    A dictionary {subject: {rel: objects}}

  """
  kb = dict()
  entities = set()
  for line in open(kb_filename):
    line = line.strip()
    subj, rel, obj = line.split('|')
    entities.add(subj.lower())
    entities.add(obj.lower())
    add_one_fact(kb, subj, rel, obj)
    if rel not in ['release_year', 'in_language', 'has_genre', 'has_tags']:
      add_one_fact(kb, obj, rel + '-inv', subj)

  return kb, list(entities)
Load KB into dictionary.

  Args:
    kb_filename: kb filename

  Returns:
    A dictionary {subject: {rel: objects}}

  
language/emql/preprocess/metaqa_preprocess.py