This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import pandas as pd | |
train = pd.read_json('./KorQuAD_v1.0_train.json') | |
valid = pd.read_json('./KorQuAD_v1.0_dev.json') | |
valid.head(5) | |
valid['data'][0]['paragraphs'][0] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import numpy as np | |
import pandas as pd | |
from sklearn.utils import shuffle | |
filename = './yelp_academic_dataset_review.json' | |
def make_dataset(filename): | |
data =[] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from hgtk.text import decompose as decom | |
a = decom("감스트") | |
b = a.split("ᴥ") | |
del(b[-1]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
months = ['Jan','Apr','Mar','June'] | |
days = [31,30,31,30] | |
d = {'Month':months,'Day':days} | |
df = pd.DataFrame(d) | |
''' | |
Day Month |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from glob import glob | |
glob("./*") ## Get list of file names in current dir |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dir /b > list.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import numpy as np | |
from matplotlib import pyplot as plt | |
data = pd.read_csv("./loss_accuracy.csv") | |
plt.figure(figsize = (10,7)) | |
plt.plot(range(1,11),data['train_loss'], label = 'train', marker = "D",linewidth = 2.5, markersize=8, | |
color = "C1") | |
plt.plot(range(1,11),data['test_loss'], label = 'test', marker = "D",linewidth = 2.5, markersize=8, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
## df is pd.DataFrame | |
h = [g for _, g in df.groupby('v1')] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
test = "What do you need?" | |
re.sub("do", "", test) | |
## "What you need?" ## |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from keras.preprocessing.sequence import pad_sequences | |
train_seq = [[1,2,3],[4,7,9,1]] | |
pad_sequences(train_seq, maxlen = 5, padding = "post") |