<jupyter_start><jupyter_text>This module will illustrate the four variants for TF_IDF<jupyter_code># import the necessary libraries
import numpy as np
from sklearn.preprocessing import normalize
# the achievement of original TF_IDF<jupyter_output><empty_output><jupyter_text>1. Variant on the computation of TF with np.log<jupyter_code># using np.log() to calculate the TF<jupyter_output><empty_output><jupyter_text>2. Variant on the computation of TF with Normalization<jupyter_code>#<jupyter_output><empty_output><jupyter_text>3. Variant on the computation of IDF<jupyter_code># calculate the IDF with (N+1)/DF, then using np.log()<jupyter_output><empty_output><jupyter_text>4. Variant on the computation of the word vector and the document vector with Normalization<jupyter_code># normalize the words vector and documents vector<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.07549361207897794, 'fraction_numerical': 0.005807200929152149, 'mean_word_length': 8.268817204301076, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, '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': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '72821', 'license': 'MIT', 'n_tokens_mistral': 280, 'n_tokens_neox': 275, 'n_words': 83, 'path': 'processing/TF_IDF_Variants.ipynb', 'repo_name': 'Wapiti08/Analysis_Ransome_with_GAN', 'size': '861'}