original_docstring: Reads all documents in the Mongo collection and calculates field frequencies.
          i.e. For DBpedia collection, it returns all entity fields.
  
      :return a dictionary of fields and their frequency
      
docstring: Reads all documents in the Mongo collection and calculates field frequencies.
  
  :return a dictionary of fields and their frequency
docstring_tokens: Reads all documents in the Mongo collection and calculates field frequencies . : return a dictionary of fields and their frequency
code: def compute_field_counts():
      """Reads all documents in the Mongo collection and calculates field frequencies.
          i.e. For DBpedia collection, it returns all entity fields.
  
      :return a dictionary of fields and their frequency
      """
      PLOGGER.info("Counting fields ...")
      dbpedia_coll = Mongo(MONGO_HOST, MONGO_DB, MONGO_COLLECTION_DBPEDIA).find_all()
      i = 0
      field_counts = dict()
      for entity in dbpedia_coll:
          for field in entity:
              if field == Mongo.ID_FIELD:
                  continue
              if field in field_counts:
                  field_counts[field] += 1
              else:
                  field_counts[field] = 1
          i += 1
          if i % 1000000 == 0:
              PLOGGER.info("\t" + str(int(i / 1000000)) + "M entity is processed!")
      return field_counts
code_tokens: def compute_field_counts ( ) : PLOGGER . info ( "Counting fields ..." ) dbpedia_coll = Mongo ( MONGO_HOST , MONGO_DB , MONGO_COLLECTION_DBPEDIA ) . find_all ( ) i = 0 field_counts = dict ( ) for entity in dbpedia_coll : for field in entity : if field == Mongo . ID_FIELD : continue if field in field_counts : field_counts [ field ] += 1 else : field_counts [ field ] = 1 i += 1 if i % 1000000 == 0 : PLOGGER . info ( "\t" + str ( int ( i / 1000000 ) ) + "M entity is processed!" ) return field_counts
short_docstring: Reads all documents in the Mongo collection and calculates field frequencies.
short_docstring_tokens: Reads all documents in the Mongo collection and calculates field frequencies .
comment: """Reads all documents in the Mongo collection and calculates field frequencies.
          i.e. For DBpedia collection, it returns all entity fields.
  
      :return a dictionary of fields and their frequency
      """