SlideShare a Scribd company logo
1 of 14
Download to read offline
Tree Tagger를 이용한 한국어 품사태깅
국민대학교 자연어처리연구실 남규현
Natural Language Processing Lab. @Kookmin University
Natural Language Processing Lab. @Kookmin University
Tree Tagger
- n-gram 기반 확률 태거의 전이 확률 : 𝑃(𝑡 𝑛|𝑡 𝑛−2 𝑡 𝑛−1) =
𝐹(𝑡 𝑛−2 𝑡 𝑛−1 𝑡 𝑛)
𝐹(𝑡 𝑛−2 𝑡 𝑛−1)
- 출현 확률이 적은 단어는 확률이 0이 됨
• 기존 태거
- 전이 확률을 의사결정 트리를 이용하여 계산
• Tree Tagger
Natural Language Processing Lab. @Kookmin University
Decision Tree
- Tri-gram의 훈련 집합에 기반해 재귀적으로 생성
- “test”
- 각 단계에서 “test” 라는 조건이 생성
- “test”는 선행 태그가 t 인지 검사
- 최대로 집합들을 구분지을 수 있도록 “test”
를 생성
• 트리 생성
Natural Language Processing Lab. @Kookmin University
Decision Tree
- Information Gain(순도) 증가하는 방향
= Entropy(불확실성) 가 감소하는 방향
- 𝑡−1, 𝑡−2 를 x, 𝑡 를 y 로 생각하여 분기 생성
- N개의 훈련 집합을 임의로 2개의 집합으로 구분 짓고 분기 후 entropy (𝐼 𝑞) 가 최소인 기준을 찾음
- 현재 노드에서 훈련 집합 : C
- 임의의 기준 : 선행 태그가 무엇인가
- 임의의 기준에 의해 Yes로 분류된 훈련 집합 : C+
- 임의의 기준에 의해 No 로 분류된 훈련 집합 : C-
- 현재 노드의 분류한 훈련 집합 개수가 threshold 보다 작으면 멈춤
• Test 생성 방법
Natural Language Processing Lab. @Kookmin University
Decision Tree
- 과도한 분류를 억제하기 위해 (일반화 하기 위해) 가지치기 필요
- 어떤 노드의 G 값이 일정 threshold 보다 작으면 제거
• 가지 치기
Natural Language Processing Lab. @Kookmin University
Lexicon
- Fullform lexicon
- Word/tag 를 count 하여 빈도 적은건 제거
- Suffix lexicon
- Suffix 에 대한 길이 5인 tree 생성
- 똑같이 정보이론에 근거해 가지치기
- Default entry
• 단어의 태그 확률
Natural Language Processing Lab. @Kookmin University
train
$ train-tree-tagger.exe -utf8 -st sf lexicon.txt open_class.txt input_file.txt model
- utf8 : 인코딩 옵션
- st sf : 문장 종결 토큰의 품사는 sf 임을 알려줌
- lexicon.txt : 어절 사전
- open_class.txt : 모든 품사 리스트
- input_file.txt : 학습할 말뭉치
- model : 학습 결과를 저장할 모델
Natural Language Processing Lab. @Kookmin University
Lexicon.txt
Natural Language Processing Lab. @Kookmin University
Open_class.txt
Natural Language Processing Lab. @Kookmin University
Input_file.txt
Natural Language Processing Lab. @Kookmin University
Train
Natural Language Processing Lab. @Kookmin University
Test
$ tree-tagger.exe -token model input.txt > output.txt
- token : 출력 결과에 어절도 포함
- model : 학습시킨 모델의 경로
- Input.txt : 테스트를 진행할 말뭉치
- Output.txt : 결과를 저장할 파일
Natural Language Processing Lab. @Kookmin University
Test – input.txt
어절을 개행으로 구별하여 우측 사진과 같이 구성함
Natural Language Processing Lab. @Kookmin University
데이터
어절 수 문장 수
Training data 8,958,641 666,414
Test data 1,059,776 74,046
Total 10,018,417 740,460
세종 품사 말뭉치
품사 태깅 정확도 : 92.5994

