Beispiel #1
0
def modify_name(name: str) -> str:
    if not demoji.last_downloaded_timestamp():
        demoji.download_codes()

    name = demoji.replace(string=name, repl="")
    name = unicodedata.normalize("NFKC", name)
    name = iuliia.translate(source=name, schema=iuliia.WIKIPEDIA)
    return name.title()
Beispiel #2
0
def prepare_rules_2(full_name):
    family_name, name = full_name.split(" ")
    family_name, name = family_name.lower(), name.lower()
    t_name = iuliia.translate(full_name,
                              iuliia.Schemas.get("wikipedia")).replace(
                                  " ", "")
    return (f"""PersonFullName -> {t_name}_familyname {t_name}_name | 
{t_name}_name {t_name}_familyname |
{t_name}_familyname;
{t_name}_familyname -> "{family_name}" interp (Person.FamilyName);
{t_name}_name -> "{name}" interp (Person.Name);
""")
Beispiel #3
0
def main():
    """Transliterate string from command line"""
    if len(sys.argv) < 3:
        print("usage: iuliia SCHEMA SOURCE")
        print("Supported schemas:")
        print("\n".join(iuliia.Schemas.names()))
        sys.exit(1)

    schema_name = sys.argv[1]
    schema = iuliia.Schemas.get(schema_name)
    if schema is None:
        print(f"Schema '{schema_name}' does not exist. Supported schemas:")
        print("\n".join(iuliia.Schemas.names()))
        sys.exit(1)

    source = sys.argv[2]
    result = iuliia.translate(source, schema)
    print(result)
Beispiel #4
0
    def random_name_generator():
        bs.clear()
        creds = bs.generate_credentials()
        name_in_cyrllic = (bsl["RND_GEN"]["NAME_IN_CYRILLIC"], creds[1],
                           creds[0], creds[2])
        name_in_cyrllic = ' '.join(x for x in name_in_cyrllic)
        name_in_cyrllic = bs.warning_o(name_in_cyrllic)

        latin_full_name = creds[1] + ' ' + creds[0] + ' ' + creds[2]

        yandex_maps = iuliia.Schemas.get("yandex_maps")

        print(
            bs.warning_o(bsl["RND_GEN"]["NAME_IN_LATIN"]),
            bs.warning_o(iuliia.translate(latin_full_name,
                                          schema=yandex_maps)))

        print(bs.warning_o(bsl["RND_GEN"]["E-MAIL"]), bs.warning_o(creds[4]))
        print(bs.warning_o(bsl["RND_GEN"]["PASSWORD"]), bs.warning_o(creds[5]))

        print(bs.go_back())
        print(bs.update_value())
        print(bs.zero_to_exit())

        next_input = bs.colored_i()

        if next_input == '.':
            bs.clear()
            bs.print_full_main_screen()

        elif next_input == '0':
            print(bs.option_not_found())
            exit()

        elif next_input == ',':
            bs.random_name_generator()

        else:
            bs.exiting_program()
Beispiel #5
0
    def generate_credentials():

        vocabulary = '123456789qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM'

        name_vocabulary = [
            'Павел', 'Михаил', 'Иван', 'Матвей', 'Игорь', 'Владимир', 'Михаил',
            'Георгий', 'Савелий', 'Никита', 'Александр', 'Алексей', 'Роман',
            'Марк', 'Макар', 'Егор', 'Тихон', 'Андрей', 'Родион', 'Максим',
            'Даниил', 'Кирилл', 'Лев', 'Тимофей', 'Степан'
        ]

        surname_vocabulary = [
            'Смирнов', 'Яковлев', 'Воробьев', 'Фомин', 'Миронов', 'Капустин',
            'Соболев', 'Захаров', 'Акимов', 'Кравцов', 'Алексеев',
            'Александров', 'Романов', 'Бочаров', 'Павлов', 'Новиков',
            'Афанасьев', 'Колосов', 'Антонов', 'Денисов', 'Зубков',
            'Мещеряков', 'Андреев'
        ]

        patronymic_vocabulary = [
            'Артёмович', 'Александрович', 'Леонидович', 'Георгиевич',
            'Андреевич', 'Игоревич', 'Максимович', 'Романович', 'Давидович',
            'Викторович', 'Егорович', 'Олегович', 'Сергеевич', 'Фёдорович'
        ]

        email_vocabulary = [
            'gmail.com', 'yandex.ru', 'ya.ru', 'bk.ru', 'mail.ru', 'yahoo.com',
            'list.ru', 'ya.kz', 'yandex.ua', 'ya.ua', 'yandex.kz', 'ya.kz',
            'inbox.ru', 'internet.ru', 'inbox.ru', 'yandex.by', 'ya.by'
        ]

        password = ''
        for x in range(12):
            password += random.choice(vocabulary)

        rand_end = random.randint(1, 3)

        # randomizing the ending of email, 1 - just random number, 2 - random full year, 3 - random shortened year
        if rand_end == 1:
            rand_end = random.randint(500, 999)
        elif rand_end == 2:
            rand_end = random.randint(1965, 1999)
        else:
            rand_end = str(random.randint(1965, 1999))[2:]

        # random separator
        # write name_surname or namesurname or name-surname (underscore True or False)
        rand_sep = random.randint(1, 3)
        if rand_sep == 1:
            rand_sep = '_'
        elif rand_sep == 2:
            rand_sep = '-'
        else:
            rand_sep = ''

        # using yandex maps transliteration schema as default
        yandex_maps = iuliia.Schemas.get("yandex_maps")

        name = random.choice(name_vocabulary)
        latin_name = iuliia.translate(name, schema=yandex_maps)

        surname = random.choice(surname_vocabulary)
        latin_surname = iuliia.translate(surname, schema=yandex_maps)

        patronymic = random.choice(patronymic_vocabulary)

        email_value = latin_name.lower() + rand_sep + latin_surname.lower(
        ) + str(rand_end)

        email = "{}@{}".format(email_value, random.choice(email_vocabulary))

        return name, surname, patronymic, latin_name, email, password
Beispiel #6
0
def test_samples(schema, source, expected):
    assert iuliia.translate(source, schema) == expected
Beispiel #7
0
import iuliia
with open('data.txt', 'r', errors='ignore') as cyr:
    for line in cyr:
        flag = 0
        for i in line:
            if i.isdigit():
                flag = 1
                break
        if flag:
            continue
        with open('latdata.txt', 'a', encoding='utf8') as lat:
            lat.write(iuliia.translate(line, iuliia.WIKIPEDIA))