728x90
In [250]:
from predict import ner_prediction, pos_process
from transformers import BertTokenizer, TFBertModel
from konlpy.tag import Mecab # 형태소 단위로 나누기
import kss # 문장단위로 나누기
from pykospacing import Spacing# 띄어쓰기 교정하기
from hanspell import spell_checker # 띄어쓰기 + 맞춤법 교정
import random
import os
import warnings
from silence_tensorflow import silence_tensorflow
silence_tensorflow() # 텐서플로우 경고 무시
warnings.filterwarnings('ignore') # 경고 무시
os.environ["CUDA_VISIBLE_DEVICES"] = "3" # 3번 GPU 사용
In [251]:
mecab = Mecab()
tokenizer = BertTokenizer.from_pretrained("bert-base-multilingual-cased")
In [252]:
ktext = "1873년 음력 11월 고종이 친정을 선포하면서 10년간 정권을 쥐고 있던 흥선대원군이 실각하고 명성황후를 필두로 한 여흥 민씨 정권이 들어서게 되었다. 이에 따라 자연스레 통상 개화론자들이 대두되면서 조선의 대외정책은 조금씩 변하기 시작했다. 이런 상황에서 1875년 음력 9월 20일 일본이 운요호 사건을 일으켜 조선에게 문호를 개방하라며 압박했다. 이에 대해 조선에서는 찬반 양론이 엇갈렸으나 결국 개항 찬성론자들의 입지가 강화되어 1876년 음력 2월 3일 일본과 강화도 조약을 체결하여 문호를 개방하였다. 이어서 고종은 일본에 파견한 수신사 김홍집이 귀국할 때 가져온 《사의조선책략》이라는 책을 읽고 깊은 인상을 받았으며, 그에 따라 조선 조정은 부국강병을 목표로 개화파 인물을 등용하여 개화 정책을 추진하였다. 뒤이어 일본에 신사유람단을, 청나라에 영선사를 파견하였다.조정에서는 개화정책을 전담하기 위한 기구인 통리기무아문을 두었고, 군사제도를 개혁하여 신식 군대인 별기군을 창설하였다. 1880년 음력 10월 11일 미국과 국교를 열었으며, 뒤이어 영국, 독일, 러시아, 프랑스 등 서구 열강들과 외교 관계를 맺었다. 그러나 이들과 맺은 조약들은 모두 치외 법권을 규정하고 국내 산업에 대한 보호 조처를 거의 취할 수 없게 규정된 불평등 조약들이었다.개화정책에 대하여 보수적인 유생층은 성리학적 전통질서를 지키고 외세를 배척하자는 위정척사 운동을 전개하였다. 이 운동은 외세의 침략을 막으려는 반외세 자주 운동이었지만 전통적인 사회체제를 그대로 유지하려고 하여 시대의 흐름에 뒤떨어진 한계를 지니고 있었다. 그러나 유생층 가운데서도 일부 혁신적 인사들은 유교 문화를 계승하면서 서양의 물질 문명을 부분적으로 수용하자는 동도서기론을 주장하며 개화운동에 참여하기도 하였다."
ktext_list = kss.split_sentences(ktext)
In [253]:
kss_sentence = ner_prediction(ktext_list,max_seq_len=88, tokenizer=tokenizer, lang='ko')
100%|██████████| 12/12 [00:00<00:00, 720.95it/s] Some weights of the PyTorch model were not used when initializing the TF 2.0 model TFBertModel: ['cls.predictions.bias', 'cls.predictions.decoder.weight', 'cls.predictions.transform.dense.bias', 'cls.predictions.transform.LayerNorm.bias', 'cls.seq_relationship.weight', 'cls.seq_relationship.bias', 'cls.predictions.transform.dense.weight', 'cls.predictions.transform.LayerNorm.weight'] - This IS expected if you are initializing TFBertModel from a PyTorch model trained on another task or with another architecture (e.g. initializing a TFBertForSequenceClassification model from a BertForPreTraining model). - This IS NOT expected if you are initializing TFBertModel from a PyTorch model that you expect to be exactly identical (e.g. initializing a TFBertForSequenceClassification model from a BertForSequenceClassification model). All the weights of TFBertModel were initialized from the PyTorch model. If your task is similar to the task the model of the checkpoint was trained on, you can already use TFBertModel for predictions without further training.
model_load성공!!
In [254]:
# 토큰화된 문장을 올바른 띄어쓰기로 합쳐줌 (PyKoSacing)
spacing = Spacing()
In [255]:
in_list = ['년','월','일','간','시','》','두',',','어'] # 태깅되어 빈칸이 되면 안되는 단어
out_list = ['그러나','이에','이런','그럼에도','따라서','상황',] # 태깅 안되었지만 빠져야하는 단어 (제거되지 않은 불용어)
빈칸 유형¶
- 알고리즘: 개채명으로 인식된 단어에 빈칸 생성.
- 태그가 모두 '-'인 문장에는 문제가 생성되지 않음
- '-'를 제외한 태그가 1개 이상 있어야 문제가 생성됨
- 예시) 영조는 탕평책을 실시하여 왕권을 강화하였다.
- 문제 출력: (__)는 탕평책을 실시하여 왕권을 강화하였다.
- 정답: 영조
In [256]:
# 빈칸 유형 문제 생성
PER_list = ['영조는 탕평책을 펼쳐 왕권을 강화하고 정치를 안정시켰다.','주몽은 부여를 떠나 졸본에 나라를 세웠다.']
PER_sentence = ner_prediction(PER_list, max_seq_len=88, tokenizer=tokenizer, lang='ko')
100%|██████████| 2/2 [00:00<00:00, 792.50it/s] Some weights of the PyTorch model were not used when initializing the TF 2.0 model TFBertModel: ['cls.predictions.bias', 'cls.predictions.decoder.weight', 'cls.predictions.transform.dense.bias', 'cls.predictions.transform.LayerNorm.bias', 'cls.seq_relationship.weight', 'cls.seq_relationship.bias', 'cls.predictions.transform.dense.weight', 'cls.predictions.transform.LayerNorm.weight'] - This IS expected if you are initializing TFBertModel from a PyTorch model trained on another task or with another architecture (e.g. initializing a TFBertForSequenceClassification model from a BertForPreTraining model). - This IS NOT expected if you are initializing TFBertModel from a PyTorch model that you expect to be exactly identical (e.g. initializing a TFBertForSequenceClassification model from a BertForSequenceClassification model). All the weights of TFBertModel were initialized from the PyTorch model. If your task is similar to the task the model of the checkpoint was trained on, you can already use TFBertModel for predictions without further training.
model_load성공!!
In [257]:
def question_emoty(sentences):
generated_question = []
for sentence in sentences:
question,answer = [],[]
for word in sentence:
if word[1] != '-':
if word[0] in in_list:
question.append(word[0])
else:
question.append(str('('+'_'*len(word[0])+')'))
answer.append(word[0])
else:
if word[0] in out_list:
pass
else:
question.append(word[0])
if answer: # 빈칸이 생성된 문장은 출력
generated_question.append([question,answer])
return generated_question
In [258]:
empty = question_emoty(PER_sentence)
print("Question: ",empty[0][0])
print('Answer:',empty[0][1])
Question: ['(__)', '는', '(___)', '을', '펼쳐', '왕권', '을', '강화', '하', '고', '정치', '를', '안정', '시켰', '다', '.'] Answer: ['영조', '탕평책']
In [259]:
kss_qa= question_emoty(kss_sentence)
for i in range(len(kss_qa)):
print("Question" ,i + 1, ": " , spacing("".join(kss_qa[i][0])))
print("Answer" ,i + 1, ": " , kss_qa[i][1])
print()
Question 1 : (____)년 음력(__) 월고종이(__)을 선포하면서 (__)년간 정권을 쥐고 있던 (_____)이 실각하고 명성(__)를 필두로 한 여흥민씨 정권이 들어서게 되었다. Answer 1 : ['1873', '11', '친정', '10', '흥선대원군', '황후'] Question 2 : 통상 개화론자들이 대두되면서 (__)의 대외정책은 조금씩 변하기 시작했다. Answer 2 : ['조선'] Question 3 : (____)년 음력(_)월(__)일(__)이 (___) 사건을 일으켜 (__)에게 문호를 개방하라며 압박했다. Answer 3 : ['1875', '9', '20', '일본', '운요호', '조선'] Question 4 : (__)에서는 찬반 양론이 엇갈렸으나 개항 찬성론자들의 입지가 강화되어 (____) 년 음력(_)월(_)일(__)과 강화도 조약을 체결하여 (__)를 개방하였다. Answer 4 : ['조선', '1876', '2', '3', '일본', '문호'] Question 5 : (__)은 (__)에 파견한 (___)(___)이 귀국할 때 가져온 (______)이라는 책을 읽고 깊은 인상을 받았으며 그에 (__) 조정은 (____)을 목표로 개화파 인물을 등용하여 개화정책을 추진하였다. Answer 5 : ['고종', '일본', '수신사', '김홍집', '사의조선책략', '조선', '부국강병'] Question 6 : (__)에 (__) 유람단을 (___)에 영선사를 파견하였다. Answer 6 : ['일본', '신사', '청나라'] Question 7 : 조정에서는 개화정책을 전담하기 위한 기구인(______)을 두었고 군사제도를 개혁하여 신식군대인(___)을 창설하였다. Answer 7 : ['통리기무아문', '별기군'] Question 8 : (____)년 음력(__)월(__)일(__)과 국교를 열었으며 (__)(__)(___)(___) 서구 열강들과 외교관계를 맺었다. Answer 8 : ['1880', '10', '11', '미국', '영국', '독일', '러시아', '프랑스'] Question 9 : 개화정책에 보수적인 유생층은 성리학적 전통질서를 지키고 외세를 배척하자는 (____) 운동을 전개하였다. Answer 9 : ['위정척사'] Question 10 : 유생층 가운데서도 일부 혁신적인사들은 유교문화를 계승하면서 (__)의 물질문명을 부분적으로 수용하자는 동도서기론을 주장하며 개화운동에 참여하기도 하였다. Answer 10 : ['서양']
OX 유형¶
- 알고리즘: 해당 문장에 인식된 개채명 태그에서 같은 태그로 분류된 다른 단어 넣기
- 입력된 문장 내에서 같은 태그 내의 단어가 3가지 이상일 때 해당 문제를 제작
- OX 비율은 랜덤
- 예시) 영조[PER] 는 탕평책을 펼쳤다. -> 세종대왕[PER]은 탕평책을 펼쳤다.
- 문제 출력: 세종대왕은 탕평책을 펼쳤다. (O/X)
- 정답: X, 영조
In [260]:
def question_OX(sentences):
tag_dict = {}
Use_tag = {}
unUse_tag = ['NUM_B','NUM_I','DAT_I','DAT_B']
stop_word = ['일']
# 태그별로 단어를 리스트로 저장
for sentence in sentences:
for word in sentence:
if word[1] != '-':
if word[1] not in tag_dict:
tag_dict[word[1]] = [word[0]]
else:
tag_dict[word[1]].append(word[0])
# 문장에서 같은 태그의 단어가 3가지 이상인 태그 선별
for tag in tag_dict:
if tag not in unUse_tag:
if len(tag_dict[tag]) >= 3:
Use_tag[tag] = tag_dict[tag]
print(Use_tag)
# OX 비율은 randint 함수로 랜덤으로 비율 선정
ox_ratio = {}
for tag in Use_tag:
O_ratio = random.randint(0,len(Use_tag[tag]))
ox_ratio[tag] = O_ratio # 해당 태그에서 문제에 대한 답이 O일 비율은 O:X = O_ratio : len(Use_tag[tag]) - O_ratio
print(ox_ratio)
tagSort_sentence = {}
input_quesiton = []
for sentence in sentences:
for word in sentence:
# 태그별로 단어가 3개 이상인 태그의 문장 추출
# 중복을 방지하기 위해 이미 뽑은 문장은 제외함
if word[1] in Use_tag:
if word[1] not in tagSort_sentence:
tagSort_sentence[word[1]] = [sentence]
break
else:
tagSort_sentence[word[1]].append(sentence)
break
generated_question = []
# # OX 문제 생성
for tag in tagSort_sentence:
ox_rate = ox_ratio[tag] # OX 비율
o_idx = [] # 정답이 O인 문제의 인덱스
over_list = [] # 뽑을 수의 중복을 방지
for _ in range(ox_rate):
tmp_num = random.randint(0,ox_rate)
while tmp_num in over_list:
tmp_num = random.randint(0,ox_rate)
over_list.append(tmp_num)
o_idx.append(tmp_num)
for i in range(len(tagSort_sentence[tag])):
question,answer = [], []
if i in o_idx: # 만약 정답이 O인 문제면 그냥 출제한다.
tmp_qusetion = tagSort_sentence[tag][i]
for word in tmp_qusetion:
question.append(word[0])
answer.append('O')
else: # 정답이 X로 출력되어야 하는 문제는 같은 태그 내의 다른 단어로 바꿔서 출제한다.
tmp_qusetion = tagSort_sentence[tag][i]
answer_word = ""
for word in tmp_qusetion:
if word[1] == tag: # 해당 단어가 바꿔야하는 태그라면
word_set= list(set(Use_tag[tag]))
word_set.pop(word_set.index(word[0]))
i = random.randint(0,len(word_set)-1)
change_word = word_set[i] # 사용할 태그 랜덤으로 선택
question.append(change_word)
answer_word = word[0]
else:
question.append(word[0])
answer.append('X')
answer.append(str("오답인 단어: "+change_word))
answer.append(str('정답인 단어: '+answer_word ))
generated_question.append([question,answer])
return generated_question
In [ ]:
In [261]:
kss_qa= question_OX(kss_sentence)
for i in range(len(kss_qa)):
print("Question" ,i + 1, ": " , spell_checker.check("".join(kss_qa[i][0])).checked)
print("Answer" ,i + 1, ": " , kss_qa[i][1])
print()
{'CVL_B': ['친정', '흥선대원군', '황후', '수신사', '사의조선책략', '부국강병', '신사', '통리기무아문', '위정척사'], 'LOC_B': ['조선', '일', '일본', '조선', '조선', '일', '일본', '일본', '조선', '일본', '청나라', '일', '미국', '영국', '독일', '러시아', '프랑스', '서양'], 'PER_B': ['문호', '고종', '김홍집']} {'CVL_B': 6, 'LOC_B': 4, 'PER_B': 2} Question 1 : 1873년 음력 11월 고종이 친정을 선포하면서 10년간 정권을 쥐고 있던 흥선대원군이 실각하고 명성황후를 필두로 한 여흥민씨 정권이 들어서게 되었다. Answer 1 : ['O'] Question 2 : 조정에서는 개화정책을 전담하기 위한 기구인 통리기무아문을 두었고 군사제도를 개혁하여 신식 군대인 별기군을 창설하였다. Answer 2 : ['O'] Question 3 : 개화정책에 보수적인 유생층은 성리학적 전통 질서를 지키고 외세를 배척하자는 수신사 운동을 전개하였다. Answer 3 : ['X', '오답인 단어: 수신사', '정답인 단어: 위정척사'] Question 4 : 통상 개화론자들이 대도 되면서 조선의 대외정책은 조금씩 변하기 시작했다. Answer 4 : ['O'] Question 5 : 1875년 음력 9월 20일 일본이 운요호사건을 일으켜 조선에게 문호를 개방하라며 압박했다. Answer 5 : ['O'] Question 6 : 조선에서는 찬반양론이 엇갈렸으나 개항 찬성론자들의 입지가 강화되어 1876년 음력 2월 3일 일본과 강화도조약을 체결하여 문호를 개방하였다. Answer 6 : ['O'] Question 7 : 일본에 신사유람단을 청나라에 영선사를 파견하였다. Answer 7 : ['O'] Question 8 : 1880년 음력 10월 11일 본 서양과 국교를 열었으며 일본 영국 영국 독일 서구 열강들과 외교관계를 맺었다. Answer 8 : ['X', '오답인 단어: 독일', '정답인 단어: 프랑스'] Question 9 : 유생층 가운데서도 일부 혁신적 인사들은 유교문화를 계승하면서 프랑스의 물질문명을 부분적으로 수용하자는 동도서기론을 주장하며 개화운동에 참여하기도 하였다. Answer 9 : ['X', '오답인 단어: 프랑스', '정답인 단어: 서양'] Question 10 : 고종은 일본에 파견한 수신사 김홍집이 귀국할 때 가져온 사의 조선책략이라는 책을 읽고 깊은 인상을 받았으며 그에 조선조 정은 부국강병을 목표로 개화파 인물을 등용하여 개화정책을 추진하였다. Answer 10 : ['O']
[EVET]가 일어난 시점(년도)는 언제인가? -> 답: NUM_B
In [262]:
def event_qg(event_sentence):
for i in event_sentence:
stack = []
for token in i:
if "EVT" in token[1]:
print("Question: " + token[0]+"이 일어난 시점은 언제인가?")
stack.append("EVT")
if "EVT" in stack and "NUM" in token[1]:
print("Answer: " + token[0])
del stack[stack.index('EVT')]
if "DAT" in token[1]:
# print(token)
pass
In [263]:
# _월_일은 무슨 날짜 인가?
event_list = ['임진왜란은 1592년에 일어났다.']
event_sentence = ner_prediction(event_list, max_seq_len=88, tokenizer=tokenizer, lang='ko')
100%|██████████| 1/1 [00:00<00:00, 1074.36it/s] Some weights of the PyTorch model were not used when initializing the TF 2.0 model TFBertModel: ['cls.predictions.bias', 'cls.predictions.decoder.weight', 'cls.predictions.transform.dense.bias', 'cls.predictions.transform.LayerNorm.bias', 'cls.seq_relationship.weight', 'cls.seq_relationship.bias', 'cls.predictions.transform.dense.weight', 'cls.predictions.transform.LayerNorm.weight'] - This IS expected if you are initializing TFBertModel from a PyTorch model trained on another task or with another architecture (e.g. initializing a TFBertForSequenceClassification model from a BertForPreTraining model). - This IS NOT expected if you are initializing TFBertModel from a PyTorch model that you expect to be exactly identical (e.g. initializing a TFBertForSequenceClassification model from a BertForSequenceClassification model). All the weights of TFBertModel were initialized from the PyTorch model. If your task is similar to the task the model of the checkpoint was trained on, you can already use TFBertModel for predictions without further training.
model_load성공!!
In [264]:
event_qg(event_sentence)
Question: 임진왜란이 일어난 시점은 언제인가? Answer: 1592
In [265]:
def start(context):
ktext_list = kss.split_sentences(context)
kss_sentence = ner_prediction(ktext_list,max_seq_len=88, tokenizer=tokenizer, lang='ko')
kss_qa= question_emoty(kss_sentence)
empty_questions = []
empty_answers = []
for i in range(len(kss_qa)):
tmp = "".join(kss_qa[i][0])
# print("Question" ,i + 1, ": " , spell_checker.check(tmp).checked)
# print("Answer" ,i + 1, ": " , kss_qa[i][1])
# print()
empty_questions.append(spell_checker.check(tmp).checked)
empty_answers.append(kss_qa[i][1])
# print("="*30)
# print("OX 문제")
# print("="*30)
kss_qa= question_OX(kss_sentence)
ox_questions = []
ox_answers = []
for i in range(len(kss_qa)):
tmp = "".join(kss_qa[i][0])
# print("Question" ,i + 1, ": " , spell_checker.check(tmp).checked)
# print("Answer" ,i + 1, ": " , kss_qa[i][1])
# print()
ox_questions.append(spell_checker.check(tmp).checked)
ox_answers.append(kss_qa[i][1])
return empty_questions,empty_answers, ox_questions, ox_answers
In [269]:
empty_questions,empty_answers, ox_questions, ox_answers = start(ktext)
100%|██████████| 12/12 [00:00<00:00, 780.58it/s] Some weights of the PyTorch model were not used when initializing the TF 2.0 model TFBertModel: ['cls.predictions.bias', 'cls.predictions.decoder.weight', 'cls.predictions.transform.dense.bias', 'cls.predictions.transform.LayerNorm.bias', 'cls.seq_relationship.weight', 'cls.seq_relationship.bias', 'cls.predictions.transform.dense.weight', 'cls.predictions.transform.LayerNorm.weight'] - This IS expected if you are initializing TFBertModel from a PyTorch model trained on another task or with another architecture (e.g. initializing a TFBertForSequenceClassification model from a BertForPreTraining model). - This IS NOT expected if you are initializing TFBertModel from a PyTorch model that you expect to be exactly identical (e.g. initializing a TFBertForSequenceClassification model from a BertForSequenceClassification model). All the weights of TFBertModel were initialized from the PyTorch model. If your task is similar to the task the model of the checkpoint was trained on, you can already use TFBertModel for predictions without further training.
model_load성공!! {'CVL_B': ['친정', '흥선대원군', '황후', '수신사', '사의조선책략', '부국강병', '신사', '통리기무아문', '위정척사'], 'LOC_B': ['조선', '일', '일본', '조선', '조선', '일', '일본', '일본', '조선', '일본', '청나라', '일', '미국', '영국', '독일', '러시아', '프랑스', '서양'], 'PER_B': ['문호', '고종', '김홍집']} {'CVL_B': 2, 'LOC_B': 5, 'PER_B': 2}
문제를 json 파일로 변환¶
set unixtime¶
In [ ]:
from time import time
unix_time = int(time())
unix_time
1668733017
save QA as json file¶
In [283]:
import json
QA_data = {"empty_qa": {"questions":empty_questions,"answers":empty_answers} ,"ox_qa":{"questions":ox_questions,"answers":ox_answers}}
file_path = "QA_data/" + str(unix_time) + ".json"
with open(file_path, 'w') as outfile:
json.dump(QA_data, outfile, indent=4)
In [284]:
with open(file_path, 'r') as f:
data = json.load(f)
data
Out[284]:
{'empty_qa': {'questions': ['(____) 년 음력(__) 월 고종이(__)을 선포하면서(__) 연간 정권을 쥐고 있던(_____)이 실각하고 명성(__)를 필두로 한 여흥민씨 정권이 들어서게 되었다.', '통상 개화론자들이 대도 되면서(__)의 대외정책은 조금씩 변하기 시작했다.', '(____) 년 음력(_) 월(__) 일(__)이(___) 사건을 일으켜(__)에게 문호를 개방하라며 압박했다.', '(__)에서는 찬반양론이 엇갈렸으나 개항 찬성론자들의 입지가 강화되어(____) 년 음력(_) 월(_) 일(__)과 강화도조약을 체결하여(__)를 개방하였다.', '(__)은(__)에 파견한(___)(___)이 귀국할 때 가져온(______)이라는 책을 읽고 깊은 인상을 받았으며 그에(__) 조정은(____)을 목표로 개화파 인물을 등용하여 개화정책을 추진하였다.', '(__)에(__) 유람단을(___)에 영선사를 파견하였다.', '조정에서는 개화정책을 전담하기 위한 기구인(______)을 두었고 군사제도를 개혁하여 신식 군대인(___)을 창설하였다.', '(____) 년 음력(__) 월(__) 일(__)과 국교를 열었으며(__)(__)(___)(___) 서구 열강들과 외교관계를 맺었다.', '개화정책에 보수적인 유생층은 성리학적 전통 질서를 지키고 외세를 배척하자는(____) 운동을 전개하였다.', '유생층 가운데서도 일부 혁신적 인사들은 유교문화를 계승하면서(__)의 물질문명을 부분적으로 수용하자는 동도서기론을 주장하며 개화운동에 참여하기도 하였다.'], 'answers': [['1873', '11', '친정', '10', '흥선대원군', '황후'], ['조선'], ['1875', '9', '20', '일본', '운요호', '조선'], ['조선', '1876', '2', '3', '일본', '문호'], ['고종', '일본', '수신사', '김홍집', '사의조선책략', '조선', '부국강병'], ['일본', '신사', '청나라'], ['통리기무아문', '별기군'], ['1880', '10', '11', '미국', '영국', '독일', '러시아', '프랑스'], ['위정척사'], ['서양']]}, 'ox_qa': {'questions': ['1873년 음력 11월 고종이 친정을 선포하면서 10년간 정권을 쥐고 있던 흥선대원군이 실각하고 명성황후를 필두로 한 여흥민씨 정권이 들어서게 되었다.', '조정에서는 개화정책을 전담하기 위한 기구인 흥선대원군을 두었고 군사제도를 개혁하여 신식 군대인 별기군을 창설하였다.', '개화정책에 보수적인 유생층은 성리학적 전통 질서를 지키고 외세를 배척하자는 위정척사운동을 전개하였다.', '통상 개화론자들이 대도 되면서 영국의 대외정책은 조금씩 변하기 시작했다.', '1875년 음력 9월 20일 일본이 운요호사건을 일으켜 조선에게 문호를 개방하라며 압박했다.', '조선에서는 찬반양론이 엇갈렸으나 개항 찬성론자들의 입지가 강화되어 1876년 음력 2월 3일 일본과 강화도조약을 체결하여 문호를 개방하였다.', '일본에 신사유람단을 청나라에 영선사를 파견하였다.', '1880년 음력 10월 11일 미국과 국교를 열었으며 영국 독일 러시아 프랑스 서구 열강들과 외교관계를 맺었다.', '유생층 가운데서도 일부 혁신적 인사들은 유교문화를 계승하면서 서양의 물질문명을 부분적으로 수용하자는 동도서기론을 주장하며 개화운동에 참여하기도 하였다.', '고종은 일본에 파견한 수신사 김홍집이 귀국할 때 가져온 사의 조선책략이라는 책을 읽고 깊은 인상을 받았으며 그에 조선조 정은 부국강병을 목표로 개화파 인물을 등용하여 개화정책을 추진하였다.'], 'answers': [['O'], ['X', '오답인 단어: 흥선대원군', '정답인 단어: 통리기무아문'], ['O'], ['X', '오답인 단어: 영국', '정답인 단어: 조선'], ['O'], ['O'], ['O'], ['O'], ['O'], ['O']]}}
In [291]:
bin(-12)
Out[291]:
'-0b1100'
In [ ]:
728x90
'Project > 캡스톤디자인2' 카테고리의 다른 글
[NLP Project] 문장에서 불용어 제거하기 (1) | 2022.11.16 |
---|---|
[NLP Project] tensorflow 파인튜닝한 모델 저장하고 모델 불러오기 (1) | 2022.11.15 |
[NLP Project] Bert model 성능 기록 (0) | 2022.11.14 |
[NLP Project] Bert 모델에 NER 학습시키기 (텐서플로우) - keras.saving() 해결일지 (0) | 2022.11.11 |
[NLP Project] Test data, Train Data Split (0) | 2022.11.11 |