<jupyter_start><jupyter_text><jupyter_code>import random
import string
import re
class MakeURL:

    """Short URL creations"""
    
    def __init__(self):
        self.url_dict=dict()
    
    def short_URL(self,url):
        num = random.randint(0,9)
        rand_domain = ''.join([''.join(random.choices(string.ascii_letters) + random.choices(string.digits)) for _ in range(num)])
        url_short = str(url) + '/' + rand_domain
        self.url_dict[rand_domain]=url
        return url_short

    def short_redirect_URL(self,url):
        cut_url = re.findall(r'\/[\w]+',url)
        cut_url_pro = re.sub(r'\/','',cut_url[0])
        if cut_url_pro in self.url_dict:
            return self.url_dict[cut_url_pro]
        else:
            return "Page Not Found"
url_cr = MakeURL()
url_cr.short_URL('adaptivemobile.com')
url_cr.short_redirect_URL('adaptivemobile.com/M7A6N1z6g2i7M7')
url_cr.short_URL('uohyd.ac.in')
url_cr.short_redirect_URL('uohyd.ac.in/v7c8')
url_cr.short_URL('python.org')
url_cr.short_redirect_URL('python.org/D5b1m7o8')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1412639405204461, 'fraction_numerical': 0.01486988847583643, 'mean_word_length': 3.6025641025641026, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '174454', 'license': 'MIT', 'n_tokens_mistral': 418, 'n_tokens_neox': 410, 'n_words': 55, 'path': 'make_a_short_URL.ipynb', 'repo_name': 'myamullaciencia/pg_diploma_ai_ml_uohyd', 'size': '1076'}