<jupyter_start><jupyter_text>Summary DataThe `getSummaryData()` and `getSummaryDataDirect()` methods obtain general summary data about your current audit session.<jupyter_code>import os
import sys
import json<jupyter_output><empty_output><jupyter_text>G2AuditThe G2Audit API allows you to pull data reporting data back on how one data source is related to another.Once you are done loading one or more data sources,use this API to query information that can be useful for reporting, browsing, or auditing results.<jupyter_code>from G2Audit import G2Audit<jupyter_output><empty_output><jupyter_text>Initialize variablesCreate variables to be used as `getSummaryData()` parameters.<jupyter_code>module_name = 'pyG2AuditForGetSummary'
senzing_directory = os.environ.get("SENZING_DIR", "/opt/senzing")
senzing_python_directory = "{0}/g2/python".format(senzing_directory)
g2module_ini_pathname = "{0}/G2Module.ini".format(senzing_python_directory)<jupyter_output><empty_output><jupyter_text>System pathUpdate system path.<jupyter_code>sys.path.append(senzing_python_directory)<jupyter_output><empty_output><jupyter_text>InitializationTo start using Senzing G2Audit, create and initialize an instance.This should be done once per process.The `init()` method accepts the following parameters:- **module_name:** A short name given to this instance of the G2 Module.- **g2module_ini_pathname:** A fully qualified path to the G2 engine INI file (often /opt/senzing/g2/python/G2Module.ini)Calling `init()` will return "0" upon success.<jupyter_code>g2_audit = G2Audit()
g2_audit.init(module_name, g2module_ini_pathname)<jupyter_output><empty_output><jupyter_text>openSession()Create a new session.<jupyter_code>g2_audit_session = g2_audit.openSession()<jupyter_output><empty_output><jupyter_text>getSummaryData()Call G2Audit's `getSummaryData()` method and pretty-print results.The `getSummaryData()` method accepts the following parameters:- **g2_audit_session:** A long integer representing a previously-created G2Audit object.- **response_list:** A memory buffer for returning the response document; if an error occurred, an error response is stored here.<jupyter_code>response_list = []
result = g2_audit.getSummaryData(g2_audit_session, response_list)

response_string = "".join(response_list)
response_dictionary = json.loads(response_string)
response = json.dumps(response_dictionary, sort_keys=True, indent=4)
print("Result: {0}\n{1}".format(result, response))<jupyter_output><empty_output><jupyter_text>closeSession()<jupyter_code>g2_audit.closeSession(g2_audit_session)<jupyter_output><empty_output><jupyter_text>getSummaryDataDirect()Call G2Audit's `getSummaryDataDirect()` method and pretty-print results.The `getSummaryDataDirect()` method accepts the following parameters:- **response_list:** A memory buffer for returning the response document; if an error occurred, an error response is stored here.<jupyter_code>response_list = []
result = g2_audit.getSummaryDataDirect(response_list)

response_string = "".join(response_list)
response_dictionary = json.loads(response_string)
response = json.dumps(response_dictionary, sort_keys=True, indent=4)
print("Result: {0}\n{1}".format(result, response))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09931930693069307, 'fraction_numerical': 0.011757425742574257, 'mean_word_length': 9.166666666666666, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '9', 'dir': 'jupyter-structured-clean-dedup', 'id': '127149', 'license': 'Apache-2.0', 'n_tokens_mistral': 1009, 'n_tokens_neox': 991, 'n_words': 242, 'path': 'senzing-example-notebooks/python/senzing-getSummaryData.ipynb', 'repo_name': 'fgka/senzing-jupyter-docker', 'size': '3232'}