Skip to content

Commit

Permalink
Tokenization buf fixed.
Browse files Browse the repository at this point in the history
Fixes #10
  • Loading branch information
Nuno-Jesus committed Nov 19, 2022
2 parents fd24193 + 9a41413 commit a989bb2
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import re
import copy
import random
import subprocess
Expand All @@ -7,7 +8,7 @@
from colorama import Fore

# INSERT YOUR PATH HERE, INSIDE QUOTES
path = '../42-cursus/libft/'
path = '../libft/'

# Used colors across the files
RESET = Style.RESET_ALL
Expand Down Expand Up @@ -39,18 +40,17 @@
}

def tokenize(str):
str = str.replace("\t", " ")
str = str.replace(" **", "** ")
str = str.replace(" *", "* ")
str = str.replace("( ", "(")
str = str.replace(" )", ")")
str = str.replace("(", " ")
str = str.replace(")", " ")
str = str.replace(" ,", ",")
str = re.sub('\t+', ' ', str)
str = str.replace(' **', '** ')
str = str.replace(' *', '* ')
str = str.replace('( ', '(')
str = str.replace(' )', ')')
str = str.replace('(', ' ')
str = str.replace(')', ' ')
str = str.replace(' ,', ',')

res = str.split(' ')
res = list(filter(lambda x : x != '', res))
#print(res)

return res

Expand Down

0 comments on commit a989bb2

Please sign in to comment.