You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
def sep_punct(string, drop_punct): #diy tokenization, use nltk?
if not drop_punct: return "'".join(regex.sub(r"(\"|“|\(|\)|”|…|:|;|,|\*|\.|\?|!|/)", r" \g<1> ", string).split("’")) #separate all punc, then replace single quote ’ with '
return "'".join(regex.sub(r"(\"|“|\(|\)|”|…|:|;|,|\*|\.|\?|!|/)", " ", string).split("’")) #remove all punc, then replace single quote ’ with '
def readin(filename):
holder = []
with open(filename, 'r') as f_in:
for line in f_in:
holder.append(line.strip())
return holder
def pad(*lists_of_strings):
#lists must be same length!
nu_lists = []
padlen = []
for i in range(len(lists_of_strings)):
nu = []
for j in range(len(lists_of_strings[i])): #pad items in list to max length at their indices
if not i: padlen.append(max([len(lists_of_strings[k][j]) for k in range(len(lists_of_strings))]))