original_docstring: Write a KB out in .cfacts format.  Assumes the KB is as constructed
    by load_kb, and the type of the first argument of every relation is
    of the type defined by subject_type.  This also outputs type
    declarations but the only types are entities and words.
    
docstring: Write a KB out in .cfacts format.  Assumes the KB is as constructed
  by load_kb, and the type of the first argument of every relation is
  of the type defined by subject_type.  This also outputs type
  declarations but the only types are entities and words.
docstring_tokens: Write a KB out in . cfacts format . Assumes the KB is as constructed by load_kb and the type of the first argument of every relation is of the type defined by subject_type . This also outputs type declarations but the only types are entities and words .
code: def write_kb(kb,filename,subject_type,extra_declares=[]):
    """Write a KB out in .cfacts format.  Assumes the KB is as constructed
    by load_kb, and the type of the first argument of every relation is
    of the type defined by subject_type.  This also outputs type
    declarations but the only types are entities and words.
    """
    with open(filename,'w') as fp:
      for rel in kb:
        if rel=='has_plot' or rel=="has_feature":
          obj_type = 'word'
        else:
          obj_type = 'entity'
        fp.write('# :- %s(%s,%s_t)\n' % (rel,subject_type,obj_type))
      for decl in extra_declares:
        fp.write('# :- %s\n' % decl)
      for rel in kb:
        for sub in kb[rel]:
          for obj in kb[rel][sub]:
            fp.write('\t'.join([rel,sub,obj]) + '\n')
code_tokens: def write_kb ( kb , filename , subject_type , extra_declares = [ ] ) : with open ( filename , 'w' ) as fp : for rel in kb : if rel == 'has_plot' or rel == "has_feature" : obj_type = 'word' else : obj_type = 'entity' fp . write ( '# :- %s(%s,%s_t)\n' % ( rel , subject_type , obj_type ) ) for decl in extra_declares : fp . write ( '# :- %s\n' % decl ) for rel in kb : for sub in kb [ rel ] : for obj in kb [ rel ] [ sub ] : fp . write ( '\t' . join ( [ rel , sub , obj ] ) + '\n' )
short_docstring: Write a KB out in .cfacts format.
short_docstring_tokens: Write a KB out in . cfacts format .
comment: """Write a KB out in .cfacts format.  Assumes the KB is as constructed
    by load_kb, and the type of the first argument of every relation is
    of the type defined by subject_type.  This also outputs type
    declarations but the only types are entities and words.
    """