More Related Content

More from Gyuhyeon Nam

grade server - block socket
grade server - block socketgrade server - block socket
grade server - block socketGyuhyeon Nam
 
[study] Survey of the State of the Art in Natural Language Generation: Core t...
[study] Survey of the State of the Art in Natural Language Generation: Core t...[study] Survey of the State of the Art in Natural Language Generation: Core t...
[study] Survey of the State of the Art in Natural Language Generation: Core t...Gyuhyeon Nam
 
[study] 띄어쓰기 오류에 강건한 문장 압축 기반 한국어 문장 분류
[study] 띄어쓰기 오류에 강건한 문장 압축 기반 한국어 문장 분류[study] 띄어쓰기 오류에 강건한 문장 압축 기반 한국어 문장 분류
[study] 띄어쓰기 오류에 강건한 문장 압축 기반 한국어 문장 분류Gyuhyeon Nam
 
universal dependency relation
universal dependency relation universal dependency relation
universal dependency relation Gyuhyeon Nam
 
[study] Building Universal Dependency Treebanks in Korean
[study] Building Universal Dependency Treebanks in Korean[study] Building Universal Dependency Treebanks in Korean
[study] Building Universal Dependency Treebanks in KoreanGyuhyeon Nam
 
[study] Long Text Generation via Adversarial Training with Leaked Information
[study] Long Text Generation via Adversarial Training with Leaked Information[study] Long Text Generation via Adversarial Training with Leaked Information
[study] Long Text Generation via Adversarial Training with Leaked InformationGyuhyeon Nam
 
[Tool] chatscript 사용법
[Tool] chatscript 사용법[Tool] chatscript 사용법
[Tool] chatscript 사용법Gyuhyeon Nam
 
[Distributed System] ch4. interprocess communication
[Distributed System] ch4. interprocess communication[Distributed System] ch4. interprocess communication
[Distributed System] ch4. interprocess communicationGyuhyeon Nam
 

More from Gyuhyeon Nam (9)

grade server - block socket
grade server - block socketgrade server - block socket
grade server - block socket
 
[study] Survey of the State of the Art in Natural Language Generation: Core t...
[study] Survey of the State of the Art in Natural Language Generation: Core t...[study] Survey of the State of the Art in Natural Language Generation: Core t...
[study] Survey of the State of the Art in Natural Language Generation: Core t...
 
[study] 띄어쓰기 오류에 강건한 문장 압축 기반 한국어 문장 분류
[study] 띄어쓰기 오류에 강건한 문장 압축 기반 한국어 문장 분류[study] 띄어쓰기 오류에 강건한 문장 압축 기반 한국어 문장 분류
[study] 띄어쓰기 오류에 강건한 문장 압축 기반 한국어 문장 분류
 
universal dependency relation
universal dependency relation universal dependency relation
universal dependency relation
 
[study] Building Universal Dependency Treebanks in Korean
[study] Building Universal Dependency Treebanks in Korean[study] Building Universal Dependency Treebanks in Korean
[study] Building Universal Dependency Treebanks in Korean
 
[study] Long Text Generation via Adversarial Training with Leaked Information
[study] Long Text Generation via Adversarial Training with Leaked Information[study] Long Text Generation via Adversarial Training with Leaked Information
[study] Long Text Generation via Adversarial Training with Leaked Information
 
[Tool] chatscript 사용법
[Tool] chatscript 사용법[Tool] chatscript 사용법
[Tool] chatscript 사용법
 
[Tool] cwb cqp
[Tool] cwb cqp[Tool] cwb cqp
[Tool] cwb cqp
 
[Distributed System] ch4. interprocess communication
[Distributed System] ch4. interprocess communication[Distributed System] ch4. interprocess communication
[Distributed System] ch4. interprocess communication
 

