정의동

REMOVE: outdate source

from nltk.tokenize import word_tokenize, sent_tokenize
import nltk
import re
from bs4 import BeautifulSoup
from newspaper import Article
import requests
def get_HTML_from_url(url):
return requests.get(url).text
def get_text_from_HTML(html):
soup = BeautifulSoup(html)
script_tag = soup.find_all(['script', 'style', 'header', 'footer', 'form'])
for script in script_tag:
script.extract()
content = soup.get_text('\n', strip=True)
return content
# def get_HTML_from_regexp_url(url_pattern):
def is_string(target):
return type(target) == str
def cut_corpus(corpus):
if not is_string(corpus):
return []
return corpus.split('.')[:-1]
def postag_sentence(sentence):
if not is_string(sentence):
return []
tags = word_tokenize(sentence)
return nltk.pos_tag(tags)
# verb의 index를 return 합니다.
# 만약, 존재하지 않는다면, -1을 return 합니다.
def find_verb_idx(tags):
idx = 0
for tag in tags:
if tag[0][1] == 'V':
return idx
return -1
def make_be_verb(subj):
if subj == 'I':
return 'am'
elif subj in ['You', 'you']:
return 'are'
else:
return 'is'
def cut_quot(sentence):
return re.sub("[\'\"\`]", '', sentence)
# 예외
# 1. brace가 닫히지 않음
# 2. target_str가 없음
def make_brace_triple(target_str, brace_tags):
if target_str == '':
return []
idx = find_verb_idx(brace_tags)
subj = target_str
pred = ''
if idx != -1:
pred = brace_tags[idx]
obj = ' '.join([value for value, _ in brace_tags[idx:]])
else:
pred = make_be_verb(subj)
obj = ' '.join([value for value, _ in brace_tags])
return [subj, pred, obj]
url = 'https://en.wikipedia.org/wiki/Korea'
def get_bodytext_from_url(url):
news = Article(url, language='en')
news.download()
news.parse()
text = news.text
pattern = r'\[[^]]*\]'
text = re.sub(pattern=pattern, repl='', string=text)
return text
# web2rdf
---
본 프로젝트는 '웹 문서를 자동으로 RDF로 변환하는 방법'이라는 논문을 보고 직접 구현해본 프로젝트임
---
## Jsoup파싱과 형태소 분석기를 이용한 태깅
stanford pos tagger (형태소 분석기)
[https://nlp.stanford.edu/software/tagger.html](https://nlp.stanford.edu/software/tagger.html)
여기서 다운로드 받음
인텔리j에서 프로젝트 만들고 File-Project Structure-Modules-Dependencies에서
stanford-postagger-4.2.0.jar 추가
jsoup-1.13.1.jar도 같이 다운 받아서 추가
다운받은 staford폴더에 models에서 english-left3words-distsim.tagger.props파일을 복사해서
프로젝트 폴더에 taggers라는 폴더 만들고 붙여넣기함
```java
package test_package;
import edu.stanford.nlp.tagger.maxent.MaxentTagger;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.select.Elements;
import java.io.IOException;
public class main {
public static void main(String[] args) throws IOException {
Document doc = Jsoup.connect("https://en.wikipedia.org/wiki/Korea").get();
Elements pTags = doc.getElementsByTag("p");
String bodyText = Jsoup.parse(pTags.toString()).text();
MaxentTagger tagger = new MaxentTagger("taggers/english-left3words-distsim.tagger");
String tagged = tagger.tagString(bodyText);
System.out.println(tagged);
}
}
```
위키피디아 Korea검색 결과를 파싱해서 p태그만 불러와 text로 바꾼뒤
태거를 통해 바꿔줌
### 결과
```plain text
Korea_NNP (_-LRB- officially_RB the_DT "_`` Korean_NNP Peninsula_NNP "_'' )_-RRB- is_VBZ a_DT region_NN in_IN East_NNP Asia_NNP ._. Since_IN 1945_CD it_PRP has_VBZ been_VBN divided_VBN into_IN the_DT two_CD parts_NNS which_WDT soon_RB became_VBD the_DT two_CD sovereign_JJ states_NNS :_: North_NNP Korea_NNP (_-LRB- officially_RB the_DT "_`` Democratic_NNP People_NNPS 's_POS Republic_NNP of_IN Korea_NNP "_'' )_-RRB- and_CC South_NNP Korea_NNP (_-LRB- officially_RB the_DT "_`` Republic_NNP of_IN Korea_NNP "_'' )_-RRB- ._. Korea_NNP consists_VBZ of_IN the_DT Korean_NNP Peninsula_NNP ,_, Jeju_NNP Island_NNP ,_, and_CC several_JJ minor_JJ islands_NNS near_IN the_DT peninsula_NN ._. It_PRP is_VBZ bordered_VBN by_IN China_NNP to_IN the_DT northwest_NN and_CC Russia_NNP to_IN the_DT northeast_NN ._. It_PRP is_VBZ separated_VBN from_IN Japan_NNP to_IN the_DT east_NN by_IN the_DT Korea_NNP Strait_NNP and_CC the_DT Sea_NN of_IN Japan_NNP (_-LRB- East_NNP Sea_NNP )_-RRB- ._. During_IN the_DT first_JJ half_NN of_IN the_DT 1st_NN millennium_NN ,_, Korea_NNP was_VBD divided_VBN between_IN the_DT three_CD competing_VBG states_NNS of_IN Goguryeo_NNP ,_, Baekje_NNP ,_, and_CC Silla_NNP ,_, together_RB known_VBN as_IN the_DT Three_CD Kingdoms_NNS of_IN Korea_NNP ._. In_IN the_DT second_JJ half_NN of_IN the_DT 1st_NN millennium_NN ,_, Silla_NNP defeated_VBD and_CC conquered_VBD Baekje_NNP and_CC Goguryeo_NNP ,_, leading_VBG to_IN the_DT "_`` Unified_NNP Silla_NNP "_'' period_NN ._. Meanwhile_RB ,_, Balhae_NNP formed_VBD in_IN the_DT north_NN ,_, superseding_VBG former_JJ Goguryeo_NNP ._. Unified_JJ Silla_NNP eventually_RB collapsed_VBD into_IN three_CD separate_JJ states_NNS due_IN to_IN civil_JJ war_NN ,_, ushering_VBG in_IN the_DT Later_RBR Three_CD Kingdoms_NNS ._. Toward_IN the_DT end_NN of_IN the_DT 1st_NN millennium_NN ,_, Goguryeo_NNP was_VBD resurrected_VBN as_IN Goryeo_NNP ,_, which_WDT defeated_VBD the_DT two_CD other_JJ states_NNS and_CC unified_VBD the_DT Korean_NNP Peninsula_NNP as_IN a_DT single_JJ sovereign_JJ state_NN ._. Around_IN the_DT same_JJ time_NN ,_, Balhae_NNP collapsed_VBD and_CC its_PRP$ last_JJ crown_NN prince_NN fled_VBD south_RB to_IN Goryeo_NNP ._. Goryeo_NNP (_-LRB- also_RB spelled_VBN as_IN Koryŏ_NNP )_-RRB- ,_, whose_WP$ name_NN developed_VBD into_IN the_DT modern_JJ exonym_NN "_'' Korea_NNP "_'' ,_, was_VBD a_DT highly_RB cultured_VBN state_NN that_WDT created_VBD the_DT world_NN 's_POS first_JJ metal_NN movable_JJ type_NN in_IN 1234_CD ._. [_-LRB- 3_CD ]_-RRB- [_-LRB- 4_CD ]_-RRB- [_-LRB- 5_CD ]_-RRB- [_-LRB- 6_CD ]_-RRB- [_-LRB- 7_CD ]_-RRB- [_-LRB- 8_CD ]_-RRB- However_RB ,_, multiple_JJ incursions_NNS by_IN the_DT Mongol_NNP Empire_NNP during_IN the_DT 13th_JJ century_NN greatly_RB weakened_VBD the_DT nation_NN ,_, which_WDT eventually_RB agreed_VBD to_TO become_VB a_DT vassal_JJ state_NN after_IN decades_NNS of_IN fighting_NN ._. Following_VBG military_JJ resistance_NN under_IN King_NNP Gongmin_NNP that_WDT ended_VBD Mongol_NNP political_JJ influence_NN in_IN Goryeo_NNP ,_, severe_JJ political_JJ strife_NN followed_VBD ,_, and_CC Goryeo_NNP eventually_RB fell_VBD to_IN a_DT coup_NN led_VBN by_IN General_NNP Yi_NNP Seong_NNP -_HYPH gye_NNP ,_, who_WP established_VBD Joseon_NNP in_IN 17_CD July_NNP 1392_CD ._. The_DT first_JJ 200_CD years_NNS of_IN the_DT Joseon_NNP era_NN were_VBD marked_VBN by_IN relative_JJ peace_NN ._. During_IN this_DT period_NN ,_, the_DT Korean_JJ alphabet_NN was_VBD created_VBN by_IN Sejong_NNP the_DT Great_NNP in_IN the_DT 15th_JJ century_NN and_CC there_EX was_VBD increasing_VBG influence_NN of_IN Confucianism_NNP ._. During_IN the_DT later_JJ part_NN of_IN the_DT dynasty_NN ,_, Korea_NNP 's_POS isolationist_JJ policy_NN earned_VBD it_PRP the_DT Western_JJ nickname_NN of_IN the_DT "_`` Hermit_NNP Kingdom_NNP "_'' ._. By_IN the_DT late_JJ 19th_JJ century_NN ,_, the_DT country_NN became_VBD the_DT object_NN of_IN imperial_JJ design_NN by_IN the_DT Empire_NN of_IN Japan_NNP ._. After_IN the_DT First_NNP Sino_NNP -_HYPH Japanese_NNP War_NNP ,_, despite_IN the_DT Korean_NNP Empire_NNP 's_POS effort_NN to_TO modernize_VB ,_, the_DT country_NN was_VBD annexed_VBN by_IN Japan_NNP in_IN 22_CD August_NNP 1910_CD and_CC directly_RB ruled_VBN by_IN it_PRP until_IN the_DT end_NN of_IN World_NNP War_NNP II_NNP in_IN 2_CD September_NNP 1945_CD ._. In_IN 1945_CD ,_, the_DT Soviet_NNP Union_NNP and_CC the_DT United_NNP States_NNP agreed_VBD on_IN the_DT surrender_NN of_IN Japanese_JJ forces_NNS in_IN Korea_NNP in_IN the_DT aftermath_NN of_IN World_NNP War_NNP II_NNP ,_, leaving_VBG Korea_NNP partitioned_VBN along_IN the_DT 38th_JJ parallel_NN ._. The_DT North_NNP was_VBD under_IN Soviet_JJ occupation_NN and_CC the_DT South_NNP under_IN U.S._NNP occupation_NN ._. These_DT circumstances_NNS became_VBD the_DT basis_NN for_IN the_DT division_NN of_IN Korea_NNP by_IN the_DT two_CD superpowers_NNS with_IN two_CD different_JJ ideologies_NNS ,_, exacerbated_VBN by_IN their_PRP$ inability_NN to_TO agree_VB on_IN the_DT terms_NNS of_IN Korean_JJ independence_NN ._. The_DT Communist_JJ -_HYPH inspired_JJ government_NN in_IN the_DT North_NNP received_VBD backing_NN from_IN the_DT Soviet_NNP Union_NNP in_IN opposition_NN to_IN the_DT pro-Western_JJ government_NN in_IN the_DT South_NNP ,_, leading_VBG to_IN Korea_NNP 's_POS division_NN into_IN two_CD political_JJ entities_NNS in_IN 1948_CD :_: North_NNP Korea_NNP ,_, and_CC South_NNP Korea_NNP ._. Tensions_NNS between_IN the_DT two_CD resulted_VBD in_IN the_DT outbreak_NN of_IN the_DT Korean_NNP War_NNP in_IN 1950_CD ._. With_IN involvement_NN by_IN foreign_JJ troops_NNS ,_, the_DT war_NN ended_VBD in_IN a_DT stalemate_NN in_IN 1953_CD ,_, but_CC without_IN a_DT formalized_VBN peace_NN treaty_NN ._. This_DT status_NN contributes_VBZ to_IN the_DT high_JJ tensions_NNS that_WDT continue_VBP to_TO divide_VB the_DT peninsula_NN ._. Both_DT governments_NNS of_IN the_DT two_CD Koreas_NNPS continue_VBP to_TO claim_VB to_TO be_VB the_DT sole_JJ legitimate_JJ government_NN of_IN the_DT region_NN ._. "_'' Korea_NNP "_'' is_VBZ the_DT modern_JJ spelling_NN of_IN "_`` Corea_NNP "_'' ,_, a_DT name_NN attested_VBN in_IN English_NNP as_IN early_JJ as_IN 1614_CD ._. [_-LRB- 9_CD ]_-RRB- [_-LRB- 10_CD ]_-RRB- Korea_NNP was_VBD transliterated_VBN as_IN Cauli_NNP in_IN The_DT Travels_NNPS of_IN Marco_NNP Polo_NNP ,_, [_-LRB- 11_CD ]_-RRB- of_IN the_DT Chinese_JJ 高麗_NN (_-LRB- MC_NNP Kawlej_NNP ,_, [_-LRB- 12_CD ]_-RRB- mod_NNP ._. Gāolì_NNP )_-RRB- ._. This_DT was_VBD the_DT Hanja_NNP for_IN the_DT Korean_JJ kingdom_NN of_IN Goryeo_NNP (_-LRB- Korean_NNP :_: 고려_NN ;_: Hanja_NNP :_: 高麗_NN ;_: MR_NNP :_: Koryŏ_NNP )_-RRB- ,_, which_WDT ruled_VBD most_JJS of_IN the_DT Korean_JJ peninsula_NN during_IN Marco_NNP Polo_NNP 's_POS time_NN ._. Korea_NNP 's_POS introduction_NN to_IN the_DT West_NNP resulted_VBD from_IN trade_NN and_CC contact_NN with_IN merchants_NNS from_IN Arabic_JJ lands_NNS ,_, [_-LRB- 13_CD ]_-RRB- with_IN some_DT records_NNS dating_VBG back_RB as_RB far_RB as_IN the_DT 9th_JJ century_NN ._. [_-LRB- 14_CD ]_-RRB- Goryeo_NNP 's_POS name_NN was_VBD a_DT continuation_NN of_IN Goguryeo_NNP (_-LRB- Koguryŏ_NNP )_-RRB- the_DT northernmost_JJ of_IN the_DT Three_CD Kingdoms_NNS of_IN Korea_NNP ,_, which_WDT was_VBD officially_RB known_VBN as_IN Goryeo_NNP beginning_VBG in_IN the_DT 5th_JJ century_NN ._. [_-LRB- 15_CD ]_-RRB- The_DT original_JJ name_NN was_VBD a_DT combination_NN of_IN the_DT adjective_NN go_NN (_-LRB- "_`` high_JJ ,_, lofty_JJ "_'' )_-RRB- with_IN the_DT name_NN of_IN a_DT local_JJ Yemaek_NNP tribe_NN ,_, whose_WP$ original_JJ name_NN is_VBZ thought_VBN to_TO have_VB been_VBN either_CC *_NFP Guru_NN (_-LRB- 溝樓_NN ,_, "_'' walled_JJ city_NN ,_, "_'' inferred_VBN from_IN some_DT toponyms_NNS in_IN Chinese_JJ historical_JJ documents_NNS )_-RRB- or_CC *_NFP Gauri_NNP (_-LRB- 가우리_NNP ,_, "_`` center_NN "_'' )_-RRB- ._. With_IN expanding_VBG British_JJ and_CC American_JJ trade_NN following_VBG the_DT opening_NN of_IN Korea_NNP in_IN the_DT late_JJ 19th_JJ century_NN ,_, the_DT spelling_NN "_`` Korea_NNP "_'' appeared_VBD and_CC gradually_RB grew_VBD in_IN popularity_NN ;_: [_-LRB- 9_CD ]_-RRB- its_PRP$ use_NN in_IN transcribing_VBG East_JJ Asian_JJ languages_NNS avoids_VBZ the_DT issues_NNS caused_VBN by_IN the_DT separate_JJ hard_JJ and_CC soft_JJ Cs_NNS existing_VBG in_IN English_NNP vocabulary_NN derived_VBN from_IN the_DT Romance_NN languages_NNS ._. The_DT name_NN Korea_NNP is_VBZ now_RB commonly_RB used_VBN in_IN English_NNP contexts_NNS by_IN both_DT North_NNP and_CC South_NNP Korea_NNP ._. In_IN South_NNP Korea_NNP ,_, Korea_NNP as_IN a_DT whole_NN is_VBZ referred_VBN to_IN as_IN Hanguk_NNP (_-LRB- 한국_NNP ,_, [_-LRB- haːnɡuk_NN ]_-RRB- ,_, lit_VBN ._. "_'' country_NN of_IN the_DT Han_NNP "_'' )_-RRB- ._. The_DT name_NN references_NNS Samhan_NNP ,_, referring_VBG to_IN the_DT Three_CD Kingdoms_NNS of_IN Korea_NNP ,_, not_RB the_DT ancient_JJ confederacies_NNS in_IN the_DT southern_JJ Korean_NNP Peninsula_NNP ._. [_-LRB- 16_CD ]_-RRB- [_-LRB- 17_CD ]_-RRB- Although_IN written_VBN in_IN Hanja_NNP as_IN 韓_NNP ,_, 幹_NN ,_, or_CC 刊_NN ,_, this_DT Han_NNP has_VBZ no_DT relation_NN to_IN the_DT Chinese_JJ place_NN names_NNS or_CC peoples_NNS who_WP used_VBD those_DT characters_NNS but_CC was_VBD a_DT phonetic_JJ transcription_NN (_-LRB- OC_NN :_: *_NFP Gar_NNP ,_, MC_NNP Han_NNP [_-LRB- 12_CD ]_-RRB- or_CC Gan_NNP )_-RRB- of_IN a_DT native_JJ Korean_JJ word_NN that_WDT seems_VBZ to_TO have_VB had_VBN the_DT meaning_NN "_`` big_JJ "_'' or_CC "_`` great_JJ "_'' ,_, particularly_RB in_IN reference_NN to_IN leaders_NNS ._. It_PRP has_VBZ been_VBN tentatively_RB linked_VBN with_IN the_DT title_NN khan_NN used_VBN by_IN the_DT nomads_NNS of_IN Manchuria_NNP and_CC Central_NNP Asia_NNP ._. In_IN North_NNP Korea_NNP ,_, Japan_NNP ,_, China_NNP and_CC Vietnam_NNP ,_, Korea_NNP as_IN a_DT whole_NN is_VBZ referred_VBN to_IN as_IN 조선_NN ,_, (_-LRB- Joseon_NNP ,_, [_-LRB- tɕosʰʌn_NN ]_-RRB- )_-RRB- ,_, 朝鮮_NN (_-LRB- Chōsen_NNP )_-RRB- ,_, 朝鲜_NN /_HYPH 朝鮮_NN (_-LRB- Cháoxiǎn_NNP /_HYPH Jīusīn_NNP )_-RRB- ,_, Triều_NNP Tiên_NNP (_-LRB- 朝鮮_NN )_-RRB- lit_VBN ._. "_'' [_-LRB- land_NN of_IN the_DT ]_-RRB- Morning_NNP Calm_NNP "_'' )_-RRB- ._. "_'' Great_NNP Joseon_NNP "_'' was_VBD the_DT name_NN of_IN the_DT kingdom_NN ruled_VBN by_IN the_DT Joseon_NNP dynasty_NN from_IN 1393_CD until_IN their_PRP$ declaration_NN of_IN the_DT short_JJ -_HYPH lived_JJ Great_JJ Korean_JJ Empire_NN in_IN 1897_CD ._. King_NNP Taejo_NNP had_VBD named_VBN them_PRP for_IN the_DT earlier_JJR Kojoseon_NN (_-LRB- 고조선_NN )_-RRB- ,_, who_WP ruled_VBD northern_JJ Korea_NNP from_IN its_PRP$ legendary_JJ prehistory_NN until_IN their_PRP$ conquest_NN in_IN 108_CD BCE_NNP by_IN China_NNP 's_POS Han_NNP Empire_NNP ._. This_DT go_NN is_VBZ the_DT Hanja_NNP 古_NN and_CC simply_RB means_VBZ "_`` ancient_JJ "_'' or_CC "_`` old_JJ "_'' ;_: it_PRP is_VBZ a_DT modern_JJ usage_NN to_TO distinguish_VB the_DT ancient_JJ Joseon_NNP from_IN the_DT later_JJ dynasty_NN ._. Joseon_NNP itself_PRP is_VBZ the_DT modern_JJ Korean_JJ pronunciation_NN of_IN the_DT Hanja_NNP 朝鮮_NN but_CC it_PRP is_VBZ unclear_JJ whether_IN this_DT was_VBD a_DT transcription_NN of_IN a_DT native_JJ Korean_JJ name_NN (_-LRB- OC_NN *_SYM T_NN [_-LRB- r_NN ]_-RRB- awser_NN ,_, MC_NNP Trjewsjen_NNP [_-LRB- 12_CD ]_-RRB- )_-RRB- or_CC a_DT partial_JJ translation_NN into_IN Chinese_JJ of_IN the_DT Korean_JJ capital_NN Asadal_NNP (_-LRB- 아사달_NN )_-RRB- ,_, [_-LRB- 18_CD ]_-RRB- whose_WP$ meaning_NN has_VBZ been_VBN reconstructed_VBN as_IN "_`` Morning_NNP Land_NNP "_'' or_CC "_`` Mountain_NNP "_'' ._. Korea_NNP consists_VBZ of_IN a_DT peninsula_NN and_CC nearby_JJ islands_NNS located_VBN in_IN East_NNP Asia_NNP ._. The_DT peninsula_NN extends_VBZ southwards_RB for_IN about_RB 1,100_CD km_NN (_-LRB- 680_CD mi_NNP )_-RRB- from_IN continental_JJ Asia_NNP into_IN the_DT Pacific_NNP Ocean_NNP and_CC is_VBZ surrounded_VBN by_IN the_DT Sea_NNP of_IN Japan_NNP (_-LRB- East_NNP Sea_NNP )_-RRB- to_IN the_DT east_NN and_CC the_DT Yellow_NNP Sea_NNP (_-LRB- West_NNP Sea_NNP )_-RRB- to_IN the_DT west_NN ,_, the_DT Korea_NNP Strait_NNP connecting_VBG the_DT two_CD bodies_NNS of_IN water_NN ._. [_-LRB- 19_CD ]_-RRB- [_-LRB- 20_CD ]_-RRB- To_IN the_DT northwest_NN ,_, the_DT Amnok_NNP River_NNP separates_VBZ Korea_NNP from_IN China_NNP and_CC to_IN the_DT northeast_NN ,_, the_DT Duman_NNP River_NNP separates_VBZ it_PRP from_IN China_NNP and_CC Russia_NNP ._. [_-LRB- 21_CD ]_-RRB- Notable_JJ islands_NNS include_VBP Jeju_NNP Island_NNP ,_, Ulleung_NNP Island_NNP ,_, Dokdo_NNP ._. The_DT southern_JJ and_CC western_JJ parts_NNS of_IN the_DT peninsula_NN have_VBP well_RB -_HYPH developed_VBN plains_NNS ,_, while_IN the_DT eastern_JJ and_CC northern_JJ parts_NNS are_VBP mountainous_JJ ._. The_DT highest_JJS mountain_NN in_IN Korea_NNP is_VBZ Mount_NNP Paektu_NNP (_-LRB- 2,744_CD m_NN )_-RRB- ,_, through_IN which_WDT runs_VBZ the_DT border_NN with_IN China_NNP ._. The_DT southern_JJ extension_NN of_IN Mount_NNP Paektu_NNP is_VBZ a_DT highland_NN called_VBN Gaema_NNP Heights_NNP ._. This_DT highland_NN was_VBD mainly_RB raised_VBN during_IN the_DT Cenozoic_NNP orogeny_NN and_CC partly_RB covered_VBN by_IN volcanic_JJ matter_NN ._. To_IN the_DT south_NN of_IN Gaema_NNP Gowon_NNP ,_, successive_JJ high_JJ mountains_NNS are_VBP located_VBN along_IN the_DT eastern_JJ coast_NN of_IN the_DT peninsula_NN ._. This_DT mountain_NN range_NN is_VBZ named_VBN Baekdudaegan_NNP ._. Some_DT significant_JJ mountains_NNS include_VBP Mount_NNP Sobaek_NNP or_CC Sobaeksan_NNP (_-LRB- 1,439_CD m_NN )_-RRB- ,_, Mount_NNP Kumgang_NNP (_-LRB- 1,638_CD m_NN )_-RRB- ,_, Mount_NNP Seorak_NNP (_-LRB- 1,708_CD m_NN )_-RRB- ,_, Mount_NNP Taebaek_NNP (_-LRB- 1,567_CD m_NN )_-RRB- ,_, and_CC Mount_NNP Jiri_NNP (_-LRB- 1,915_CD m_NN )_-RRB- ._. There_EX are_VBP several_JJ lower_JJR ,_, secondary_JJ mountain_NN series_NN whose_WP$ direction_NN is_VBZ almost_RB perpendicular_JJ to_IN that_DT of_IN Baekdudaegan_NNP ._. They_PRP are_VBP developed_VBN along_IN the_DT tectonic_JJ line_NN of_IN Mesozoic_JJ orogeny_NN and_CC their_PRP$ directions_NNS are_VBP basically_RB northwest_JJ ._. Unlike_IN most_JJS ancient_JJ mountains_NNS on_IN the_DT mainland_NN ,_, many_JJ important_JJ islands_NNS in_IN Korea_NNP were_VBD formed_VBN by_IN volcanic_JJ activity_NN in_IN the_DT Cenozoic_NNP orogeny_NN ._. Jeju_NNP Island_NNP ,_, situated_VBN off_IN the_DT southern_JJ coast_NN ,_, is_VBZ a_DT large_JJ volcanic_JJ island_NN whose_WP$ main_JJ mountain_NN ,_, Mount_NNP Halla_NNP or_CC Hallasan_NNP (_-LRB- 1,950_CD m_NN )_-RRB- ,_, is_VBZ the_DT highest_JJS in_IN South_NNP Korea_NNP ._. Ulleung_NNP Island_NNP is_VBZ a_DT volcanic_JJ island_NN in_IN the_DT Sea_NN of_IN Japan_NNP ,_, the_DT composition_NN of_IN which_WDT is_VBZ more_RBR felsic_JJ than_IN Jeju_NNP ._. The_DT volcanic_JJ islands_NNS tend_VBP to_TO be_VB younger_JJR ,_, the_DT more_RBR westward_RB ._. Because_IN the_DT mountainous_JJ region_NN is_VBZ mostly_RB on_IN the_DT eastern_JJ part_NN of_IN the_DT peninsula_NN ,_, the_DT main_JJ rivers_NNS tend_VBP to_TO flow_VB westwards_RB ._. Two_CD exceptions_NNS are_VBP the_DT southward_RB -_HYPH flowing_VBG Nakdong_NNP River_NNP and_CC Seomjin_NNP River_NNP ._. Important_JJ rivers_NNS running_VBG westward_RB include_VBP the_DT Amnok_NNP River_NNP ,_, the_DT Chongchon_NNP River_NNP ,_, the_DT Taedong_NNP River_NNP ,_, the_DT Han_NNP River_NNP ,_, the_DT Geum_NNP River_NNP ,_, and_CC the_DT Yeongsan_NNP River_NNP ._. These_DT rivers_NNS have_VBP vast_JJ flood_NN plains_NNS and_CC provide_VB an_DT ideal_JJ environment_NN for_IN wet_JJ -_HYPH rice_NN cultivation_NN ._. The_DT southern_JJ and_CC southwestern_JJ coastlines_NNS of_IN the_DT peninsula_NN form_NN a_DT well_RB -_HYPH developed_VBN ria_NN coastline_NN ,_, known_VBN as_IN Dadohae_NN -_HYPH jin_NN in_IN Korean_JJ ._. This_DT convoluted_JJ coastline_NN provides_VBZ mild_JJ seas_NNS ,_, and_CC the_DT resulting_VBG calm_JJ environment_NN allows_VBZ for_IN safe_JJ navigation_NN ,_, fishing_NN ,_, and_CC seaweed_NN farming_NN ._. In_IN addition_NN to_IN the_DT complex_JJ coastline_NN ,_, the_DT western_JJ coast_NN of_IN the_DT Korean_NNP Peninsula_NNP has_VBZ an_DT extremely_RB high_JJ tidal_JJ amplitude_NN (_-LRB- at_IN Incheon_NNP ,_, around_IN the_DT middle_NN of_IN the_DT western_JJ coast_NN ,_, the_DT tide_NN can_MD get_VB as_RB high_JJ as_IN 9_CD m_NN )_-RRB- ._. Vast_JJ tidal_JJ flats_NNS have_VBP been_VBN developing_VBG on_IN the_DT south_NN and_CC west_NN coastlines_NNS ._. Korea_NNP has_VBZ a_DT temperate_JJ climate_NN with_IN comparatively_RB fewer_JJR typhoons_NNS than_IN other_JJ countries_NNS in_IN East_NNP Asia_NNP ._. Due_IN to_IN the_DT peninsula_NN 's_POS position_NN ,_, it_PRP has_VBZ a_DT unique_JJ climate_NN influenced_VBN by_IN Siberia_NNP in_IN the_DT north_NN ,_, the_DT Pacific_NNP Ocean_NNP in_IN the_DT east_NN and_CC the_DT rest_NN of_IN Eurasia_NNP in_IN the_DT west_NN ._. The_DT peninsula_NN has_VBZ four_CD distinct_JJ seasons_NNS :_: spring_NN ,_, summer_NN ,_, autumn_NN and_CC winter_NN ._. [_-LRB- 22_CD ]_-RRB- As_IN influence_NN from_IN Siberia_NNP weakens_VBZ ,_, temperatures_NNS begin_VBP to_TO increase_VB while_IN the_DT high_JJ pressure_NN begins_VBZ to_TO move_VB away_RB ._. If_IN the_DT weather_NN is_VBZ abnormally_RB dry_JJ ,_, Siberia_NNP will_MD have_VB more_JJR influence_NN on_IN the_DT peninsula_NN leading_VBG to_IN wintry_JJ weather_NN such_JJ as_IN snow_NN ._. [_-LRB- 23_CD ]_-RRB- During_IN June_NNP at_IN the_DT start_NN of_IN the_DT summer_NN ,_, there_EX tends_VBZ to_TO be_VB a_DT lot_NN of_IN rain_NN due_IN to_IN the_DT cold_JJ and_CC wet_JJ air_NN from_IN the_DT Sea_NNP of_IN Okhotsk_NNP and_CC the_DT hot_JJ and_CC humid_JJ air_NN from_IN the_DT Pacific_NNP Ocean_NNP combining_VBG ._. When_WRB these_DT fronts_NNS combine_VBP ,_, it_PRP leads_VBZ to_IN a_DT so_RB -_HYPH called_VBN rainy_JJ season_NN with_IN often_RB cloudy_JJ days_NNS with_IN rain_NN ,_, which_WDT is_VBZ sometimes_RB very_RB heavy_JJ ._. The_DT hot_JJ and_CC humid_JJ winds_NNS from_IN the_DT south_JJ west_NN blow_NN causing_VBG an_DT increasing_VBG amount_NN of_IN humidity_NN and_CC this_DT leads_VBZ to_IN the_DT fronts_NNS moving_VBG towards_IN Manchuria_NNP in_IN China_NNP and_CC thus_RB there_EX is_VBZ less_JJR rain_NN and_CC this_DT is_VBZ known_VBN as_IN midsummer_NN ;_: temperatures_NNS can_MD exceed_VB 30_CD °C_NN (_-LRB- 86_CD °F_NN )_-RRB- daily_RB at_IN this_DT time_NN of_IN year_NN ._. Usually_RB ,_, high_JJ pressure_NN is_VBZ heavily_RB dominant_JJ during_IN autumn_NN leading_VBG to_IN clear_JJ conditions_NNS ._. Furthermore_RB ,_, temperatures_NNS remain_VBP high_JJ but_CC the_DT humidity_NN becomes_VBZ relatively_RB low_JJ ._. The_DT weather_NN becomes_VBZ increasingly_RB dominated_VBN by_IN Siberia_NNP during_IN winter_NN and_CC the_DT jet_NN stream_NN moves_NNS further_RB south_RB causing_VBG a_DT drop_NN in_IN temperature_NN ._. This_DT season_NN is_VBZ relatively_RB dry_JJ with_IN some_DT snow_NN falling_VBG at_IN times_NNS ._. Animal_JJ life_NN of_IN the_DT Korean_NNP Peninsula_NNP includes_VBZ a_DT considerable_JJ number_NN of_IN bird_NN species_NNS and_CC native_JJ freshwater_JJ fish_NN ._. Native_JJ or_CC endemic_JJ species_NNS of_IN the_DT Korean_NNP Peninsula_NNP include_VBP Korean_JJ hare_NN ,_, Korean_JJ water_NN deer_NN ,_, Korean_JJ field_NN mouse_NN ,_, Korean_JJ brown_JJ frog_NN ,_, Korean_JJ pine_NN and_CC Korean_NNP spruce_VBP ._. The_DT Korean_JJ Demilitarized_NNP Zone_NNP (_-LRB- DMZ_NNP )_-RRB- with_IN its_PRP$ forest_NN and_CC natural_JJ wetlands_NNS is_VBZ a_DT unique_JJ biodiversity_NN spot_NN ,_, which_WDT harbours_VBZ eighty_CD -_HYPH two_CD endangered_JJ species_NNS ._. Korea_NNP once_RB hosted_VBD many_JJ Siberian_JJ tigers_NNS ,_, but_CC as_IN the_DT number_NN of_IN people_NNS affected_VBN by_IN the_DT tigers_NNS increased_VBD ,_, the_DT tigers_NNS were_VBD killed_VBN in_IN the_DT Joseon_NNP Dynasty_NNP and_CC the_DT Siberian_JJ tigers_NNS in_IN the_DT South_NNP Korea_NNP became_VBD extinct_JJ during_IN the_DT Japanese_JJ colonial_JJ era_NN period_NN ._. It_PRP has_VBZ been_VBN confirmed_VBN that_IN Siberian_JJ tigers_NNS are_VBP only_RB on_IN the_DT side_NN of_IN North_NNP Korea_NNP now_RB ._. There_EX are_VBP also_RB approximately_RB 3,034_CD species_NNS of_IN vascular_JJ plants_NNS ._. The_DT Korean_NNP Academy_NNP claimed_VBD ancient_JJ hominid_NN fossils_NNS originating_VBG from_IN about_RB 100,000_CD BCE_NNP in_IN the_DT lava_NN at_IN a_DT stone_NN city_NN site_NN in_IN Korea_NNP ._. Fluorescent_JJ and_CC high_JJ -_HYPH magnetic_JJ analyses_NNS indicate_VBP the_DT volcanic_JJ fossils_NNS may_MD be_VB from_IN as_RB early_JJ as_IN 300,000_CD BCE_NNP ._. [_-LRB- 24_CD ]_-RRB- The_DT best_JJS preserved_VBN Korean_JJ pottery_NN goes_VBZ back_RB to_IN the_DT paleolithic_JJ times_NNS around_IN 10,000_CD BCE_NNP and_CC the_DT Neolithic_JJ period_NN begins_VBZ around_IN 6000_CD BCE_NNP ._. According_VBG to_IN legend_NN ,_, Dangun_NNP ,_, a_DT descendant_NN of_IN Heaven_NNP ,_, established_VBN Gojoseon_NNP in_IN 2333_CD BCE_NNP ._. In_IN 108_CD BCE_NNP ,_, the_DT Han_NNP dynasty_NN defeated_VBD Gojoseon_NNP and_CC installed_VBD four_CD commanderies_NNS in_IN the_DT northern_JJ Korean_JJ peninsula_NN ._. Three_CD of_IN the_DT commanderies_NNS fell_VBD or_CC retreated_VBD westward_RB within_IN a_DT few_JJ decades_NNS ,_, but_CC the_DT Lelang_NNP Commandery_NNP remained_VBD as_IN a_DT center_NN of_IN cultural_JJ and_CC economic_JJ exchange_NN with_IN successive_JJ Chinese_JJ dynasties_NNS for_IN four_CD centuries_NNS ._. By_IN 313_CD ,_, Goguryeo_NNP annexed_VBD all_DT of_IN the_DT Chinese_JJ commanderies_NNS ._. The_DT Proto_NN –_HYPH Three_CD Kingdoms_NNS period_NN ,_, sometimes_RB called_VBD the_DT Multiple_JJ States_NNP Period_NN ,_, is_VBZ the_DT earlier_JJR part_NN of_IN what_WP is_VBZ commonly_RB called_VBN the_DT Three_CD Kingdoms_NNS Period_NN ,_, following_VBG the_DT fall_NN of_IN Gojoseon_NNP but_CC before_IN Goguryeo_NNP ,_, Baekje_NNP ,_, and_CC Silla_NNP fully_RB developed_VBD into_IN kingdoms_NNS ._. This_DT time_NN period_NN saw_VBD numerous_JJ states_NNS spring_VBP up_RP from_IN the_DT former_JJ territories_NNS of_IN Gojoseon_NNP ,_, which_WDT encompassed_VBD northern_JJ Korea_NNP and_CC southern_JJ Manchuria_NNP ._. With_IN the_DT fall_NN of_IN Gojoseon_NNP ,_, southern_NNP Korea_NNP entered_VBD the_DT Samhan_NNP period_NN ._. Located_VBN in_IN the_DT southern_JJ part_NN of_IN Korea_NNP ,_, Samhan_NNP referred_VBD to_IN the_DT three_CD confederacies_NNS of_IN Mahan_NNP ,_, Jinhan_NNP ,_, and_CC Byeonhan_NNP ._. Mahan_NNP was_VBD the_DT largest_JJS and_CC consisted_VBD of_IN 54_CD states_NNS ._. Byeonhan_NNP and_CC Jinhan_NNP both_DT consisted_VBD of_IN twelve_CD states_NNS ,_, bringing_VBG a_DT total_NN of_IN 78_CD states_NNS within_IN the_DT Samhan_NNP ._. These_DT three_CD confederacies_NNS eventually_RB developed_VBD into_IN Baekje_NNP ,_, Silla_NNP ,_, and_CC Gaya_NNP ._. The_DT Three_CD Kingdoms_NNS of_IN Korea_NNP consisted_VBD of_IN Goguryeo_NNP ,_, Silla_NNP ,_, and_CC Baekje_NNP ._. Silla_NNP and_CC Baekje_NNP controlled_VBD the_DT southern_JJ half_NN of_IN the_DT Korean_NNP Peninsula_NNP ,_, maintaining_VBG the_DT former_JJ Samhan_NNP territories_NNS ,_, while_IN Goguryeo_NNP controlled_VBD the_DT northern_JJ half_NN of_IN the_DT Korean_NNP Peninsula_NNP ,_, Manchuria_NNP and_CC the_DT Liaodong_NNP Peninsula_NNP ,_, uniting_VBG Buyeo_NNP ,_, Okjeo_NNP ,_, Dongye_NNP ,_, and_CC other_JJ states_NNS in_IN the_DT former_JJ Gojoseon_NNP territories_NNS ._. [_-LRB- 25_CD ]_-RRB- Goguryeo_NNP was_VBD a_DT highly_RB militaristic_JJ state_NN ;_: [_-LRB- 26_CD ]_-RRB- [_-LRB- 27_CD ]_-RRB- [_-LRB- self_NN -_HYPH published_VBN source_NN ?_. ]_-RRB- it_PRP was_VBD a_DT powerful_JJ empire_NN and_CC one_CD of_IN the_DT great_JJ powers_NNS in_IN East_NNP Asia_NNP ,_, [_-LRB- 28_CD ]_-RRB- [_-LRB- 29_CD ]_-RRB- [_-LRB- 30_CD ]_-RRB- [_-LRB- 31_CD ]_-RRB- [_-LRB- self_NN -_HYPH published_VBN source_NN ?_. ]_-RRB- reaching_VBG its_PRP$ zenith_NN in_IN the_DT 5th_JJ century_NN when_WRB its_PRP$ territories_NNS expanded_VBN to_TO encompass_VB most_JJS of_IN Manchuria_NNP to_IN the_DT north_NN ,_, parts_NNS of_IN Inner_NNP Mongolia_NNP to_IN the_DT west_NN ,_, [_-LRB- 32_CD ]_-RRB- parts_NNS of_IN Russia_NNP to_IN the_DT east_NN ,_, [_-LRB- 33_CD ]_-RRB- and_CC the_DT Seoul_NNP region_NN to_IN the_DT south_NN ._. [_-LRB- 34_CD ]_-RRB- Goguryeo_NNP experienced_VBD a_DT golden_JJ age_NN under_IN Gwanggaeto_NNP the_DT Great_NNP and_CC his_PRP$ son_NN Jangsu_NNP ,_, [_-LRB- 35_CD ]_-RRB- [_-LRB- 36_CD ]_-RRB- [_-LRB- 37_CD ]_-RRB- [_-LRB- 38_CD ]_-RRB- who_WP both_DT subdued_JJ Baekje_NNP and_CC Silla_NNP during_IN their_PRP$ times_NNS ,_, achieving_VBG a_DT brief_JJ unification_NN of_IN the_DT Three_CD Kingdoms_NNS of_IN Korea_NNP and_CC becoming_VBG the_DT most_RBS dominant_JJ power_NN on_IN the_DT Korean_NNP Peninsula_NNP ._. [_-LRB- 39_CD ]_-RRB- [_-LRB- 40_CD ]_-RRB- In_IN addition_NN to_IN contesting_VBG for_IN control_NN of_IN the_DT Korean_NNP Peninsula_NNP ,_, Goguryeo_NNP had_VBD many_JJ military_JJ conflicts_NNS with_IN various_JJ Chinese_JJ dynasties_NNS ,_, [_-LRB- 41_CD ]_-RRB- [_-LRB- self_NN -_HYPH published_VBN source_NN ?_. ]_-RRB- most_RBS notably_RB the_DT Goguryeo_NNP –_HYPH Sui_NNP War_NNP ,_, in_IN which_WDT Goguryeo_NNP defeated_VBD a_DT huge_JJ force_NN said_VBD to_IN number_NN over_IN a_DT million_CD men_NNS ._. [_-LRB- 42_CD ]_-RRB- [_-LRB- 43_CD ]_-RRB- [_-LRB- 44_CD ]_-RRB- [_-LRB- 45_CD ]_-RRB- [_-LRB- 46_CD ]_-RRB- In_IN 642_CD ,_, the_DT powerful_JJ general_JJ Yeon_NNP Gaesomun_NNP led_VBD a_DT coup_NN and_CC gained_VBD complete_JJ control_NN over_IN Goguryeo_NNP ._. In_IN response_NN ,_, Emperor_NNP Tang_NNP Taizong_NNP of_IN China_NNP led_VBD a_DT campaign_NN against_IN Goguryeo_NNP ,_, but_CC was_VBD defeated_VBN and_CC retreated_VBN ._. [_-LRB- 47_CD ]_-RRB- [_-LRB- 48_CD ]_-RRB- [_-LRB- self_NN -_HYPH published_VBN source_NN ?_. ]_-RRB- After_IN the_DT death_NN of_IN Tang_NNP Taizong_NNP ,_, his_PRP$ son_NN Emperor_NNP Tang_NNP Gaozong_NNP allied_VBN with_IN the_DT Korean_JJ kingdom_NN of_IN Silla_NNP and_CC invaded_VBD Goguryeo_NNP again_RB ,_, but_CC was_VBD unable_JJ to_TO overcome_VB Goguryeo_NNP 's_POS stalwart_NN defenses_NNS and_CC was_VBD defeated_VBN in_IN 662_CD ._. [_-LRB- 49_CD ]_-RRB- [_-LRB- 50_CD ]_-RRB- However_RB ,_, Yeon_NNP Gaesomun_NNP died_VBD of_IN a_DT natural_JJ cause_NN in_IN 666_CD and_CC Goguryeo_NNP was_VBD thrown_VBN into_IN chaos_NN and_CC weakened_VBN by_IN a_DT succession_NN struggle_NN among_IN his_PRP$ sons_NNS and_CC younger_JJR brother_NN ,_, with_IN his_PRP$ eldest_JJS son_NN defecting_VBG to_IN Tang_NNP and_CC his_PRP$ younger_JJR brother_NN defecting_VBG to_IN Silla_NNP ._. [_-LRB- 51_CD ]_-RRB- [_-LRB- 52_CD ]_-RRB- The_DT Tang_NNP -_HYPH Silla_NNP alliance_NN finally_RB conquered_VBD Goguryeo_NNP in_IN 668_CD ._. After_IN the_DT collapse_NN of_IN Goguryeo_NNP ,_, Tang_NNP and_CC Silla_NNP ended_VBD their_PRP$ alliance_NN and_CC fought_VBD over_IN control_NN of_IN the_DT Korean_NNP Peninsula_NNP ._. Silla_NNP succeeded_VBD in_IN gaining_VBG control_NN over_IN most_JJS of_IN the_DT Korean_NNP Peninsula_NNP ,_, while_IN Tang_NNP gained_VBD control_NN over_IN Goguryeo_NNP 's_POS northern_JJ territories_NNS ._. However_RB ,_, 30_CD years_NNS after_IN the_DT fall_NN of_IN Goguryeo_NNP ,_, a_DT Goguryeo_NNP general_JJ by_IN the_DT name_NN of_IN Dae_NNP Joyeong_NNP founded_VBD the_DT Korean_JJ -_HYPH Mohe_JJ state_NN of_IN Balhae_NNP and_CC successfully_RB expelled_VBD the_DT Tang_NNP presence_NN from_IN much_JJ of_IN the_DT former_JJ Goguryeo_NNP territories_NNS ._. The_DT southwestern_JJ Korean_JJ kingdom_NN of_IN Baekje_NNP was_VBD founded_VBN around_IN modern_JJ -_HYPH day_NN Seoul_NNP by_IN a_DT Goguryeo_NNP prince_NNP ,_, a_DT son_NN of_IN the_DT founder_NN of_IN Goguryeo_NNP ._. [_-LRB- 53_CD ]_-RRB- [_-LRB- 54_CD ]_-RRB- [_-LRB- self_NN -_HYPH published_VBN source_NN ?_. ]_-RRB- [_-LRB- 55_CD ]_-RRB- Baekje_NNP absorbed_VBD all_DT of_IN the_DT Mahan_NNP states_NNS and_CC subjugated_VBN most_JJS of_IN the_DT western_JJ Korean_JJ peninsula_NN (_-LRB- including_VBG the_DT modern_JJ provinces_NNS of_IN Gyeonggi_NNP ,_, Chungcheong_NNP ,_, and_CC Jeolla_NNP ,_, as_RB well_RB as_IN parts_NNS of_IN Hwanghae_NNP and_CC Gangwon_NNP )_-RRB- to_IN a_DT centralised_JJ government_NN ;_: during_IN the_DT expansion_NN of_IN its_PRP$ territory_NN ,_, Baekje_NNP acquired_VBD Chinese_JJ culture_NN and_CC technology_NN through_IN maritime_JJ contacts_NNS with_IN the_DT Southern_NNP Dynasties_NNPS ._. Baekje_NNP was_VBD a_DT great_JJ maritime_JJ power_NN ;_: [_-LRB- 56_CD ]_-RRB- its_PRP$ nautical_JJ skill_NN ,_, which_WDT made_VBD it_PRP the_DT Phoenicia_NNP of_IN East_NNP Asia_NNP ,_, was_VBD instrumental_JJ in_IN the_DT dissemination_NN of_IN Buddhism_NNP throughout_IN East_NNP Asia_NNP and_CC continental_JJ culture_NN to_IN Japan_NNP ._. [_-LRB- 57_CD ]_-RRB- [_-LRB- 58_CD ]_-RRB- Historic_JJ evidence_NN suggests_VBZ that_IN Japanese_JJ culture_NN ,_, art_NN ,_, and_CC language_NN were_VBD influenced_VBN by_IN the_DT kingdom_NN of_IN Baekje_NNP and_CC Korea_NNP itself_PRP ;_: [_-LRB- 31_CD ]_-RRB- [_-LRB- 59_CD ]_-RRB- [_-LRB- 60_CD ]_-RRB- [_-LRB- 61_CD ]_-RRB- [_-LRB- 62_CD ]_-RRB- [_-LRB- 63_CD ]_-RRB- [_-LRB- 64_CD ]_-RRB- [_-LRB- 65_CD ]_-RRB- [_-LRB- 66_CD ]_-RRB- [_-LRB- 67_CD ]_-RRB- [_-LRB- 68_CD ]_-RRB- [_-LRB- 69_CD ]_-RRB- Baekje_NNP also_RB played_VBD an_DT important_JJ role_NN in_IN transmitting_VBG advanced_JJ Chinese_JJ culture_NN to_IN the_DT Japanese_JJ archipelago_NN ._. Baekje_NNP was_VBD once_RB a_DT great_JJ military_JJ power_NN on_IN the_DT Korean_NNP Peninsula_NNP ,_, most_RBS notably_RB in_IN the_DT 4th_JJ century_NN during_IN the_DT rule_NN of_IN Geunchogo_NNP when_WRB its_PRP$ influence_NN extended_VBD across_IN the_DT sea_NN to_IN Liaoxi_NNP and_CC Shandong_NNP in_IN China_NNP ,_, taking_VBG advantage_NN of_IN the_DT weakened_JJ state_NN of_IN Former_JJ Qin_NNP ,_, and_CC Kyushu_NNP in_IN the_DT Japanese_JJ archipelago_NN ;_: [_-LRB- 70_CD ]_-RRB- however_RB ,_, Baekje_NNP was_VBD critically_RB defeated_VBN by_IN Gwanggaeto_NNP the_DT Great_NNP and_CC declined_VBD ._. [_-LRB- citation_NN needed_VBN ]_-RRB- Although_IN later_JJ records_NNS claim_VBP that_IN Silla_NNP was_VBD the_DT oldest_JJS of_IN the_DT Three_CD Kingdoms_NNS of_IN Korea_NNP ,_, it_PRP is_VBZ now_RB believed_VBN to_TO have_VB been_VBN the_DT last_JJ kingdom_NN to_TO develop_VB ._. By_IN the_DT 2nd_JJ century_NN ,_, Silla_NNP existed_VBD as_IN a_DT large_JJ state_NN in_IN the_DT southeast_NN ,_, occupying_VBG and_CC influencing_VBG its_PRP$ neighboring_NN city_NN -_HYPH states_NNS ._. In_IN 562_CD ,_, Silla_NNP annexed_VBD the_DT Gaya_NNP confederacy_NN ,_, which_WDT was_VBD located_VBN between_IN Baekje_NNP and_CC Silla_NNP ._. The_DT Three_CD Kingdoms_NNS of_IN Korea_NNP often_RB warred_VBD with_IN each_DT other_JJ and_CC Silla_NNP was_VBD often_RB dominated_VBN by_IN Baekje_NNP and_CC Goguryeo_NNP ._. Silla_NNP was_VBD the_DT smallest_JJS and_CC weakest_JJS of_IN the_DT three_CD ,_, but_CC it_PRP used_VBD cunning_JJ diplomatic_JJ means_NNS to_TO make_VB opportunistic_JJ pacts_NNS and_CC alliances_NNS with_IN the_DT more_RBR powerful_JJ Korean_JJ kingdoms_NNS ,_, and_CC eventually_RB Tang_NNP China_NNP ,_, to_IN its_PRP$ great_JJ advantage_NN ._. [_-LRB- 71_CD ]_-RRB- [_-LRB- 72_CD ]_-RRB- In_IN 660_CD ,_, King_NNP Muyeol_NNP ordered_VBD his_PRP$ armies_NNS to_TO attack_VB Baekje_NNP ._. General_NNP Kim_NNP Yu_NNP -_HYPH shin_NN ,_, aided_VBN by_IN Tang_NNP forces_NNS ,_, conquered_VBD Baekje_NNP after_IN defeating_VBG General_NNP Gyebaek_NNP at_IN the_DT Battle_NN of_IN Hwangsanbeol_NNP ._. In_IN 661_CD ,_, Silla_NNP and_CC Tang_NNP attacked_VBD Goguryeo_NNP but_CC were_VBD repelled_VBN ._. King_NNP Munmu_NNP ,_, son_NN of_IN Muyeol_NNP and_CC nephew_NN of_IN General_NNP Kim_NNP Yu_NNP -_HYPH shin_NN ,_, launched_VBD another_DT campaign_NN in_IN 667_CD and_CC Goguryeo_NNP fell_VBD in_IN the_DT following_JJ year_NN ._. Beginning_VBG in_IN the_DT 6th_JJ century_NN ,_, Silla_NNP 's_POS power_NN gradually_RB extended_VBD across_IN the_DT Korean_NNP Peninsula_NNP ._. Silla_NNP first_RB annexed_VBD the_DT adjacent_JJ Gaya_NNP confederacy_NN in_IN 562_CD ._. By_IN the_DT 640s_NNS ,_, Silla_NNP formed_VBD an_DT alliance_NN with_IN the_DT Tang_NNP dynasty_NN of_IN China_NNP to_TO conquer_VB Baekje_NNP and_CC later_RB Goguryeo_NNP ._. After_IN conquering_VBG Baekje_NNP and_CC Goguryeo_NNP ,_, Silla_NNP repulsed_VBD Tang_NNP China_NNP from_IN the_DT Korean_JJ peninsula_NN in_IN 676_CD ._. Even_RB though_IN Silla_NNP unified_VBD most_JJS of_IN the_DT Korean_NNP Peninsula_NNP ,_, most_JJS of_IN the_DT Goguryeo_NNP territories_NNS to_IN the_DT north_NN of_IN the_DT Korean_NNP Peninsula_NNP were_VBD ruled_VBN by_IN Balhae_NNP ._. Former_JJ Goguryeo_NNP general_NN [_-LRB- 73_CD ]_-RRB- [_-LRB- 74_CD ]_-RRB- or_CC chief_NN of_IN Sumo_NNP Mohe_NNP [_-LRB- 75_CD ]_-RRB- [_-LRB- 76_CD ]_-RRB- [_-LRB- 77_CD ]_-RRB- Dae_NNP Jo_NNP -_HYPH yeong_NNP led_VBD a_DT group_NN of_IN Goguryeo_NNP and_CC Mohe_NNP refugees_NNS to_IN the_DT Jilin_NNP and_CC founded_VBD the_DT kingdom_NN of_IN Balhae_NNP ,_, 30_CD years_NNS after_IN the_DT collapse_NN of_IN Goguryeo_NNP ,_, as_IN the_DT successor_NN to_TO Goguryeo_NNP ._. At_IN its_PRP$ height_NN ,_, Balhae_NNP 's_POS territories_NNS extended_VBD from_IN southern_JJ Manchuria_NNP down_RB to_IN the_DT northern_JJ Korean_JJ peninsula_NN ._. Balhae_NNP was_VBD called_VBN the_DT "_`` Prosperous_JJ Country_NN in_IN the_DT East_NNP "_'' ._. [_-LRB- 78_CD ]_-RRB- Later_RBR Silla_NNP carried_VBD on_IN the_DT maritime_JJ prowess_NN of_IN Baekje_NNP ,_, which_WDT acted_VBD like_IN the_DT Phoenicia_NNP of_IN medieval_JJ East_NNP Asia_NNP ,_, [_-LRB- 79_CD ]_-RRB- and_CC during_IN the_DT 8th_NN and_CC 9th_JJ centuries_NNS dominated_VBD the_DT seas_NNS of_IN East_NNP Asia_NNP and_CC the_DT trade_NN between_IN China_NNP ,_, Korea_NNP and_CC Japan_NNP ,_, most_RBS notably_RB during_IN the_DT time_NN of_IN Jang_NNP Bogo_NNP ;_: in_IN addition_NN ,_, Silla_NNP people_NNS made_VBD overseas_JJ communities_NNS in_IN China_NNP on_IN the_DT Shandong_NNP Peninsula_NNP and_CC the_DT mouth_NN of_IN the_DT Yangtze_NNP River_NNP ._. [_-LRB- 80_CD ]_-RRB- [_-LRB- 81_CD ]_-RRB- [_-LRB- 82_CD ]_-RRB- [_-LRB- 83_CD ]_-RRB- Later_RBR Silla_NNP was_VBD a_DT prosperous_JJ and_CC wealthy_JJ country_NN ,_, [_-LRB- 84_CD ]_-RRB- and_CC its_PRP$ metropolitan_JJ capital_NN of_IN Gyeongju_NNP [_-LRB- 85_CD ]_-RRB- was_VBD the_DT fourth_JJ largest_JJS city_NN in_IN the_DT world_NN ._. [_-LRB- 86_CD ]_-RRB- [_-LRB- 87_CD ]_-RRB- [_-LRB- 88_CD ]_-RRB- [_-LRB- 89_CD ]_-RRB- Later_RBR Silla_NNP was_VBD a_DT golden_JJ age_NN of_IN art_NN and_CC culture_NN ,_, [_-LRB- 90_CD ]_-RRB- [_-LRB- 91_CD ]_-RRB- [_-LRB- 92_CD ]_-RRB- [_-LRB- 93_CD ]_-RRB- as_IN evidenced_VBN by_IN the_DT Hwangnyongsa_NNP ,_, Seokguram_NNP ,_, and_CC Emille_NNP Bell_NNP ._. Buddhism_NNP flourished_VBD during_IN this_DT time_NN ,_, and_CC many_JJ Korean_JJ Buddhists_NNPS gained_VBD great_JJ fame_NN among_IN Chinese_JJ Buddhists_NNPS [_-LRB- 94_CD ]_-RRB- and_CC contributed_VBD to_IN Chinese_NNP Buddhism_NNP ,_, [_-LRB- 95_CD ]_-RRB- including_VBG :_: Woncheuk_NNP ,_, Wonhyo_NNP ,_, Uisang_NNP ,_, Musang_NNP ,_, [_-LRB- 96_CD ]_-RRB- [_-LRB- 97_CD ]_-RRB- [_-LRB- 98_CD ]_-RRB- [_-LRB- 99_CD ]_-RRB- and_CC Kim_NNP Gyo_NNP -_HYPH gak_NNP ,_, a_DT Silla_NNP prince_NNP whose_WP$ influence_NN made_VBD Mount_NNP Jiuhua_NNP one_CD of_IN the_DT Four_CD Sacred_NNP Mountains_NNPS of_IN Chinese_NNP Buddhism_NNP ._. [_-LRB- 100_CD ]_-RRB- [_-LRB- 101_CD ]_-RRB- [_-LRB- 102_CD ]_-RRB- [_-LRB- 103_CD ]_-RRB- [_-LRB- 104_CD ]_-RRB- Later_RBR Silla_NNP fell_VBD apart_RB in_IN the_DT late_JJ 9th_JJ century_NN ,_, giving_VBG way_NN to_IN the_DT tumultuous_JJ Later_RBR Three_CD Kingdoms_NNS period_NN (_-LRB- 892_CD –_SYM 935_CD )_-RRB- ,_, and_CC Balhae_NNP was_VBD destroyed_VBN by_IN the_DT Khitans_NNPS in_IN 926_CD ._. Goryeo_NNP unified_VBD the_DT Later_JJ Three_CD Kingdoms_NNS and_CC received_VBD the_DT last_JJ crown_NN prince_NN and_CC much_JJ of_IN the_DT ruling_NN class_NN of_IN Balhae_NNP ,_, thus_RB bringing_VBG about_RB a_DT unification_NN of_IN the_DT two_CD successor_NN nations_NNS of_IN Goguryeo_NNP ._. [_-LRB- 105_CD ]_-RRB- Goryeo_NNP was_VBD founded_VBN in_IN 918_CD and_CC replaced_VBD Silla_NNP as_IN the_DT ruling_NN dynasty_NN of_IN Korea_NNP ._. Goryeo_NNP 's_POS land_NN was_VBD at_IN first_RB what_WP is_VBZ now_RB South_NNP Korea_NNP and_CC about_IN 1/3_CD of_IN North_NNP Korea_NNP ,_, but_CC later_RB on_IN managed_VBN to_TO recover_VB most_JJS of_IN the_DT Korean_JJ peninsula_NN ._. Momentarily_RB ,_, Goryeo_NNP advanced_VBD to_IN parts_NNS of_IN Jiandao_NNP while_IN conquering_VBG the_DT Jurchens_NNPS ,_, but_CC returned_VBD the_DT territories_NNS due_IN to_IN the_DT harsh_JJ climate_NN and_CC difficulties_NNS in_IN defending_VBG them_PRP ._. The_DT name_NN "_`` Goryeo_NNP "_'' (_-LRB- 高麗_FW )_-RRB- is_VBZ a_DT short_JJ form_NN of_IN "_`` Goguryeo_NNP "_'' (_-LRB- 高句麗_FW )_-RRB- and_CC was_VBD first_RB used_VBN during_IN the_DT time_NN of_IN King_NNP Jangsu_NNP ._. Goryeo_NNP regarded_VBD itself_PRP as_IN the_DT successor_NN of_IN Goguryeo_NNP ,_, hence_RB its_PRP$ name_NN and_CC efforts_NNS to_TO recover_VB the_DT former_JJ territories_NNS of_IN Goguryeo_NNP ._. [_-LRB- 106_CD ]_-RRB- [_-LRB- 107_CD ]_-RRB- [_-LRB- 108_CD ]_-RRB- [_-LRB- 109_CD ]_-RRB- Wang_NNP Geon_NNP ,_, the_DT founder_NN of_IN Goryeo_NNP ,_, was_VBD of_IN Goguryeo_NNP descent_NN and_CC traced_VBD his_PRP$ ancestry_NN to_IN a_DT noble_JJ Goguryeo_NNP clan_NN ._. [_-LRB- 110_CD ]_-RRB- He_PRP made_VBD Kaesong_NNP ,_, his_PRP$ hometown_NN ,_, the_DT capital_NN ._. During_IN this_DT period_NN ,_, laws_NNS were_VBD codified_VBN and_CC a_DT civil_JJ service_NN system_NN was_VBD introduced_VBN ._. Buddhism_NNP flourished_VBD and_CC spread_VBD throughout_IN the_DT peninsula_NN ._. The_DT development_NN of_IN celadon_NN industries_NNS flourished_VBD in_IN the_DT 12th_NN and_CC 13th_NN centuries_NNS ._. The_DT publication_NN of_IN the_DT Tripitaka_NNP Koreana_NNP onto_IN more_JJR than_IN 80,000_CD wooden_JJ blocks_NNS and_CC the_DT invention_NN of_IN the_DT world_NN 's_POS first_JJ metal_NN movable_JJ type_NN in_IN the_DT 13th_JJ century_NN attest_VB to_TO Goryeo_NNP 's_POS cultural_JJ achievements_NNS ._. [_-LRB- 3_CD ]_-RRB- [_-LRB- 4_CD ]_-RRB- [_-LRB- 5_CD ]_-RRB- [_-LRB- 6_CD ]_-RRB- [_-LRB- 7_CD ]_-RRB- [_-LRB- 8_CD ]_-RRB- Goryeo_NNP had_VBD to_TO defend_VB frequently_RB against_IN attacks_NNS by_IN nomadic_JJ empires_NNS ,_, especially_RB the_DT Khitans_NNPS and_CC the_DT Mongols_NNPS ._. Goryeo_NNP had_VBD a_DT hostile_JJ relationship_NN with_IN the_DT Khitans_NNPS ,_, because_IN the_DT Khitan_NNP Empire_NNP had_VBD destroyed_VBN Balhae_NNP ,_, also_RB a_DT successor_NN state_NN of_IN Goguryeo_NNP ._. In_IN 993_CD ,_, the_DT Khitans_NNPS ,_, who_WP had_VBD established_VBN the_DT Liao_NNP dynasty_NN in_IN 907_CD ,_, invaded_VBD Goryeo_NNP ,_, demanding_VBG that_IN it_PRP make_VBP amity_NN with_IN them_PRP ._. Goryeo_NNP sent_VBD the_DT diplomat_NN Seo_NNP Hui_NNP to_TO negotiate_VB ,_, who_WP successfully_RB persuaded_VBD the_DT Khitans_NNPS to_TO let_VB Goryeo_NNP expand_VB to_IN the_DT banks_NNS of_IN the_DT Amnok_NNP (_-LRB- Yalu_NNP )_-RRB- River_NNP ,_, citing_VBG that_IN in_IN the_DT past_NN the_DT land_NN belonged_VBD to_IN Goguryeo_NNP ,_, the_DT predecessor_NN of_IN Goryeo_NNP ._. [_-LRB- 111_CD ]_-RRB- During_IN the_DT Goryeo_NNP –_HYPH Khitan_NNP War_NNP ,_, the_DT Khitan_NNP Empire_NNP invaded_VBD Korea_NNP twice_RB more_RBR in_IN 1009_CD and_CC 1018_CD ,_, but_CC was_VBD defeated_VBN ._. After_IN defeating_VBG the_DT Khitan_NNP Empire_NNP ,_, which_WDT was_VBD the_DT most_RBS powerful_JJ empire_NN of_IN its_PRP$ time_NN ,_, [_-LRB- 112_CD ]_-RRB- [_-LRB- 113_CD ]_-RRB- Goryeo_NNP experienced_VBD a_DT golden_JJ age_NN that_WDT lasted_VBD a_DT century_NN ,_, during_IN which_WDT the_DT Tripitaka_NNP Koreana_NNP was_VBD completed_VBN ,_, and_CC there_EX were_VBD great_JJ developments_NNS in_IN printing_NN and_CC publishing_NN ,_, promoting_VBG learning_NN and_CC dispersing_VBG knowledge_NN on_IN philosophy_NN ,_, literature_NN ,_, religion_NN ,_, and_CC science_NN ;_: by_IN 1100_CD ,_, there_EX were_VBD 12_CD universities_NNS that_WDT produced_VBD famous_JJ scholars_NNS and_CC scientists_NNS ._. [_-LRB- 114_CD ]_-RRB- [_-LRB- 115_CD ]_-RRB- Goryeo_NNP was_VBD invaded_VBN by_IN the_DT Mongols_NNPS in_IN seven_CD major_JJ campaigns_NNS from_IN the_DT 1230s_NNS until_IN the_DT 1270s_NNS ,_, but_CC was_VBD never_RB conquered_VBN ._. [_-LRB- 116_CD ]_-RRB- Exhausted_JJ after_IN decades_NNS of_IN fighting_NN ,_, Goryeo_NNP sent_VBD its_PRP$ crown_NN prince_NN to_IN the_DT Yuan_JJ capital_NN to_TO swear_VB allegiance_NN to_IN the_DT Mongols_NNPS ;_: Kublai_NNP Khan_NNP accepted_VBD ,_, and_CC married_VBD one_CD of_IN his_PRP$ daughters_NNS to_IN the_DT Korean_JJ crown_NN prince_NN ,_, [_-LRB- 116_CD ]_-RRB- and_CC the_DT dynastic_JJ line_NN of_IN Goryeo_NNP continued_VBD to_TO survive_VB under_IN the_DT overlordship_NN of_IN the_DT Mongol_NNP Yuan_NNP dynasty_NN as_IN a_DT semi-autonomous_JJ vassal_JJ state_NN and_CC compulsory_JJ ally_NN ._. The_DT two_CD nations_NNS became_VBD intertwined_JJ for_IN 80_CD years_NNS as_IN all_DT subsequent_JJ Korean_JJ kings_NNS married_VBN Mongol_NNP princesses_NNS ,_, [_-LRB- 116_CD ]_-RRB- and_CC the_DT last_JJ empress_NN of_IN the_DT Yuan_NNP dynasty_NN was_VBD a_DT Korean_JJ princess_NN ._. [_-LRB- citation_NN needed_VBN ]_-RRB- In_IN the_DT 1350s_NNS ,_, King_NNP Gongmin_NNP was_VBD free_JJ at_IN last_JJ to_TO reform_VB the_DT Goryeo_NNP government_NN when_WRB the_DT Yuan_NNP dynasty_NN began_VBD to_TO crumble_VB ._. Gongmin_NNP had_VBD various_JJ problems_NNS that_WDT needed_VBD to_TO be_VB dealt_VBN with_IN ,_, which_WDT included_VBD the_DT removal_NN of_IN pro-Mongol_JJ aristocrats_NNS and_CC military_JJ officials_NNS ,_, the_DT question_NN of_IN land_NN holding_NN ,_, and_CC quelling_VBG the_DT growing_VBG animosity_NN between_IN the_DT Buddhists_NNPS and_CC Confucian_JJ scholars_NNS ._. During_IN this_DT tumultuous_JJ period_NN ,_, Goryeo_NNP momentarily_RB conquered_VBD Liaoyang_NNP in_IN 1356_CD ,_, repulsed_VBD two_CD large_JJ invasions_NNS by_IN the_DT Red_NNP Turbans_NNPS in_IN 1359_CD and_CC 1360_CD ,_, and_CC defeated_VBD the_DT final_JJ attempt_NN by_IN the_DT Yuan_NNP to_TO dominate_VB Goryeo_NNP when_WRB General_NNP Choe_NNP Yeong_NNP defeated_VBD a_DT Mongol_NNP tumen_NN in_IN 1364_CD ._. During_IN the_DT 1380s_NNS ,_, Goryeo_NNP turned_VBD its_PRP$ attention_NN to_IN the_DT Wokou_NNP threat_NN and_CC used_VBN naval_JJ artillery_NN created_VBN by_IN Choe_NNP Museon_NNP to_TO annihilate_VB hundreds_NNS of_IN pirate_NN ships_NNS ._. In_IN 1392_CD ,_, the_DT general_JJ Yi_NNP Seong_NNP -_HYPH gye_NNP overthrew_VBD the_DT Goryeo_NNP dynasty_NN after_IN he_PRP staged_VBD a_DT coup_NN and_CC defeated_VBD General_NNP Choe_NNP Yeong_NNP ._. Yi_NNP Seong_NNP -_HYPH gye_NNP named_VBD his_PRP$ new_JJ dynasty_NN Joseon_NNP and_CC moved_VBD the_DT capital_NN from_IN Kaesong_NNP to_TO Hanseong_NNP (_-LRB- formerly_RB Hanyang_NNP ;_: modern_JJ -_HYPH day_NN Seoul_NNP )_-RRB- and_CC built_VBD the_DT Gyeongbokgung_NNP palace_NN ._. [_-LRB- 117_CD ]_-RRB- In_IN 1394_CD ,_, he_PRP adopted_VBD Confucianism_NNP as_IN the_DT country_NN 's_POS official_JJ ideology_NN ,_, resulting_VBG in_IN much_JJ loss_NN of_IN power_NN and_CC wealth_NN by_IN the_DT Buddhists_NNPS ._. The_DT prevailing_JJ philosophy_NN of_IN the_DT Joseon_NNP dynasty_NN was_VBD Neo-Confucianism_NNP ,_, which_WDT was_VBD epitomized_VBN by_IN the_DT seonbi_NN class_NN ,_, scholars_NNS who_WP passed_VBD up_RP positions_NNS of_IN wealth_NN and_CC power_NN to_TO lead_VB lives_NNS of_IN study_NN and_CC integrity_NN ._. Joseon_NNP was_VBD a_DT nominal_JJ tributary_JJ state_NN of_IN China_NNP but_CC exercised_VBD full_JJ sovereignty_NN ,_, [_-LRB- 118_CD ]_-RRB- [_-LRB- 119_CD ]_-RRB- and_CC maintained_VBD the_DT highest_JJS position_NN among_IN China_NNP 's_POS tributary_JJ states_NNS ,_, [_-LRB- 120_CD ]_-RRB- [_-LRB- 121_CD ]_-RRB- which_WDT also_RB included_VBD countries_NNS such_JJ as_IN the_DT Ryukyu_NNP Kingdom_NNP ,_, Vietnam_NNP ,_, Burma_NNP ,_, Brunei_NNP ,_, Laos_NNP ,_, Thailand_NNP ,_, [_-LRB- 122_CD ]_-RRB- [_-LRB- 123_CD ]_-RRB- [_-LRB- 124_CD ]_-RRB- and_CC the_DT Philippines_NNPS ,_, among_IN others_NNS ._. [_-LRB- 125_CD ]_-RRB- [_-LRB- 126_CD ]_-RRB- In_IN addition_NN ,_, Joseon_NNP received_VBD tribute_NN from_IN Jurchens_NNP and_CC Japanese_NNP until_IN the_DT 17th_JJ century_NN ,_, [_-LRB- 127_CD ]_-RRB- [_-LRB- 128_CD ]_-RRB- [_-LRB- 129_CD ]_-RRB- and_CC had_VBD a_DT small_JJ enclave_NN in_IN the_DT Ryukyu_NNP Kingdom_NNP that_WDT engaged_VBD in_IN trade_NN with_IN Siam_NNP and_CC Java_NNP ._. [_-LRB- 130_CD ]_-RRB- During_IN the_DT 15th_NN and_CC 16th_JJ centuries_NNS ,_, Joseon_NNP enjoyed_VBD many_JJ benevolent_JJ rulers_NNS who_WP promoted_VBD education_NN and_CC science_NN ._. [_-LRB- 131_CD ]_-RRB- Most_RBS notable_JJ among_IN them_PRP was_VBD Sejong_NNP the_DT Great_NNP (_-LRB- r._NN 1418_CD –_SYM 50_CD )_-RRB- ,_, who_WP personally_RB created_VBD and_CC promulgated_VBD Hangul_NNP ,_, the_DT Korean_JJ alphabet_NN ._. [_-LRB- 132_CD ]_-RRB- This_DT golden_JJ age_NN [_-LRB- 131_CD ]_-RRB- saw_VBD great_JJ cultural_JJ and_CC scientific_JJ advancements_NNS ,_, [_-LRB- 133_CD ]_-RRB- including_VBG in_IN printing_NN ,_, meteorological_JJ observation_NN ,_, astronomy_NN ,_, calendar_NN science_NN ,_, ceramics_NNS ,_, military_JJ technology_NN ,_, geography_NN ,_, cartography_NN ,_, medicine_NN ,_, and_CC agricultural_JJ technology_NN ,_, some_DT of_IN which_WDT were_VBD unrivaled_JJ elsewhere_RB ._. [_-LRB- 134_CD ]_-RRB- Joseon_NNP implemented_VBD a_DT class_NN system_NN that_WDT consisted_VBD of_IN yangban_NNP the_DT noble_JJ class_NN ,_, jungin_NN the_DT middle_JJ class_NN ,_, yangin_NN the_DT common_JJ class_NN ,_, and_CC cheonin_NN the_DT lowest_JJS class_NN ,_, which_WDT included_VBD occupations_NNS such_JJ as_IN butchers_NNS ,_, tanners_NNS ,_, shamans_NNS ,_, entertainers_NNS ,_, and_CC nobi_NN ,_, the_DT equivalent_NN of_IN slaves_NNS ,_, bondservants_NNS ,_, or_CC serfs_NNS ._. [_-LRB- 135_CD ]_-RRB- [_-LRB- 136_CD ]_-RRB- In_IN 1592_CD and_CC again_RB in_IN 1597_CD ,_, the_DT Japanese_JJ invaded_JJ Korea_NN ;_: the_DT Korean_JJ military_NN at_IN the_DT time_NN was_VBD unprepared_JJ and_CC untrained_JJ ,_, due_JJ to_IN two_CD centuries_NNS of_IN peace_NN on_IN the_DT Korean_NNP Peninsula_NNP ._. [_-LRB- 137_CD ]_-RRB- Toyotomi_NNP Hideyoshi_NNP intended_VBD to_TO conquer_VB China_NNP and_CC India_NNP [_-LRB- 138_CD ]_-RRB- through_IN the_DT Korean_NNP Peninsula_NNP ,_, but_CC was_VBD defeated_VBN by_IN strong_JJ resistance_NN from_IN the_DT Righteous_NNP Army_NNP ,_, the_DT naval_JJ superiority_NN of_IN Admiral_NNP Yi_NNP Sun_NNP -_HYPH sin_NN and_CC his_PRP$ turtle_NN ships_NNS ,_, and_CC assistance_NN from_IN Wanli_NNP Emperor_NNP of_IN Ming_NNP China_NNP ._. However_RB ,_, Joseon_NNP experienced_VBD great_JJ destruction_NN ,_, including_VBG a_DT tremendous_JJ loss_NN of_IN cultural_JJ sites_NNS such_JJ as_IN temples_NNS and_CC palaces_NNS to_IN Japanese_JJ pillaging_NN ,_, and_CC the_DT Japanese_JJ brought_VBN back_RB to_IN Japan_NNP an_DT estimated_VBN 100,000_CD –_SYM 200,000_CD noses_NNS cut_VBN from_IN Korean_JJ victims_NNS ._. [_-LRB- 139_CD ]_-RRB- Less_JJR than_IN 30_CD years_NNS after_IN the_DT Japanese_JJ invasions_NNS ,_, the_DT Manchus_NNPS took_VBD advantage_NN of_IN Joseon_NNP 's_POS war_NN -_HYPH weakened_VBN state_NN and_CC invaded_VBD in_IN 1627_CD and_CC 1637_CD ,_, and_CC then_RB went_VBD on_IN to_TO conquer_VB the_DT destabilized_VBN Ming_NNP dynasty_NN ._. After_IN normalizing_VBG relations_NNS with_IN the_DT new_JJ Qing_NNP dynasty_NN ,_, Joseon_NNP experienced_VBD a_DT nearly_RB 200_CD -_HYPH year_NN period_NN of_IN peace_NN ._. Kings_NNS Yeongjo_NNP and_CC Jeongjo_NNP led_VBD a_DT new_JJ renaissance_NN of_IN the_DT Joseon_NNP dynasty_NN during_IN the_DT 18th_JJ century_NN ._. [_-LRB- 140_CD ]_-RRB- [_-LRB- 141_CD ]_-RRB- In_IN the_DT 19th_JJ century_NN ,_, the_DT royal_NN in_IN -_HYPH law_NN families_NNS gained_VBD control_NN of_IN the_DT government_NN ,_, leading_VBG to_IN mass_NN corruption_NN and_CC weakening_NN of_IN the_DT state_NN ,_, with_IN severe_JJ poverty_NN and_CC peasant_NN rebellions_NNS spreading_VBG throughout_IN the_DT country_NN ._. Furthermore_RB ,_, the_DT Joseon_NNP government_NN adopted_VBD a_DT strict_JJ isolationist_JJ policy_NN ,_, earning_VBG the_DT nickname_NN "_`` the_DT hermit_JJ kingdom_NN "_'' ,_, but_CC ultimately_RB failed_VBD to_TO protect_VB itself_PRP against_IN imperialism_NN and_CC was_VBD forced_VBN to_TO open_VB its_PRP$ borders_NNS ,_, beginning_VBG an_DT era_NN leading_VBG into_IN Japanese_JJ imperial_JJ rule_NN ._. Beginning_VBG in_IN 1871_CD ,_, Japan_NNP began_VBD to_TO exert_VB more_JJR influence_NN in_IN Korea_NNP ,_, forcing_VBG it_PRP out_IN of_IN China_NNP 's_POS traditional_JJ sphere_NN of_IN influence_NN ._. As_IN a_DT result_NN of_IN the_DT Sino_JJ -_HYPH Japanese_JJ War_NNP (_-LRB- 1894_CD –_SYM 95_CD )_-RRB- ,_, the_DT Qing_NNP dynasty_NN had_VBD to_TO give_VB up_RP such_PDT a_DT position_NN according_VBG to_IN Article_NN 1_CD of_IN the_DT Treaty_NNP of_IN Shimonoseki_NNP ,_, which_WDT was_VBD concluded_VBN between_IN China_NNP and_CC Japan_NNP in_IN 1895_CD ._. That_DT same_JJ year_NN ,_, Empress_NNP Myeongseong_NNP of_IN Korea_NNP was_VBD assassinated_VBN by_IN Japanese_JJ agents_NNS ._. [_-LRB- 142_CD ]_-RRB- In_IN 1897_CD ,_, the_DT Joseon_NNP dynasty_NN proclaimed_VBD the_DT Korean_JJ Empire_NN (_-LRB- 1897_CD –_SYM 1910_CD )_-RRB- ._. King_NNP Gojong_NNP became_VBD emperor_NN ._. During_IN this_DT brief_JJ period_NN ,_, Korea_NNP had_VBD some_DT success_NN in_IN modernizing_VBG the_DT military_NN ,_, economy_NN ,_, real_JJ property_NN laws_NNS ,_, education_NN system_NN ,_, and_CC various_JJ industries_NNS ._. Russia_NNP ,_, Japan_NNP ,_, France_NNP ,_, and_CC the_DT United_NNP States_NNP all_DT invested_VBN in_IN the_DT country_NN and_CC sought_VBD to_TO influence_VB it_PRP politically_RB ._. In_IN 1904_CD ,_, the_DT Russo_NNP -_HYPH Japanese_NNP War_NNP pushed_VBD the_DT Russians_NNPS out_IN of_IN the_DT fight_NN for_IN Korea_NNP ._. In_IN Manchuria_NNP on_IN 26_CD October_NNP 1909_CD ,_, An_DT Jung_NNP -_HYPH geun_NNP assassinated_VBD the_DT former_JJ Resident_NNP -_HYPH General_NNP of_IN Korea_NNP ,_, Itō_NNP Hirobumi_NNP ,_, for_IN his_PRP$ role_NN in_IN trying_VBG to_TO force_VB Korea_NNP into_IN occupation_NN ._. In_IN 1910_CD ,_, an_DT already_RB militarily_RB occupied_VBN Korea_NNP was_VBD a_DT forced_VBN party_NN to_IN the_DT Japan_NNP –_HYPH Korea_NNP Annexation_NNP Treaty_NNP ._. The_DT treaty_NN was_VBD signed_VBN by_IN Lee_NNP Wan_NNP -_HYPH Yong_NNP ,_, who_WP was_VBD given_VBN the_DT General_NNP Power_NNP of_IN Attorney_NNP by_IN the_DT Emperor_NNP ._. However_RB ,_, the_DT Emperor_NNP is_VBZ said_VBN to_TO have_VB not_RB actually_RB ratified_VBD the_DT treaty_NN according_VBG to_IN Yi_NNP Tae_NNP -_HYPH jin_NN ._. [_-LRB- 143_CD ]_-RRB- There_EX is_VBZ a_DT long_JJ dispute_NN whether_IN this_DT treaty_NN was_VBD legal_JJ or_CC illegal_JJ due_JJ to_IN its_PRP$ signing_NN under_IN duress_NN ,_, threat_NN of_IN force_NN and_CC bribes_NNS ._. Korean_JJ resistance_NN to_IN the_DT brutal_JJ Japanese_JJ occupation_NN [_-LRB- 144_CD ]_-RRB- [_-LRB- 145_CD ]_-RRB- [_-LRB- 146_CD ]_-RRB- was_VBD manifested_VBN in_IN the_DT nonviolent_JJ March_NNP 1st_NNP Movement_NNP of_IN 1919_CD ,_, during_IN which_WDT 7,000_CD demonstrators_NNS were_VBD killed_VBN by_IN Japanese_JJ police_NNS and_CC military_NN ._. [_-LRB- 147_CD ]_-RRB- The_DT Korean_JJ liberation_NN movement_NN also_RB spread_VBD to_IN neighbouring_VBG Manchuria_NNP and_CC Siberia_NNP ._. Over_IN five_CD million_CD Koreans_NNPS were_VBD conscripted_VBN for_IN labour_NN beginning_NN in_IN 1939_CD ,_, [_-LRB- 148_CD ]_-RRB- and_CC tens_NNS of_IN thousands_NNS of_IN men_NNS were_VBD forced_VBN into_IN Japan_NNP 's_POS military_NN ._. [_-LRB- 149_CD ]_-RRB- Nearly_RB 400,000_CD Korean_JJ labourers_NNS died_VBD ._. [_-LRB- 150_CD ]_-RRB- Approximately_RB 200,000_CD girls_NNS and_CC women_NNS ,_, [_-LRB- 151_CD ]_-RRB- mostly_RB from_IN China_NNP and_CC Korea_NNP ,_, were_VBD forced_VBN into_IN sexual_JJ slavery_NN for_IN the_DT Japanese_JJ military_NN ._. [_-LRB- 152_CD ]_-RRB- In_IN 1993_CD ,_, Japanese_JJ Chief_NNP Cabinet_NNP Secretary_NNP Yohei_NNP Kono_NNP acknowledged_VBD the_DT terrible_JJ injustices_NNS faced_VBN by_IN these_DT euphemistically_RB named_VBN "_`` comfort_NN women_NNS "_'' ._. [_-LRB- 153_CD ]_-RRB- [_-LRB- 154_CD ]_-RRB- During_IN the_DT Japanese_JJ annexation_NN ,_, the_DT Korean_JJ language_NN was_VBD suppressed_VBN in_IN an_DT effort_NN to_TO eradicate_VB Korean_JJ national_JJ identity_NN ._. Koreans_NNPS were_VBD forced_VBN to_TO take_VB Japanese_JJ surnames_NNS ,_, known_VBN as_IN Sōshi_NNP -_HYPH kaimei_NNP ._. [_-LRB- 155_CD ]_-RRB- Traditional_JJ Korean_JJ culture_NN suffered_VBD heavy_JJ losses_NNS ,_, as_IN numerous_JJ Korean_JJ cultural_JJ artifacts_NNS were_VBD destroyed_VBN [_-LRB- 156_CD ]_-RRB- or_CC taken_VBN to_IN Japan_NNP ._. [_-LRB- 157_CD ]_-RRB- To_TO this_DT day_NN ,_, valuable_JJ Korean_JJ artifacts_NNS can_MD often_RB be_VB found_VBN in_IN Japanese_JJ museums_NNS or_CC among_IN private_JJ collections_NNS ._. [_-LRB- 158_CD ]_-RRB- One_CD investigation_NN by_IN the_DT South_JJ Korean_JJ government_NN identified_VBD 75,311_CD cultural_JJ assets_NNS that_WDT were_VBD taken_VBN from_IN Korea_NNP ,_, 34,369_CD in_IN Japan_NNP and_CC 17,803_CD in_IN the_DT United_NNP States_NNP ._. However_RB ,_, experts_NNS estimate_VBP that_IN over_IN 100,000_CD artifacts_NNS actually_RB remain_VBP in_IN Japan_NNP ._. [_-LRB- 157_CD ]_-RRB- [_-LRB- 159_CD ]_-RRB- Japanese_JJ officials_NNS considered_VBN returning_VBG Korean_JJ cultural_JJ properties_NNS ,_, but_CC to_IN date_NN [_-LRB- 157_CD ]_-RRB- this_DT has_VBZ not_RB occurred_VBN ._. [_-LRB- 159_CD ]_-RRB- Korea_NNP and_CC Japan_NNP still_RB dispute_VBP the_DT ownership_NN of_IN the_DT Dokdo_NNP islets_NNS ,_, located_VBN east_NN of_IN the_DT Korean_NNP Peninsula_NNP ._. [_-LRB- 160_CD ]_-RRB- There_EX was_VBD significant_JJ emigration_NN to_IN the_DT overseas_JJ territories_NNS of_IN the_DT Empire_NN of_IN Japan_NNP during_IN the_DT Japanese_JJ occupation_NN period_NN ,_, including_VBG Korea_NNP ._. [_-LRB- 161_CD ]_-RRB- By_IN the_DT end_NN of_IN World_NNP War_NNP II_NNP ,_, there_EX were_VBD over_IN 850,000_CD Japanese_JJ settlers_NNS in_IN Korea_NNP ._. [_-LRB- 162_CD ]_-RRB- After_IN World_NNP War_NNP II_NNP ,_, most_JJS of_IN these_DT overseas_JJ Japanese_JJ repatriated_VBN to_IN Japan_NNP ._. [_-LRB- citation_NN needed_VBN ]_-RRB- Migrants_NNPS who_WP remained_VBD squatted_VBN in_IN informal_JJ settlements_NNS ._. [_-LRB- 163_CD ]_-RRB- In_IN 1945_CD ,_, with_IN the_DT surrender_NN of_IN Japan_NNP ,_, the_DT United_NNP Nations_NNP developed_VBD plans_NNS for_IN a_DT trusteeship_NN administration_NN ,_, the_DT Soviet_NNP Union_NNP administering_VBG the_DT peninsula_NN north_NN of_IN the_DT 38th_JJ parallel_NN and_CC the_DT United_NNP States_NNP administering_VBG the_DT south_NN ._. The_DT politics_NNS of_IN the_DT Cold_NNP War_NNP resulted_VBD in_IN the_DT 1948_CD establishment_NN of_IN two_CD separate_JJ governments_NNS ,_, North_NNP Korea_NNP and_CC South_NNP Korea_NNP ._. The_DT aftermath_NN of_IN World_NNP War_NNP II_NNP left_VBD Korea_NNP partitioned_VBN along_IN the_DT 38th_JJ parallel_NN ,_, with_IN the_DT north_NN under_IN Soviet_JJ occupation_NN and_CC the_DT south_NN under_IN US_NNP occupation_NN supported_VBN by_IN other_JJ allied_JJ states_NNS ._. Consequently_RB ,_, North_NNP Korea_NNP ,_, a_DT Soviet_JJ -_HYPH style_NN socialist_JJ republic_NN was_VBD established_VBN in_IN the_DT north_NN and_CC South_NNP Korea_NNP ;_: a_DT Western_JJ -_HYPH style_NN regime_NN ,_, was_VBD established_VBN in_IN the_DT South_NNP ._. North_NNP Korea_NNP is_VBZ a_DT one_CD -_HYPH party_NN state_NN ,_, now_RB centred_VBN on_IN Kim_NNP Il_NNP -_HYPH sung_NNP 's_POS Juche_NNP ideology_NN ,_, with_IN a_DT centrally_RB planned_VBN industrial_JJ economy_NN ._. South_NNP Korea_NNP is_VBZ a_DT multi-party_JJ state_NN with_IN a_DT capitalist_JJ market_NN economy_NN ,_, alongside_IN membership_NN in_IN the_DT Organisation_NNP for_IN Economic_NNP Co-operation_NNP and_CC Development_NNP and_CC the_DT Group_NNP of_IN Twenty_CD ._. The_DT two_CD states_NNS have_VBP greatly_RB diverged_VBN both_DT culturally_RB and_CC economically_RB since_IN their_PRP$ partition_NN ,_, though_IN they_PRP still_RB share_VBP a_DT common_JJ traditional_JJ culture_NN and_CC pre-Cold_JJ War_NN history_NN ._. Since_IN the_DT 1960s_NNS ,_, the_DT South_JJ Korean_JJ economy_NN has_VBZ grown_VBN enormously_RB and_CC the_DT economic_JJ structure_NN was_VBD radically_RB transformed_VBN ._. In_IN 1957_CD ,_, South_NNP Korea_NNP had_VBD a_DT lower_JJR per_IN capita_NN GDP_NN than_IN Ghana_NNP ,_, [_-LRB- 164_CD ]_-RRB- and_CC by_IN 2008_CD it_PRP was_VBD 17_CD times_NNS as_IN high_JJ as_IN Ghana_NNP 's_POS ._. [_-LRB- a_DT ]_-RRB- According_VBG to_IN R._NNP J._NNP Rummel_NNP ,_, forced_VBN labor_NN ,_, executions_NNS ,_, and_CC concentration_NN camps_NNS were_VBD responsible_JJ for_IN over_IN one_CD million_CD deaths_NNS in_IN North_NNP Korea_NNP from_IN 1948_CD to_IN 1987_CD ;_: [_-LRB- 166_CD ]_-RRB- others_NNS have_VBP estimated_VBN 400,000_CD deaths_NNS in_IN concentration_NN camps_NNS alone_RB ._. [_-LRB- 167_CD ]_-RRB- Estimates_NNS based_VBN on_IN the_DT most_RBS recent_JJ North_JJ Korean_JJ census_NN suggest_VBP that_IN 240,000_CD to_IN 420,000_CD people_NNS died_VBD as_IN a_DT result_NN of_IN the_DT 1990s_CD famine_NN and_CC that_IN there_EX were_VBD 600,000_CD to_IN 850,000_CD unnatural_JJ deaths_NNS in_IN North_NNP Korea_NNP from_IN 1993_CD to_IN 2008_CD ._. [_-LRB- 168_CD ]_-RRB- In_IN South_NNP Korea_NNP ,_, as_IN guerrilla_NN activities_NNS expanded_VBN ,_, the_DT South_JJ Korean_JJ government_NN used_VBD strong_JJ measures_NNS against_IN peasants_NNS ,_, such_JJ as_IN forcefully_RB moving_VBG their_PRP$ families_NNS from_IN guerrilla_NN areas_NNS ._. According_VBG to_IN one_CD estimate_NN ,_, these_DT measures_NNS resulted_VBD in_IN 36,000_CD people_NNS killed_VBD ,_, 11,000_CD people_NNS wounded_VBN ,_, and_CC 432,000_CD people_NNS displaced_VBN ._. [_-LRB- 169_CD ]_-RRB- The_DT Korean_JJ War_NNP broke_VBD out_RP when_WRB Soviet_JJ -_HYPH backed_VBN North_NNP Korea_NNP invaded_VBD South_NNP Korea_NNP ,_, though_IN neither_DT side_NN gained_VBD much_JJ territory_NN as_IN a_DT result_NN ._. The_DT Korean_NNP Peninsula_NNP remained_VBD divided_JJ ,_, the_DT Korean_JJ Demilitarized_NNP Zone_NNP being_VBG the_DT de_FW facto_FW border_NN between_IN the_DT two_CD states_NNS ._. In_IN June_NNP 1950_CD North_NNP Korea_NNP invaded_VBD the_DT South_NNP ,_, using_VBG Soviet_JJ tanks_NNS and_CC weaponry_NN ._. During_IN the_DT Korean_NNP War_NNP (_-LRB- 1950_CD –_SYM 53_CD )_-RRB- more_JJR than_IN 1.2_CD million_CD people_NNS died_VBD and_CC the_DT three_CD years_NNS of_IN fighting_VBG throughout_IN the_DT nation_NN effectively_RB destroyed_VBD most_RBS cities_NNS ._. [_-LRB- 170_CD ]_-RRB- The_DT war_NN ended_VBD in_IN an_DT Armistice_NNP Agreement_NNP at_IN approximately_RB the_DT Military_JJ Demarcation_NN Line_NN ,_, but_CC the_DT two_CD governments_NNS are_VBP officially_RB at_IN war_NN ._. In_IN 2018_CD ,_, the_DT leaders_NNS of_IN North_NNP Korea_NNP and_CC South_NNP Korea_NNP officially_RB signed_VBD the_DT Panmunjom_NNP Declaration_NNP ,_, announcing_VBG that_IN they_PRP will_MD work_VB to_TO end_VB the_DT conflict_NN ._. In_IN November_NNP 2020_CD ,_, South_NNP Korea_NNP and_CC China_NNP agreed_VBD to_TO work_VB together_RB to_TO mend_VB South_NNP Korea_NNP ’s_POS relationship_NN with_IN North_NNP Korea_NNP ._. During_IN a_DT meeting_NN between_IN President_NNP Moon_NNP and_CC China_NNP ’s_POS top_JJ diplomat_NN ,_, Wang_NNP Yi_NNP ,_, Moon_NNP expressed_VBD his_PRP$ gratitude_NN to_IN China_NNP for_IN its_PRP$ role_NN in_IN helping_VBG to_TO foster_VB peace_NN in_IN the_DT Korean_NNP Peninsula_NNP ._. Moon_NNP was_VBD quoted_VBN telling_VBG Wang_NNP during_IN their_PRP$ meeting_NN that_IN “_`` [_-LRB- the_DT South_JJ Korean_JJ ]_-RRB- government_NN will_MD not_RB stop_VB efforts_NNS to_TO put_VB an_DT end_NN (_-LRB- formally_RB )_-RRB- to_IN war_NN on_IN the_DT Korean_NNP Peninsula_NNP and_CC achieve_VB complete_JJ denuclearization_NN and_CC permanent_JJ peace_NN together_RB with_IN the_DT international_JJ community_NN ,_, including_VBG China_NNP ._. ”_'' [_-LRB- 171_CD ]_-RRB- The_DT combined_VBN population_NN of_IN the_DT Koreas_NNPS is_VBZ about_IN 76_CD million_CD (_-LRB- North_NNP Korea_NNP :_: 25_CD million_CD ,_, South_NNP Korea_NNP :_: 51_CD million_CD )_-RRB- ._. Korea_NNP is_VBZ chiefly_RB populated_VBN by_IN a_DT highly_RB homogeneous_JJ ethnic_JJ group_NN ,_, the_DT Koreans_NNPS ,_, who_WP speak_VBP the_DT Korean_JJ language_NN ._. [_-LRB- 172_CD ]_-RRB- The_DT number_NN of_IN foreigners_NNS living_VBG in_IN Korea_NNP has_VBZ also_RB steadily_RB increased_VBN since_IN the_DT late_JJ 20th_JJ century_NN ,_, particularly_RB in_IN South_NNP Korea_NNP ,_, where_WRB more_JJR than_IN 1_CD million_CD foreigners_NNS reside_VBP ._. [_-LRB- 173_CD ]_-RRB- It_PRP was_VBD estimated_VBN in_IN 2006_CD that_WDT only_RB 26,700_CD of_IN the_DT old_JJ Chinese_JJ community_NN now_RB remain_VBP in_IN South_NNP Korea_NNP ._. [_-LRB- 174_CD ]_-RRB- However_RB ,_, in_IN recent_JJ years_NNS ,_, immigration_NN from_IN mainland_NN China_NNP has_VBZ increased_VBN ;_: 624,994_CD persons_NNS of_IN Chinese_JJ nationality_NN have_VBP immigrated_VBN to_IN South_NNP Korea_NNP ,_, including_VBG 443,566_CD of_IN ethnic_JJ Korean_JJ descent_NN ._. [_-LRB- 175_CD ]_-RRB- Small_JJ communities_NNS of_IN ethnic_JJ Chinese_JJ and_CC Japanese_JJ are_VBP also_RB found_VBN in_IN North_NNP Korea_NNP ._. [_-LRB- 176_CD ]_-RRB- Korean_NNP is_VBZ the_DT official_JJ language_NN of_IN both_DT North_NNP and_CC South_NNP Korea_NNP ,_, and_CC (_-LRB- along_IN with_IN Mandarin_NNP )_-RRB- of_IN Yanbian_NNP Korean_NNP Autonomous_NNP Prefecture_NNP in_IN the_DT Manchuria_NNP area_NN of_IN China_NNP ._. Worldwide_NNP ,_, there_EX are_VBP up_RB to_IN 80_CD million_CD speakers_NNS of_IN the_DT Korean_JJ language_NN ._. South_NNP Korea_NNP has_VBZ around_RB 50_CD million_CD speakers_NNS while_IN North_NNP Korea_NNP around_IN 25_CD million_CD ._. Other_JJ large_JJ groups_NNS of_IN Korean_JJ speakers_NNS through_IN Korean_JJ diaspora_NN are_VBP found_VBN in_IN China_NNP ,_, the_DT United_NNP States_NNP ,_, Japan_NNP ,_, former_JJ Soviet_NNP Union_NNP and_CC elsewhere_RB ._. Modern_JJ Korean_JJ is_VBZ written_VBN almost_RB exclusively_RB in_IN the_DT script_NN of_IN the_DT Korean_JJ alphabet_NN (_-LRB- known_VBN as_IN Hangul_NNP in_IN South_NNP Korea_NNP and_CC Chosungul_NNP in_IN China_NNP and_CC North_NNP Korea_NNP )_-RRB- ,_, which_WDT was_VBD invented_VBN in_IN the_DT 15th_JJ century_NN ._. Korean_NNP is_VBZ sometimes_RB written_VBN with_IN the_DT addition_NN of_IN some_DT Chinese_JJ characters_NNS called_VBN Hanja_NNP ;_: however_RB ,_, this_DT is_VBZ only_RB occasionally_RB seen_VBN nowadays_RB ._. In_IN ancient_JJ Chinese_JJ texts_NNS ,_, Korea_NNP is_VBZ referred_VBN to_IN as_IN "_`` Rivers_NNP and_CC Mountains_NNPS Embroidered_VBN on_IN Silk_NNP "_'' (_-LRB- 금수강산_FW ,_, 錦繡江山_NN )_-RRB- and_CC "_`` Eastern_NNP Nation_NNP of_IN Decorum_NNP "_'' (_-LRB- 동방예의지국_NNP ,_, 東方禮儀之國_NN )_-RRB- ._. [_-LRB- 179_CD ]_-RRB- Individuals_NNS are_VBP regarded_VBN as_IN one_CD year_NN old_JJ when_WRB they_PRP are_VBP born_VBN ,_, as_IN Koreans_NNPS reckon_VBP the_DT pregnancy_NN period_NN as_IN one_CD year_NN of_IN life_NN for_IN infants_NNS ,_, and_CC age_NN increments_NNS increase_VBP on_IN New_NNP Year_NNP 's_POS Day_NN rather_RB than_IN on_IN the_DT anniversary_NN of_IN birthdays_NNS ._. Thus_RB ,_, one_CD born_VBN immediately_RB before_IN New_NNP Year_NNP 's_POS Day_NN may_MD only_RB be_VB a_DT few_JJ days_NNS old_JJ in_IN western_JJ reckoning_NN ,_, but_CC two_CD years_NNS old_JJ in_IN Korea_NNP ._. Accordingly_RB ,_, a_DT Korean_JJ person_NN 's_POS stated_JJ age_NN (_-LRB- at_RB least_RBS among_IN fellow_JJ Koreans_NNPS )_-RRB- will_MD be_VB one_CD or_CC two_CD years_NNS more_RBR than_IN their_PRP$ age_NN according_VBG to_IN western_JJ reckoning_NN ._. However_RB ,_, western_JJ reckoning_NN is_VBZ sometimes_RB applied_VBN with_IN regard_NN to_IN the_DT concept_NN of_IN legal_JJ age_NN ;_: for_IN example_NN ,_, the_DT legal_JJ age_NN for_IN purchasing_VBG alcohol_NN or_CC cigarettes_NNS in_IN the_DT Republic_NNP of_IN Korea_NNP is_VBZ 19_CD ,_, which_WDT is_VBZ measured_VBN according_VBG to_IN western_JJ reckoning_NN ._. Korean_JJ literature_NN written_VBN before_IN the_DT end_NN of_IN the_DT Joseon_NNP Dynasty_NNP is_VBZ called_VBN "_`` Classical_JJ "_'' or_CC "_`` Traditional_NNP ._. "_'' Literature_NNP ,_, written_VBN in_IN Chinese_JJ characters_NNS (_-LRB- hanja_NN )_-RRB- ,_, was_VBD established_VBN at_IN the_DT same_JJ time_NN as_IN the_DT Chinese_JJ script_NN arrived_VBD on_IN the_DT peninsula_NN ._. Korean_JJ scholars_NNS were_VBD writing_VBG poetry_NN in_IN the_DT classical_JJ Korean_JJ style_NN as_IN early_JJ as_IN the_DT 2nd_JJ century_NN BCE_NNP ,_, reflecting_VBG Korean_JJ thoughts_NNS and_CC experiences_NNS of_IN that_DT time_NN ._. Classical_JJ Korean_JJ literature_NN has_VBZ its_PRP$ roots_NNS in_IN traditional_JJ folk_NN beliefs_NNS and_CC folk_NN tales_NNS of_IN the_DT peninsula_NN ,_, strongly_RB influenced_VBN by_IN Confucianism_NNP ,_, Buddhism_NNP and_CC Taoism_NNP ._. Modern_JJ literature_NN is_VBZ often_RB linked_VBN with_IN the_DT development_NN of_IN hangul_NN ,_, which_WDT helped_VBD spread_VB literacy_NN from_IN the_DT aristocracy_NN to_IN the_DT common_JJ people_NNS ._. Hangul_NNP ,_, however_RB ,_, only_RB reached_VBD a_DT dominant_JJ position_NN in_IN Korean_JJ literature_NN in_IN the_DT second_JJ half_NN of_IN the_DT 19th_JJ century_NN ,_, resulting_VBG in_IN a_DT major_JJ growth_NN in_IN Korean_JJ literature_NN ._. Sinsoseol_NNP ,_, for_IN instance_NN ,_, are_VBP novels_NNS written_VBN in_IN hangul_NN ._. The_DT Korean_NNP War_NNP led_VBD to_IN the_DT development_NN of_IN literature_NN centered_VBN on_IN the_DT wounds_NNS and_CC chaos_NN of_IN war_NN ._. Much_JJ of_IN the_DT post-war_JJ literature_NN in_IN South_NNP Korea_NNP deals_NNS with_IN the_DT daily_JJ lives_NNS of_IN ordinary_JJ people_NNS ,_, and_CC their_PRP$ struggles_NNS with_IN national_JJ pain_NN ._. The_DT collapse_NN of_IN the_DT traditional_JJ Korean_JJ value_NN system_NN is_VBZ another_DT common_JJ theme_NN of_IN the_DT time_NN ._. Traditional_JJ Korean_JJ music_NN includes_VBZ combinations_NNS of_IN the_DT folk_NN ,_, vocal_NN ,_, religious_JJ and_CC ritual_NN music_NN styles_NNS of_IN the_DT Korean_JJ people_NNS ._. Korean_JJ music_NN has_VBZ been_VBN practiced_VBN since_IN prehistoric_JJ times_NNS ._. [_-LRB- 180_CD ]_-RRB- Korean_JJ music_NN falls_VBZ into_IN two_CD broad_JJ categories_NNS ._. The_DT first_JJ ,_, Hyangak_NNP ,_, literally_RB means_VBZ The_DT local_JJ music_NN or_CC Music_NN native_JJ to_IN Korea_NNP ,_, a_DT famous_JJ example_NN of_IN which_WDT is_VBZ Sujechon_NNP ,_, a_DT piece_NN of_IN instrumental_JJ music_NN often_RB claimed_VBD to_TO be_VB at_RB least_RBS 1,300_CD years_NNS old_JJ ._. [_-LRB- 181_CD ]_-RRB- The_DT second_JJ ,_, yangak_NN ,_, represents_VBZ a_DT more_RBR Western_JJ style_NN ._. Confucian_JJ tradition_NN has_VBZ dominated_VBN Korean_JJ thought_NN ,_, along_IN with_IN contributions_NNS by_IN Buddhism_NNP ,_, Taoism_NNP ,_, and_CC Korean_JJ Shamanism_NNP ._. Since_IN the_DT middle_NN of_IN the_DT 20th_JJ century_NN ,_, however_RB ,_, Christianity_NNP has_VBZ competed_VBN with_IN Buddhism_NNP in_IN South_NNP Korea_NNP ,_, while_IN religious_JJ practice_NN has_VBZ been_VBN suppressed_VBN in_IN North_NNP Korea_NNP ._. Throughout_IN Korean_JJ history_NN and_CC culture_NN ,_, regardless_RB of_IN separation_NN ;_: the_DT influence_NN of_IN traditional_JJ beliefs_NNS of_IN Korean_JJ Shamanism_NNP ,_, Mahayana_NNP Buddhism_NNP ,_, Confucianism_NNP and_CC Taoism_NNP have_VBP remained_VBN an_DT underlying_JJ religion_NN of_IN the_DT Korean_JJ people_NNS as_RB well_RB as_IN a_DT vital_JJ aspect_NN of_IN their_PRP$ culture_NN ;_: all_PDT these_DT traditions_NNS have_VBP coexisted_VBN peacefully_RB for_IN hundreds_NNS of_IN years_NNS up_IN to_IN today_NN despite_IN strong_JJ Westernisation_NNP from_IN Christian_NNP missionary_JJ conversions_NNS in_IN the_DT South_NNP [_-LRB- 182_CD ]_-RRB- [_-LRB- 183_CD ]_-RRB- [_-LRB- 184_CD ]_-RRB- or_CC the_DT pressure_NN from_IN the_DT Juche_NNP government_NN in_IN the_DT North_NNP ._. [_-LRB- 185_CD ]_-RRB- [_-LRB- 186_CD ]_-RRB- According_VBG to_IN 2005_CD statistics_NNS compiled_VBN by_IN the_DT South_JJ Korean_JJ government_NN ,_, about_IN 46_CD %_NN of_IN citizens_NNS profess_VBP to_TO follow_VB no_DT particular_JJ religion_NN ._. Christians_NNPS account_VBP for_IN 29.2_CD %_NN of_IN the_DT population_NN (_-LRB- of_IN which_WDT are_VBP Protestants_NNPS 18.3_CD %_NN and_CC Catholics_NNPS 10.9_CD %_NN )_-RRB- and_CC Buddhists_NNPS 22.8_CD %_NN ._. [_-LRB- 187_CD ]_-RRB- Islam_NNP in_IN South_NNP Korea_NNP is_VBZ practiced_VBN by_IN about_RB 45,000_CD natives_NNS (_-LRB- about_IN 0.09_CD %_NN of_IN the_DT population_NN )_-RRB- in_IN addition_NN to_IN some_DT 100,000_CD foreign_JJ workers_NNS from_IN Muslim_JJ countries_NNS ._. [_-LRB- 188_CD ]_-RRB- Koreans_NNPS traditionally_RB believe_VBP that_IN the_DT taste_NN and_CC quality_NN of_IN food_NN depend_VBP on_IN its_PRP$ spices_NNS and_CC sauces_NNS ,_, the_DT essential_JJ ingredients_NNS to_IN making_VBG a_DT delicious_JJ meal_NN ._. Therefore_RB ,_, soybean_NN paste_NN ,_, soy_NN sauce_NN ,_, gochujang_NN or_CC red_JJ pepper_NN paste_NN and_CC kimchi_NN are_VBP some_DT of_IN the_DT most_RBS important_JJ staples_NNS in_IN a_DT Korean_JJ household_NN ._. Korean_JJ cuisine_NN was_VBD greatly_RB influenced_VBN by_IN the_DT geography_NN and_CC climate_NN of_IN the_DT Korean_NNP Peninsula_NNP ,_, which_WDT is_VBZ known_VBN for_IN its_PRP$ cold_JJ autumns_NNS and_CC winters_NNS ,_, therefore_RB there_EX are_VBP many_JJ fermented_JJ dishes_NNS and_CC hot_JJ soups_NNS and_CC stews_NNS ._. Korean_JJ cuisine_NN is_VBZ probably_RB best_RBS known_VBN for_IN kimchi_NN ,_, a_DT side_NN dish_NN which_WDT uses_VBZ a_DT distinctive_JJ fermentation_NN process_NN of_IN preserving_VBG vegetables_NNS ,_, most_JJS commonly_RB cabbage_NN ._. Kimchi_NNP is_VBZ said_VBN to_TO relieve_VB the_DT pores_NNS on_IN the_DT skin_NN ,_, thereby_RB reducing_VBG wrinkles_NNS and_CC providing_VBG nutrients_NNS to_IN the_DT skin_NN naturally_RB ._. It_PRP is_VBZ also_RB healthy_JJ ,_, as_IN it_PRP provides_VBZ necessary_JJ vitamins_NNS and_CC nutrients_NNS ._. Gochujang_NNP ,_, a_DT traditional_JJ Korean_JJ sauce_NN made_VBN of_IN red_JJ pepper_NN is_VBZ also_RB commonly_RB used_VBN ,_, often_RB as_IN pepper_NN (_-LRB- chilli_NN )_-RRB- paste_NN ,_, earning_VBG the_DT cuisine_NN a_DT reputation_NN for_IN spiciness_NN ._. Bulgogi_NNP (_-LRB- roasted_VBN marinated_VBN meat_NN ,_, usually_RB beef_NN )_-RRB- ,_, galbi_NN (_-LRB- marinated_VBN grilled_VBN short_JJ ribs_NNS )_-RRB- ,_, and_CC samgyeopsal_NN (_-LRB- pork_NN belly_NN )_-RRB- are_VBP popular_JJ meat_NN entrees_NNS ._. Fish_NNP is_VBZ also_RB a_DT popular_JJ commodity_NN ,_, as_IN it_PRP is_VBZ the_DT traditional_JJ meat_NN that_WDT Koreans_NNPS eat_VBP ._. Meals_NNS are_VBP usually_RB accompanied_VBN by_IN a_DT soup_NN or_CC stew_NN ,_, such_JJ as_IN galbitang_NN (_-LRB- stewed_VBN ribs_NNS )_-RRB- or_CC doenjang_NN jjigae_NNS (_-LRB- fermented_VBN bean_NN paste_NN soup_NN )_-RRB- ._. The_DT center_NN of_IN the_DT table_NN is_VBZ filled_VBN with_IN a_DT shared_VBN collection_NN of_IN sidedishes_NNS called_VBN banchan_NN ._. Other_JJ popular_JJ dishes_NNS include_VBP bibimbap_NN ,_, which_WDT literally_RB means_VBZ "_`` mixed_JJ rice_NN "_'' (_-LRB- rice_NN mixed_VBN with_IN meat_NN ,_, vegetables_NNS ,_, and_CC red_JJ pepper_NN paste_NN )_-RRB- ,_, and_CC naengmyeon_NN (_-LRB- cold_JJ noodles_NNS )_-RRB- ._. [_-LRB- 189_CD ]_-RRB- [_-LRB- 190_CD ]_-RRB- Instant_JJ noodles_NNS ,_, or_CC ramyeon_NN ,_, is_VBZ a_DT popular_JJ snack_NN food_NN ._. Koreans_NNPS also_RB enjoy_VBP food_NN from_IN pojangmachas_NNS (_-LRB- street_NN vendors_NNS )_-RRB- ,_, which_WDT serve_VBP tteokbokki_NN ,_, rice_NN cake_NN and_CC fish_NN cake_NN with_IN a_DT spicy_JJ gochujang_NN sauce_NN ;_: gimbap_NN ,_, made_VBN of_IN steamed_JJ white_JJ rice_NN wrapped_VBN in_IN dried_VBN laver_NN seaweed_NN ;_: fried_JJ squid_NNS ;_: and_CC glazed_VBN sweet_JJ potato_NN ._. Soondae_NNP ,_, a_DT sausage_NN made_VBN of_IN cellophane_NN noodles_NNS and_CC pork_NN blood_NN ,_, is_VBZ widely_RB eaten_VBN ._. Additionally_RB ,_, some_DT other_JJ common_JJ snacks_NNS include_VBP "_`` Choco_NNP Pie_NNP "_'' ,_, shrimp_NN crackers_NNS ,_, "_'' bbeongtwigi_NN "_'' (_-LRB- puffed_VBN rice_NN grains_NNS )_-RRB- ,_, and_CC "_`` nurungji_FW "_'' (_-LRB- slightly_RB burnt_VBN rice_NN )_-RRB- ._. Nurungji_NNP can_MD be_VB eaten_VBN as_IN it_PRP is_VBZ or_CC boiled_VBN with_IN water_NN to_TO make_VB a_DT soup_NN ._. Nurungji_NNP can_MD also_RB be_VB eaten_VBN as_IN a_DT snack_NN or_CC a_DT dessert_NN ._. Korea_NNP is_VBZ unique_JJ among_IN Asian_JJ countries_NNS in_IN its_PRP$ use_NN of_IN metal_NN chopsticks_NNS ._. Metal_NN chopsticks_NNS have_VBP been_VBN discovered_VBN in_IN archaeological_JJ sites_NNS belonging_VBG to_IN the_DT ancient_JJ Korean_JJ kingdoms_NNS of_IN Goguryeo_NNP ,_, Baekje_NNP and_CC Silla_NNP ._. The_DT modern_JJ South_JJ Korean_JJ school_NN system_NN consists_VBZ of_IN six_CD years_NNS in_IN elementary_JJ school_NN ,_, three_CD years_NNS in_IN middle_JJ school_NN ,_, and_CC three_CD years_NNS in_IN high_JJ school_NN ._. Students_NNS are_VBP required_VBN to_TO go_VB to_IN elementary_JJ and_CC middle_JJ school_NN ,_, and_CC do_VBP not_RB have_VB to_TO pay_VB for_IN their_PRP$ education_NN ,_, except_IN for_IN a_DT small_JJ fee_NN called_VBD a_DT "_`` School_NNP Operation_NNP Support_NNP Fee_NN "_'' that_WDT differs_VBZ from_IN school_NN to_IN school_NN ._. The_DT Programme_NNP for_IN International_NNP Student_NNP Assessment_NNP ,_, coordinated_VBN by_IN the_DT OECD_NNP ,_, ranks_VBZ South_NNP Korea_NNP 's_POS science_NN education_NN as_IN the_DT third_JJ best_JJS in_IN the_DT world_NN and_CC being_VBG significantly_RB higher_JJR than_IN the_DT OECD_NNP average_NN ._. [_-LRB- 191_CD ]_-RRB- South_NNP Korea_NNP ranks_VBZ second_RB on_IN math_NN and_CC literature_NN and_CC first_JJ in_IN problem_NN solving_NN [_-LRB- citation_NN needed_VBN ]_-RRB- ._. Although_IN South_JJ Korean_JJ students_NNS often_RB rank_VBP high_JJ on_IN international_JJ comparative_JJ assessments_NNS ,_, the_DT education_NN system_NN is_VBZ criticised_VBN for_IN emphasising_VBG too_RB much_JJ upon_IN passive_JJ learning_NN and_CC memorization_NN ._. The_DT South_JJ Korean_JJ education_NN system_NN is_VBZ rather_RB notably_RB strict_JJ and_CC structured_JJ as_IN compared_VBN to_IN its_PRP$ counterparts_NNS in_IN most_JJS Western_JJ societies_NNS ._. The_DT North_JJ Korean_JJ education_NN system_NN consists_VBZ primarily_RB of_IN universal_JJ and_CC state_NN funded_VBN schooling_NN by_IN the_DT government_NN ._. The_DT national_JJ literacy_NN rate_NN for_IN citizens_NNS 15_CD years_NNS of_IN age_NN and_CC above_RB is_VBZ over_IN 99_CD percent_NN ._. [_-LRB- 192_CD ]_-RRB- [_-LRB- 193_CD ]_-RRB- Children_NNS go_VBP through_IN one_CD year_NN of_IN kindergarten_NN ,_, four_CD years_NNS of_IN primary_JJ education_NN ,_, six_CD years_NNS of_IN secondary_JJ education_NN ,_, and_CC then_RB on_IN to_IN universities_NNS ._. The_DT most_RBS prestigious_JJ university_NN in_IN the_DT DPRK_NNP is_VBZ Kim_NNP Il_NNP -_HYPH sung_NNP University_NNP ._. Other_JJ notable_JJ universities_NNS include_VBP Kim_NNP Chaek_NNP University_NNP of_IN Technology_NNP ,_, which_WDT focuses_VBZ on_IN computer_NN science_NN ,_, Pyongyang_NNP University_NNP of_IN Foreign_NNP Studies_NNPS ,_, which_WDT trains_VBZ working_VBG level_NN diplomats_NNS and_CC trade_NN officials_NNS ,_, and_CC Kim_NNP Hyong_NNP Jik_NNP University_NNP ,_, which_WDT trains_VBZ teachers_NNS ._. One_CD of_IN the_DT best_JJS known_VBN artifacts_NNS of_IN Korea_NNP 's_POS history_NN of_IN science_NN and_CC technology_NN is_VBZ the_DT Cheomseongdae_NNP (_-LRB- 첨성대_NNP ,_, 瞻星臺_NN )_-RRB- ,_, a_DT 9.4_CD -_HYPH meter_NN high_JJ observatory_NN built_VBN in_IN 634_CD ._. The_DT earliest_JJS known_VBN surviving_VBG Korean_JJ example_NN of_IN woodblock_NN printing_NN is_VBZ the_DT Mugujeonggwang_NNP Great_NNP Dharani_NNP Sutra_NN ._. [_-LRB- 194_CD ]_-RRB- It_PRP is_VBZ believed_VBN to_TO have_VB been_VBN printed_VBN in_IN Korea_NNP in_IN 750_CD –_SYM 51_CD ,_, which_WDT if_IN correct_JJ ,_, would_MD make_VB it_PRP older_JJR than_IN the_DT Diamond_NNP Sutra_NN ._. During_IN the_DT Goryeo_NNP Dynasty_NNP ,_, metal_NN movable_JJ type_NN printing_NN was_VBD invented_VBN by_IN Choe_NNP Yun_NNP -_HYPH ui_NNP in_IN 1234_CD ._. [_-LRB- 195_CD ]_-RRB- [_-LRB- 5_CD ]_-RRB- [_-LRB- 196_CD ]_-RRB- [_-LRB- 197_CD ]_-RRB- [_-LRB- 8_CD ]_-RRB- [_-LRB- 3_CD ]_-RRB- This_DT invention_NN made_VBN printing_NN easier_JJR ,_, more_RBR efficient_JJ and_CC also_RB increased_VBD literacy_NN ,_, which_WDT observed_VBN by_IN Chinese_JJ visitors_NNS was_VBD seen_VBN to_TO be_VB so_RB important_JJ where_WRB it_PRP was_VBD considered_VBN to_TO be_VB shameful_JJ to_TO not_RB be_VB able_JJ to_TO read_VB ._. [_-LRB- 198_CD ]_-RRB- The_DT Mongol_NNP Empire_NNP later_RB adopted_VBD Korea_NNP 's_POS movable_JJ type_NN printing_NN and_CC spread_NN as_RB far_RB as_IN Central_NNP Asia_NNP ._. There_EX is_VBZ conjecture_NN as_IN to_IN whether_IN or_CC not_RB Choe_NNP 's_POS invention_NN had_VBD any_DT influence_NN on_IN later_JJ printing_NN inventions_NNS such_JJ as_IN Gutenberg_NNP 's_POS Printing_NNP press_NN ._. [_-LRB- 199_CD ]_-RRB- When_WRB the_DT Mongols_NNPS invaded_VBD Europe_NNP they_PRP inadvertently_RB introduced_VBD different_JJ kinds_NNS of_IN Asian_JJ technology_NN ._. [_-LRB- 200_CD ]_-RRB- During_IN the_DT Joseon_NNP period_NN ,_, the_DT Turtle_NNP Ship_NNP was_VBD invented_VBN ,_, which_WDT were_VBD covered_VBN by_IN a_DT wooden_JJ deck_NN and_CC iron_NN with_IN thorns_NNS ,_, [_-LRB- 201_CD ]_-RRB- [_-LRB- 202_CD ]_-RRB- [_-LRB- 203_CD ]_-RRB- as_RB well_RB as_IN other_JJ weapons_NNS such_JJ as_IN the_DT bigyeokjincheolloe_NN cannon_NN (_-LRB- 비격진천뢰_NN ,_, 飛擊震天雷_NN )_-RRB- and_CC the_DT hwacha_NN ._. The_DT Korean_JJ alphabet_NN hangul_NN was_VBD also_RB invented_VBN during_IN this_DT time_NN by_IN King_NNP Sejong_NNP the_DT Great_NNP ._. North_NNP Korea_NNP and_CC South_NNP Korea_NNP usually_RB compete_VBP as_IN two_CD separate_JJ nations_NNS in_IN international_JJ events_NNS ._. There_EX are_VBP ,_, however_RB ,_, a_DT few_JJ examples_NNS of_IN them_PRP having_VBG competed_VBN as_IN one_CD entity_NN ,_, under_IN the_DT name_NN Korea_NNP ._. While_IN association_NN football_NN remains_VBZ one_CD of_IN the_DT most_RBS popular_JJ sports_NNS in_IN South_NNP Korea_NNP ,_, the_DT martial_JJ art_NN of_IN taekwondo_NN is_VBZ considered_VBN to_TO be_VB the_DT national_JJ sport_NN ._. Baseball_NN and_CC golf_NN are_VBP also_RB popular_JJ ._. Taekwon_NNP -_HYPH Do_NNP is_VBZ Korea_NNP 's_POS most_RBS famous_JJ martial_JJ art_NN and_CC sport_NN ._. It_PRP combines_VBZ combat_NN techniques_NNS ,_, self_NN -_HYPH defence_NN ,_, sport_NN and_CC exercise_NN ._. Taekwon_NNP -_HYPH Do_NNP has_VBZ become_VBN an_DT official_JJ Olympic_JJ sport_NN ,_, starting_VBG as_IN a_DT demonstration_NN event_NN in_IN 1988_CD (_-LRB- when_WRB South_NNP Korea_NNP hosted_VBD the_DT Games_NNPS in_IN Seoul_NNP )_-RRB- and_CC becoming_VBG an_DT official_JJ medal_NN event_NN in_IN 2000_CD ._. The_DT two_CD major_JJ Taekwon_NNP -_HYPH Do_NNP federations_NNS were_VBD founded_VBN in_IN Korea_NNP ._. The_DT two_CD are_VBP the_DT International_NNP Taekwon_NNP -_HYPH Do_NNP Federation_NNP and_CC the_DT World_NNP Taekwondo_NNP Federation_NNP ._. Hapkido_NNP is_VBZ a_DT modern_JJ Korean_JJ martial_JJ art_NN with_IN a_DT grappling_VBG focus_NN that_WDT employs_VBZ joint_JJ locks_NNS ,_, throws_VBZ ,_, kicks_VBZ ,_, punches_NNS and_CC other_JJ striking_JJ attacks_NNS like_IN attacks_NNS against_IN pressure_NN points_NNS ._. Hapkido_NNP emphasizes_VBZ circular_JJ motion_NN ,_, non-resisting_JJ movements_NNS and_CC control_NN of_IN the_DT opponent_NN ._. Practitioners_NNS seek_VBP to_TO gain_VB advantage_NN through_IN footwork_NN and_CC body_NN positioning_NN to_TO employ_VB leverage_NN ,_, avoiding_VBG the_DT pure_JJ use_NN of_IN strength_NN against_IN strength_NN ._. Ssireum_NNP is_VBZ a_DT traditional_JJ form_NN of_IN wrestling_NN that_WDT has_VBZ been_VBN practiced_VBN in_IN Korea_NNP for_IN thousands_NNS of_IN years_NNS ,_, with_IN evidence_NN discovered_VBN from_IN Goguryeo_NNP of_IN Korea_NNP 's_POS Three_CD Kingdoms_NNS Period_NN (_-LRB- 57_CD BCE_NNP to_TO 688_CD )_-RRB- ._. Ssireum_NNP is_VBZ the_DT traditional_JJ national_JJ sport_NN of_IN Korea_NNP ._. During_IN a_DT match_NN ,_, opponents_NNS grip_NN each_DT other_JJ by_IN sash_NN belts_NNS wrapped_VBN around_IN the_DT waist_NN and_CC the_DT thigh_NN ,_, attempting_VBG to_TO throw_VB their_PRP$ competitor_NN to_IN the_DT sandy_JJ ground_NN of_IN the_DT ring_NN ._. The_DT first_JJ opponent_NN to_TO touch_VB the_DT ground_NN with_IN any_DT body_NN part_NN above_IN the_DT knee_NN or_CC to_TO lose_VB hold_NN of_IN their_PRP$ opponent_NN loses_VBZ the_DT round_NN ._. Ssireum_NNP competitions_NNS are_VBP traditionally_RB held_VBN twice_PDT a_DT year_NN ,_, during_IN the_DT Dano_NNP Festival_NNP (_-LRB- the_DT 5th_JJ day_NN of_IN the_DT fifth_JJ lunar_JJ month_NN )_-RRB- and_CC Chuseok_NNP (_-LRB- the_DT 15th_JJ day_NN of_IN the_DT 8th_JJ lunar_JJ month_NN )_-RRB- ._. Competitions_NNS are_VBP also_RB held_VBN throughout_IN the_DT year_NN as_IN a_DT part_NN of_IN festivals_NNS and_CC other_JJ events_NNS ._. Taekkyon_NNP is_VBZ a_DT traditional_JJ martial_JJ art_NN ,_, considered_VBD the_DT oldest_JJS form_NN of_IN fighting_VBG technique_NN of_IN Korea_NNP ._. Practiced_VBN for_IN centuries_NNS and_CC especially_RB popular_JJ during_IN the_DT Joseon_NNP dynasty_NN ,_, two_CD forms_NNS co-existed_VBD :_: one_CD for_IN practical_JJ use_NN ,_, the_DT other_JJ for_IN sport_NN ._. This_DT form_NN was_VBD usually_RB practiced_VBN alongside_IN Ssireum_NNP during_IN festivals_NNS and_CC competitions_NNS between_IN villages_NNS ._. Nonetheless_RB ,_, Taekkyon_NNP almost_RB disappeared_VBD during_IN the_DT Japanese_JJ Occupation_NNP and_CC the_DT Korean_NNP War_NNP ._. Though_IN lost_VBN in_IN North_NNP Korea_NNP ,_, Taekkyon_NNP has_VBZ enjoyed_VBN a_DT spectacular_JJ revival_NN from_IN the_DT 1980s_NNS in_IN South_NNP Korea_NNP ._. It_PRP is_VBZ the_DT only_JJ martial_JJ art_NN in_IN the_DT world_NN (_-LRB- with_IN Ssireum_NNP )_-RRB- recognized_VBN as_IN a_DT National_NNP Treasure_NNP of_IN South_NNP Korea_NNP and_CC a_DT UNESCO_NNP Intangible_NNP Cultural_NNP Heritage_NNP ._. Samiljeol_NNP ,_, Independence_NNP Movement_NNP Day_NNP ,_, commemorates_VBZ Korea_NNP 's_POS declaration_NN of_IN independence_NN from_IN Japanese_JJ occupation_NN on_IN 1_CD March_NNP 1919_CD ._. The_DT name_NN is_VBZ derived_VBN from_IN Korean_JJ 삼_NN "_'' sam_NN "_'' '_`` three_CD '_'' ,_, 일_IN "_`` il_NNP "_'' '_`` one_CD ,_, '_'' and_CC 절_NN "_'' jeol_NN "_'' '_`` day_NN '_'' ,_, the_DT date_NN of_IN the_DT uprising_NN in_IN 1919_CD ._. Korea_NNP was_VBD annexed_VBN to_IN the_DT Empire_NN of_IN Japan_NNP on_IN 29_CD August_NNP 1910_CD following_VBG the_DT imposed_VBN Japan_NNP -_HYPH Korea_NNP Treaty_NNP ._. On_IN 1_CD March_NNP 1919_CD ,_, Korean_NNP presented_VBD their_PRP$ resistance_NN towards_IN Japan_NNP and_CC Japanese_JJ occupation_NN with_IN a_DT declaration_NN of_IN independence_NN ._. Following_VBG the_DT conclusion_NN of_IN World_NNP War_NNP II_NNP ,_, Korea_NNP was_VBD liberated_VBN from_IN Japan_NNP and_CC its_PRP$ independence_NN restored_VBN ._. The_DT newly_RB established_VBN Korean_JJ government_NN set_VBD aside_RB 1_CD March_NNP as_IN a_DT national_JJ holiday_NN to_TO commemorate_VB the_DT sacrifices_NNS borne_VBN in_IN the_DT long_JJ struggle_NN for_IN Korean_JJ independence_NN ._. Hyunchoongil_NNP is_VBZ the_DT national_JJ holiday_NN in_IN Korea_NNP commemorating_VBG those_DT who_WP fought_VBD and_CC died_VBD for_IN the_DT nation_NN ._. In_IN August_NNP 1948_CD ,_, only_RB a_DT few_JJ years_NNS after_IN Korea_NNP achieved_VBD its_PRP$ independence_NN from_IN Japan_NNP ,_, the_DT Korean_NNP War_NNP ,_, in_IN Korea_NNP also_RB known_VBN as_IN the_DT 6.25_CD war_NN ,_, broke_VBD out_RP between_IN North_NNP and_CC South_NNP Korea_NNP ._. During_IN this_DT war_NN ,_, approximately_RB 400,000_CD soldiers_NNS and_CC some_DT one_CD million_CD citizens_NNS were_VBD killed_VBN or_CC injured_VBN ._. In_IN 1953_CD ,_, North_NNP and_CC South_NNP Korea_NNP agreed_VBD to_IN a_DT cease_NN -_HYPH fire_NN ,_, and_CC three_CD years_NNS later_RB the_DT Korean_JJ government_NN established_VBD Hyungchoogil_NNP to_TO commemorate_VB the_DT soldiers_NNS who_WP fought_VBD in_IN the_DT Korean_NNP War_NNP ._. Subsequent_JJ to_IN its_PRP$ establishment_NN ,_, Hyungchoogil_NNP was_VBD reinterpreted_VBN as_IN a_DT day_NN of_IN remembrance_NN for_IN those_DT who_WP died_VBD defending_VBG Korea_NNP in_IN all_DT conflicts_NNS ,_, not_RB only_RB during_IN the_DT Korean_NNP War_NNP ._. Gwangbokjeol_NNP is_VBZ the_DT day_NN for_IN celebrating_VBG liberation_NN of_IN the_DT country_NN from_IN Japan_NNP in_IN 1945_CD as_RB well_RB as_IN celebrating_VBG the_DT establishment_NN of_IN Korean_JJ government_NN in_IN 1948_CD ._. Gwangbok_NNP means_VBZ "_`` returned_VBN light_NN "_'' representing_VBG gaining_VBG national_JJ sovereignty_NN from_IN Japan_NNP ._. It_PRP was_VBD first_RB declared_VBN to_TO be_VB national_JJ holiday_NN in_IN 1949_CD October_NNP 1_CD ._. On_IN this_DT date_NN every_DT year_NN ,_, the_DT president_NN of_IN Korea_NNP visits_NNS Independence_NNP Hall_NNP ,_, and_CC invites_VBZ diplomatic_JJ envoys_NNS from_IN many_JJ countries_NNS and_CC all_DT social_JJ standings_NNS in_IN countries_NNS to_IN Cheongwadae_NNP (_-LRB- the_DT Blue_NNP House_NNP ,_, the_DT Korean_JJ presidential_JJ residence_NN )_-RRB- ._. Hangul_NNP Day_NNP (_-LRB- also_RB spelled_VBN as_IN Hangeul_NNP Day_NNP )_-RRB- is_VBZ a_DT day_NN that_WDT celebrates_VBZ the_DT creation_NN of_IN the_DT Hunminjeongeum_NNP (_-LRB- Hangul_NNP ,_, Korean_JJ alphabet_NN )_-RRB- ,_, which_WDT was_VBD inscribed_VBN to_IN the_DT UNESCO_NNP Memory_NN of_IN the_DT World_NNP Register_NNP in_IN 1997_CD ._. [_-LRB- 204_CD ]_-RRB- Hangul_NNP was_VBD created_VBN by_IN Sejong_NNP the_DT Great_NNP in_IN 1443_CD and_CC proclaimed_VBN in_IN 1446_CD ._. Before_IN the_DT creation_NN of_IN Hangul_NNP ,_, people_NNS in_IN Korea_NNP (_-LRB- known_VBN as_IN Joseon_NNP at_IN the_DT time_NN )_-RRB- primarily_RB wrote_VBD using_VBG Classical_JJ Chinese_JJ alongside_IN native_JJ phonetic_JJ writing_NN systems_NNS that_WDT predate_VBP Hangul_NNP by_IN hundreds_NNS of_IN years_NNS ,_, including_VBG idu_NN ,_, hyangchal_NN ,_, gugyeol_NN ,_, and_CC gakpil_NN ._. [_-LRB- 205_CD ]_-RRB- [_-LRB- 206_CD ]_-RRB- [_-LRB- 207_CD ]_-RRB- [_-LRB- 208_CD ]_-RRB- However_RB ,_, due_IN to_IN the_DT fundamental_JJ differences_NNS between_IN the_DT Korean_JJ and_CC Chinese_JJ languages_NNS ,_, and_CC the_DT large_JJ number_NN of_IN characters_NNS needed_VBN to_TO be_VB learned_VBN ,_, there_EX was_VBD much_JJ difficulty_NN in_IN learning_VBG how_WRB to_TO write_VB using_VBG Chinese_JJ characters_NNS for_IN the_DT lower_JJR classes_NNS ,_, who_WP often_RB did_VBD n't_RB have_VB the_DT privilege_NN of_IN education_NN ._. To_TO assuage_VB this_DT problem_NN ,_, King_NNP Sejong_NNP created_VBD the_DT unique_JJ alphabet_NN known_VBN as_IN Hangul_NNP to_TO promote_VB literacy_NN among_IN the_DT common_JJ people_NNS ._. [_-LRB- 209_CD ]_-RRB- Hangul_NNP Day_NNP was_VBD founded_VBN in_IN 1926_CD during_IN the_DT Japanese_JJ occupation_NN by_IN members_NNS of_IN the_DT Korean_JJ Language_NNP Society_NNP ,_, whose_WP$ goal_NN was_VBD to_TO preserve_VB the_DT Korean_JJ language_NN during_IN a_DT time_NN of_IN rapid_JJ forced_VBN Japanization_NN ._. [_-LRB- 210_CD ]_-RRB- Today_NN ,_, both_CC South_NNP Korea_NNP and_CC North_NNP Korea_NNP celebrate_VB Hangul_NNP Day_NNP as_IN a_DT national_JJ holiday_NN ._. Sources_NNS Coordinates_NNS :_: 38_CD °_NN 19_CD ′_SYM N_NN 127_NN °_NN 14_CD ′_SYM E_NN /_SYM 38.317_CD °_NN N_NN 127.233_CD °_NN E_NN /_HYPH 38.317_CD ;_: 127.233_CD
```
---
## 핵심고유단어 추출작업
tagged를 띄어쓰기로 split하여 배열을 만들고
NNP를 따로 분류한 nnp리스트를 만든뒤
Hashtable로 각 단어의 빈도수를 측정함
```java
String[] taggedArr = tagged.split(" ");
List<String> nnp = Arrays.stream(taggedArr).filter(word -> word.contains("_NNP")).collect(Collectors.toList());
Hashtable<String,Integer> freqOfWordTable = new Hashtable<>();
for (String word : nnp) {
Integer freq = freqOfWordTable.get(word); // 단어를 꺼낸다. word가 key이고 freq가 value
freqOfWordTable.put(word, (freq == null) ? 1: freq +1);
}
```
### 결과
![image](https://user-images.githubusercontent.com/55576129/115530663-f0b09880-a2ce-11eb-8ac0-702d8088cbd7.png)
Hashtable을 빈도수로 정렬하고 핵심 고유명사를 뽑아냄
```java
List sortedList = sortByValue(freqOfWordTable);
String coreNoun = sortedList.get(0).toString();
System.out.println(coreNoun); // 결과 : Korea_NNP
```
```java
// 맵정렬하는 메소드
public static List sortByValue(final Map map) {
List<String> list = new ArrayList();
list.addAll(map.keySet());
Collections.sort(list,new Comparator() {
public int compare(Object o1,Object o2) {
Object v1 = map.get(o1);
Object v2 = map.get(o2);
return ((Comparable) v2).compareTo(v1);
}
});
//Collections.reverse(list); // 주석시 오름차순
return list;
}
```
---
## 트리플 추출 과정
"._."로 끊어서( .은 태그가 .임 ) sentences로 나눔
나눈 문장에 핵심 고유명사가 포함되있는지 여부를 판단함
있으면 단어별로 나눠서 핵심명사는 subject에
핵심명사 뒤에 나오는 동사는 predicate에
그 뒤에 나오는 고유명사는 object에 넣음(논문의 알고리즘 참고)
세개를 묶어 tripple을 구성하고 tripples라는 리스트에 넣음
```java
String[] sentences = tagged.split("\\._\\.");
List<String[]> tripples = new ArrayList<>();
for (String sentence : sentences){
if (sentence.contains(coreNoun)) { //핵심 고유명사 여부
String[] words = sentence.split(" ");
String subject = "";
String predicate = "";
String object = "";
for (String word:words) {
if(word.equals(coreNoun)) {
String[] removeTag = word.split("_");
subject = removeTag[0];
}else if(word.contains("_VB") && !subject.isEmpty()) {
String[] removeTag = word.split("_");
predicate = removeTag[0];
}else if(word.contains("_NNP") && !predicate.isEmpty()) {
String[] removeTag = word.split("_");
object = removeTag[0];
}
if(!subject.isEmpty() && !predicate.isEmpty() && !object.isEmpty()){
String[] tripple = {subject,predicate,object};
tripples.add(tripple);
}
}
}
}
System.out.println(tripples);
```
### 결과
![image](https://user-images.githubusercontent.com/55576129/115531004-3ff6c900-a2cf-11eb-9d03-3f620c3d998f.png)
---
### Jena를 이용한 RDF 추출과정
Jena다운 받고 [https://jena.apache.org/](https://jena.apache.org/)
File-Project Structure-Libraries에 lib 랑 lib-src 전부 추가
빈 모델 만들고 Resource, Property, RDFNode에 각각 subject, predicate, object 매핑해줌
자세한건 Jena reference 참고
```java
Model model = ModelFactory.createDefaultModel();
for(String[] statement : tripples){
Resource s = model.createResource("http://subject/"+statement[0]);
Property p = model.createProperty("http://predicate/"+statement[1]);
RDFNode o = model.createLiteral(statement[2]);
if(s.hasProperty(p)){
s.addProperty(p,model.createResource().addProperty(p,o));
}else {
s.addProperty(p,o);
}
}
```
### RDF 출력
```java
model.write(System.out);
```
![image](https://user-images.githubusercontent.com/55576129/115543106-f9f43200-a2db-11eb-8042-92472ac8c645.png)
### N-TRIPLES 형태로 출력
```java
RDFDataMgr.write(System.out, model, Lang.NTRIPLES);
```
![image](https://user-images.githubusercontent.com/55576129/115543285-29a33a00-a2dc-11eb-9a01-81e26a54882a.png)
----
# 더 연구해야될 부분
여기서는 핵심 고유명사를 단순히 빈도수가 가장 높게 나온 고유명사로 정함
![image](https://user-images.githubusercontent.com/55576129/115685882-9c232100-a393-11eb-98d6-973309f107e8.png)
kyung hee university를 검색한 결과는 university가 핵심 고유명사로 나옴
→ 이는 띄어쓰기 별로 나누어 형태소 분석을 했기때문
→ 핵심 고유명사를 선정하는 알고리즘 연구 필요
<br>
트리플 구성을 보면 이상한게 많이보임
→ 단순히 고유명사를 주어로 했을때 그 뒤에 나오는 동사를 동사로 하고 그 뒤에 나오는 고유명사를 object로 선정하였기 때문
→ 주어 동사 목적어를 매핑하는 더 정확한 알고리즘 연구 필요
package test_package;
import edu.stanford.nlp.coref.CorefCoreAnnotations;
import edu.stanford.nlp.coref.data.CorefChain;
import edu.stanford.nlp.coref.data.Dictionaries;
import edu.stanford.nlp.coref.data.Mention;
import edu.stanford.nlp.ie.util.RelationTriple;
import edu.stanford.nlp.io.IOUtils;
import edu.stanford.nlp.ling.CoreAnnotations;
import edu.stanford.nlp.ling.CoreLabel;
import edu.stanford.nlp.naturalli.NaturalLogicAnnotations;
import edu.stanford.nlp.naturalli.OpenIE;
import edu.stanford.nlp.naturalli.SentenceFragment;
import edu.stanford.nlp.pipeline.Annotation;
import edu.stanford.nlp.pipeline.CoreDocument;
import edu.stanford.nlp.pipeline.CoreEntityMention;
import edu.stanford.nlp.pipeline.StanfordCoreNLP;
import edu.stanford.nlp.semgraph.SemanticGraph;
import edu.stanford.nlp.semgraph.SemanticGraphCoreAnnotations;
import edu.stanford.nlp.tagger.maxent.MaxentTagger;
import edu.stanford.nlp.util.CoreMap;
import edu.stanford.nlp.util.IntPair;
import edu.stanford.nlp.util.PropertiesUtils;
import org.apache.jena.rdf.model.*;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.select.Elements;
import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors;
public class main {
public static void main(String[] args) throws IOException {
//Jsoup 파싱
Document doc = Jsoup.connect("https://en.wikipedia.org/wiki/Korea").get();
Elements pTags = doc.getElementsByTag("p");
String bodyText = Jsoup.parse(pTags.toString()).text();
// //stanford pos tagger 형태소 분석기를 이용한 태깅
// MaxentTagger tagger = new MaxentTagger("taggers/english-left3words-distsim.tagger");
// String tagged = tagger.tagString(bodyText);
//
// //핵심 고유단어 추출작업
// String[] taggedArr = tagged.split(" ");
// List<String> nnp = Arrays.stream(taggedArr).filter(word -> word.contains("_NNP")).collect(Collectors.toList());
// Hashtable<String,Integer> freqOfWordTable = new Hashtable<>();
// for (String word : nnp) {
// Integer freq = freqOfWordTable.get(word); // 단어를 꺼낸다. word가 key이고 freq가 value
// freqOfWordTable.put(word, (freq == null) ? 1: freq +1);
// }
// List sortedList = sortByValue(freqOfWordTable);
// String coreNoun = sortedList.get(0).toString();
// //트리플 추출 과정
// String[] sentences = tagged.split("\\._\\.");
// List<String[]> tripples = new ArrayList<>();
// for (String sentence : sentences){
// if (sentence.contains(coreNoun)) {
// String[] words = sentence.split(" ");
// String subject = "";
// String predicate = "";
// String object = "";
// for (String word:words) {
// if(word.equals(coreNoun)) {
// String[] removeTag = word.split("_");
// subject = removeTag[0];
// }else if(word.contains("_VB") && !subject.isEmpty()) {
// String[] removeTag = word.split("_");
// predicate = removeTag[0];
// }else if(word.contains("_NNP") && !predicate.isEmpty()) {
// String[] removeTag = word.split("_");
// object = removeTag[0];
// }
// if(!subject.isEmpty() && !predicate.isEmpty() && !object.isEmpty()){
// String[] tripple = {subject,predicate,object};
// tripples.add(tripple);
// }
// }
// }
// }
// // Jena로 RDF 추출
// Model model = ModelFactory.createDefaultModel();
// for(String[] statement : tripples){
// Resource s = model.createResource("http://subject/"+statement[0]);
// Property p = model.createProperty("http://predicate/"+statement[1]);
// RDFNode o = model.createLiteral(statement[2]);
//
// if(s.hasProperty(p)){
// s.addProperty(p,model.createResource().addProperty(p,o));
// }else {
// s.addProperty(p,o);
// }
// }
// model.write(System.out);
// //RDFDataMgr.write(System.out, model, Lang.NTRIPLES); // N-TRIPLES 형태로 출력
// stanford OpenIE
Properties props = PropertiesUtils.asProperties(
"annotators", "tokenize,ssplit,pos,lemma,ner,parse,coref"
);
StanfordCoreNLP pipeline = new StanfordCoreNLP(props);
String text;
if (args.length > 0) {
text = IOUtils.slurpFile(args[0]);
} else {
text = "Korea (officially the \"Korean Peninsula\") is a region in East Asia. Since 1945 it has been divided into the two parts which soon became the two sovereign states: North Korea (officially the \"Democratic People's Republic of Korea\") and South Korea (officially the \"Republic of Korea\"). Korea consists of the Korean Peninsula, Jeju Island, and several minor islands near the peninsula. It is bordered by China to the northwest and Russia to the northeast. It is separated from Japan to the east by the Korea Strait and the Sea of Japan (East Sea). During the first half of the 1st millennium, Korea was divided between the three competing states of Goguryeo, Baekje, and Silla, together known as the Three Kingdoms of Korea.";
//text = bodyText;
}
Annotation docu = new Annotation(text);
pipeline.annotate(docu);
List<String> sentList = new ArrayList<>();
for (CoreMap sentence : docu.get(CoreAnnotations.SentencesAnnotation.class)) {
sentList.add(sentence.get(CoreAnnotations.TextAnnotation.class));
}
String newText = "";
Collection<CorefChain> values = docu.get(CorefCoreAnnotations.CorefChainAnnotation.class).values();
for (CorefChain cc : values) {
//System.out.println("\t" + cc.getMentionsInTextualOrder());
List<CorefChain.CorefMention> mentionsInTextualOrder = cc.getMentionsInTextualOrder();
String coreWord = "";
for (int i = 0; i < mentionsInTextualOrder.size(); i++){
if (i == 0){
coreWord = mentionsInTextualOrder.get(i).mentionSpan; // 첫번째 명사를 원래 명사로 지정
}
String mention = mentionsInTextualOrder.get(i).mentionSpan; // 대명사 가져오기
int sentNum = mentionsInTextualOrder.get(i).sentNum -1; //문장 번호 가져오기
String modiSent = sentList.get(sentNum); // 수정될 문장 가져오고
modiSent = modiSent.replaceAll(mention,coreWord); // mention(대명사를) coreWord(원래단어)로 바꿔주고
sentList.set(sentNum,modiSent); // 수정된 문자열로 바꿔줌
}
}
//System.out.println(sentList);
for (String s : sentList) {
newText += s + " ";
}
System.out.println(text);
System.out.println("--------------------------------------------");
System.out.println(newText);
System.out.println("\n \n");
props = PropertiesUtils.asProperties(
"annotators", "tokenize,ssplit,pos,lemma,parse,natlog,openie"
);
props.setProperty("openie.max_entailments_per_clause","100");
props.setProperty("openie.triple.strict","false");
pipeline = new StanfordCoreNLP(props);
docu = new Annotation(newText);
pipeline.annotate(docu);
int sentNo = 0;
for (CoreMap sentence : docu.get(CoreAnnotations.SentencesAnnotation.class)) {
System.out.println("Sentence #" + ++sentNo + ": " + sentence.get(CoreAnnotations.TextAnnotation.class));
// // Print SemanticGraph
// System.out.println(sentence.get(SemanticGraphCoreAnnotations.EnhancedDependenciesAnnotation.class).toString(SemanticGraph.OutputFormat.LIST));
// Get the OpenIE triples for the sentence
Collection<RelationTriple> triples = sentence.get(NaturalLogicAnnotations.RelationTriplesAnnotation.class);
// Print the triples
for (RelationTriple triple : triples) {
System.out.println(triple.confidence + "\t" +
"<"+triple.subjectGloss()+">" + "\t" +
"<"+triple.relationGloss()+">" + "\t" +
"<"+triple.objectGloss()+">");
}
System.out.println("\n");
// Alternately, to only run e.g., the clause splitter:
// List<SentenceFragment> clauses = new OpenIE(props).clausesInSentence(sentence);
// for (SentenceFragment clause : clauses) {
// System.out.println(clause.parseTree.toString(SemanticGraph.OutputFormat.LIST));
// }
// System.out.println();
}
}
//map 정렬 메소드
public static List sortByValue(final Map map) {
List<String> list = new ArrayList();
list.addAll(map.keySet());
Collections.sort(list,new Comparator() {
public int compare(Object o1,Object o2) {
Object v1 = map.get(o1);
Object v2 = map.get(o2);
return ((Comparable) v2).compareTo(v1);
}
});
//Collections.reverse(list); // 주석시 오름차순
return list;
}
}
model = /u/nlp/data/pos-tagger/models-4.0.0/models/english-left3words-distsim-prod1.tagger
arch = left3words,wordshapes(-1,1),distsim(/u/nlp/data/pos_tags_are_useless/egw4-reut.512.clusters,-1,1),distsimconjunction(/u/nlp/data/pos_tags_are_useless/egw4-reut.512.clusters,-1,1),rareExtractor(edu.stanford.nlp.tagger.maxent.ExtractorUCase),rareExtractor(edu.stanford.nlp.tagger.maxent.ExtractorCNumber),rareExtractor(edu.stanford.nlp.tagger.maxent.ExtractorDash),rareExtractor(edu.stanford.nlp.tagger.maxent.ExtractorLetterDigitDash),rareExtractor(edu.stanford.nlp.tagger.maxent.CompanyNameDetector),rareExtractor(edu.stanford.nlp.tagger.maxent.ExtractorAllCapitalized),rareExtractor(edu.stanford.nlp.tagger.maxent.ExtractorUpperDigitDash),rareExtractor(edu.stanford.nlp.tagger.maxent.ExtractorStartSentenceCap),rareExtractor(edu.stanford.nlp.tagger.maxent.ExtractorMidSentenceCapC),rareExtractor(edu.stanford.nlp.tagger.maxent.ExtractorMidSentenceCap),prefix(10),suffix(10),unicodeshapes(0),rareExtractor(edu.stanford.nlp.tagger.maxent.ExtractorNonAlphanumeric)
wordFunction = edu.stanford.nlp.process.AmericanizeFunction
trainFile = /u/nlp/data/pos-tagger/models-4.0.0/data/experiments/english-left3words-distsim-prod1/train/craft-train.txt;/u/nlp/data/pos-tagger/models-4.0.0/data/experiments/english-left3words-distsim-prod1/train/ewt-train.txt;/u/nlp/data/pos-tagger/models-4.0.0/data/experiments/english-left3words-distsim-prod1/train/questionbank-train.txt;/u/nlp/data/pos-tagger/models-4.0.0/data/experiments/english-left3words-distsim-prod1/train/train-currency.txt;/u/nlp/data/pos-tagger/models-4.0.0/data/experiments/english-left3words-distsim-prod1/train/handparsed-train.txt;/u/nlp/data/pos-tagger/models-4.0.0/data/experiments/english-left3words-distsim-prod1/train/ontonotes-train.txt;/u/nlp/data/pos-tagger/models-4.0.0/data/experiments/english-left3words-distsim-prod1/train/wsj-train.txt;/u/nlp/data/pos-tagger/models-4.0.0/data/experiments/english-left3words-distsim-prod1/train/train-tech-english.txt
closedClassTags =
closedClassTagThreshold = 40
curWordMinFeatureThresh = 2
debug = false
debugPrefix =
tagSeparator = _
encoding = UTF-8
iterations = 100
lang = english
learnClosedClassTags = false
minFeatureThresh = 2
openClassTags =
rareWordMinFeatureThresh = 5
rareWordThresh = 5
search = owlqn
sgml = false
sigmaSquared = 0.5
regL1 = 0.75
tagInside =
tokenize = true
tokenizerFactory =
tokenizerOptions =
verbose = false
verboseResults = true
veryCommonWordThresh = 250
xmlInput =
outputFile =
outputFormat = slashTags
outputFormatOptions =
nthreads = 1
minWordsLockTags = 1
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module-library" exported="">
<library>
<CLASSES>
<root url="jar://$USER_HOME$/Desktop/stanford-postagger-full-2020-11-17/stanford-postagger-4.2.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library" exported="">
<library>
<CLASSES>
<root url="jar://$USER_HOME$/Desktop/stanford-postagger-full-2020-11-17/jsoup-1.13.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="library" exported="" name="lib" level="project" />
</component>
</module>
\ No newline at end of file