text_plain_output_1.png
from io import open

import glob

import os

import string

import unicodedata

from __future__ import unicode_literals, print_function, division
from io import open
import glob
import os
def findFiles(path):
    return glob.glob(path)
print(findFiles('/kaggle/input/classifying-names-data-from-pytorch-tutorial/names/*.txt'))
import unicodedata
import string
all_letters = string.ascii_letters + " .,;'"
n_letters = len(all_letters)
def unicodeToAscii(s):
    return ''.join((c for c in unicodedata.normalize('NFD', s) if unicodedata.category(c) != 'Mn' and c in all_letters))
print(unicodeToAscii('Ślusàrski'))
category_lines = {}
all_categories = []
def readLines(filename):
    lines = open(filename, encoding='utf-8').read().strip().split('\n')
    return [unicodeToAscii(line) for line in lines]
for filename in findFiles('/kaggle/input/classifying-names-data-from-pytorch-tutorial/names/*.txt'):
    category = os.path.splitext(os.path.basename(filename))[0]
    all_categories.append(category)
    lines = readLines(filename)
    category_lines[category] = lines
n_categories = len(all_categories)