[Tool] Tree Tagger 를 이용한 한국어 품사 태깅

  • 1. Tree Tagger를 이용한 한국어 품사태깅 국민대학교 자연어처리연구실 남규현 Natural Language Processing Lab. @Kookmin University
  • 2. Natural Language Processing Lab. @Kookmin University Tree Tagger - n-gram 기반 확률 태거의 전이 확률 : 𝑃(𝑡 𝑛|𝑡 𝑛−2 𝑡 𝑛−1) = 𝐹(𝑡 𝑛−2 𝑡 𝑛−1 𝑡 𝑛) 𝐹(𝑡 𝑛−2 𝑡 𝑛−1) - 출현 확률이 적은 단어는 확률이 0이 됨 • 기존 태거 - 전이 확률을 의사결정 트리를 이용하여 계산 • Tree Tagger
  • 3. Natural Language Processing Lab. @Kookmin University Decision Tree - Tri-gram의 훈련 집합에 기반해 재귀적으로 생성 - “test” - 각 단계에서 “test” 라는 조건이 생성 - “test”는 선행 태그가 t 인지 검사 - 최대로 집합들을 구분지을 수 있도록 “test” 를 생성 • 트리 생성
  • 4. Natural Language Processing Lab. @Kookmin University Decision Tree - Information Gain(순도) 증가하는 방향 = Entropy(불확실성) 가 감소하는 방향 - 𝑡−1, 𝑡−2 를 x, 𝑡 를 y 로 생각하여 분기 생성 - N개의 훈련 집합을 임의로 2개의 집합으로 구분 짓고 분기 후 entropy (𝐼 𝑞) 가 최소인 기준을 찾음 - 현재 노드에서 훈련 집합 : C - 임의의 기준 : 선행 태그가 무엇인가 - 임의의 기준에 의해 Yes로 분류된 훈련 집합 : C+ - 임의의 기준에 의해 No 로 분류된 훈련 집합 : C- - 현재 노드의 분류한 훈련 집합 개수가 threshold 보다 작으면 멈춤 • Test 생성 방법
  • 5. Natural Language Processing Lab. @Kookmin University Decision Tree - 과도한 분류를 억제하기 위해 (일반화 하기 위해) 가지치기 필요 - 어떤 노드의 G 값이 일정 threshold 보다 작으면 제거 • 가지 치기
  • 6. Natural Language Processing Lab. @Kookmin University Lexicon - Fullform lexicon - Word/tag 를 count 하여 빈도 적은건 제거 - Suffix lexicon - Suffix 에 대한 길이 5인 tree 생성 - 똑같이 정보이론에 근거해 가지치기 - Default entry • 단어의 태그 확률
  • 7. Natural Language Processing Lab. @Kookmin University train $ train-tree-tagger.exe -utf8 -st sf lexicon.txt open_class.txt input_file.txt model - utf8 : 인코딩 옵션 - st sf : 문장 종결 토큰의 품사는 sf 임을 알려줌 - lexicon.txt : 어절 사전 - open_class.txt : 모든 품사 리스트 - input_file.txt : 학습할 말뭉치 - model : 학습 결과를 저장할 모델
  • 8. Natural Language Processing Lab. @Kookmin University Lexicon.txt
  • 9. Natural Language Processing Lab. @Kookmin University Open_class.txt
  • 10. Natural Language Processing Lab. @Kookmin University Input_file.txt
  • 11. Natural Language Processing Lab. @Kookmin University Train
  • 12. Natural Language Processing Lab. @Kookmin University Test $ tree-tagger.exe -token model input.txt > output.txt - token : 출력 결과에 어절도 포함 - model : 학습시킨 모델의 경로 - Input.txt : 테스트를 진행할 말뭉치 - Output.txt : 결과를 저장할 파일
  • 13. Natural Language Processing Lab. @Kookmin University Test – input.txt 어절을 개행으로 구별하여 우측 사진과 같이 구성함
  • 14. Natural Language Processing Lab. @Kookmin University 데이터 어절 수 문장 수 Training data 8,958,641 666,414 Test data 1,059,776 74,046 Total 10,018,417 740,460 세종 품사 말뭉치 품사 태깅 정확도 : 92.5994