<jupyter_start><jupyter_text>Estimator transformer<jupyter_code>transformer = algorithm.fit(input_text)
output_text = transformer.transform(input_text)
texts = ['Maybe i should get some coffee before starting']
texts = [x.lower() for x in texts]
texts = [''.join(c for c in x if c not in string.punctuation) for x in texts]
texts = [''.join(c for c in x if c not in '0123456789') for x in texts]
texts = [' '.join(x.split()) for x in texts]<jupyter_output><empty_output><jupyter_text>StopWordsRemover<jupyter_code>texts = 'Maybe i should get some coffee before starting'
stop = set(['i', 'should', 'some', 'before'])
texts = [i for i in texts.lower().split() if i not in stop]
print(texts)
filtered_texts = ' '.join(texts)
print(filtered_texts)<jupyter_output>maybe get coffee starting<jupyter_text>N-gram<jupyter_code>from nltk import ngrams
sentence = 'Maybe i should get some coffee before starting'
n = 2
sixgrams = ngrams(sentence.split(), n)
for grams in sixgrams:
 print(grams)<jupyter_output>('Maybe', 'i')
('i', 'should')
('should', 'get')
('get', 'some')
('some', 'coffee')
('coffee', 'before')
('before', 'starting')
{'fraction_non_alphanumeric': 0.15350488021295475, 'fraction_numerical': 0.009760425909494233, 'mean_word_length': 6.421052631578948, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '625002', 'license': 'MIT', 'n_tokens_mistral': 421, 'n_tokens_neox': 393, 'n_words': 122, 'path': 'Chapter06/Transformers and estimators.ipynb', 'repo_name': 'arifmudi/Predictive-Analytics-with-TensorFlow', 'size': '1127'}