SlideShare une entreprise Scribd logo
1  sur  28
Seong-ho, Cho
darkcircle . 0426 at gmail dot com
그놈 한국 로컬팀
Xfce 한국 로컬 커미터
Translation :
The cool way to contribute to F/OSS
Part 2. Translating Automation (1)
Issuing the
problem
At the viewpoint of the engineer . . .
• 언제까지 이걸 일일히 손으로 다 쳐야됨 ?
• 번역기의 번역이 엉망이면 , 차라리 내가 번역기를 만
들어버려 ?
-> LET YOU DO IT! IF YOU CAN.
Making translator is easy, but …
• 번역기를 만들기 전에 배워두면 좋은 기초학문
• 번역할 언어들에 대한 언어학 ( 국어 , 영어 , 언어개
론 )
• 이산수학 ( 집합 , 그래프 , 위상수학 , etc. )
• 자료구조 ( + 알고리즘 )
• 프로그래밍 언어론
• 컴파일러 ( + 오토마타와 형식언어 )
Overview
Before we translate some sentences
• Need something to know
• Grammar
• Grammar generation rule
• A kind of Sentence components
• Transition relation of sentence structure between each
different languages
Token Analysis
• 나 는 학교 에 가 는 중
이다
^^ ^^ ^^^^ ^^ ^^ ^^ ^^ ^^^^
주어 조사 명사 조사 동사 조사 형용사 서술
• I am going to school
^^^ ^^^ ^^^^^ ^^ ^^^^^^
Subject verb adjective preposition noun
Rearranging components of
each sentences after replacing words
• 나 ( 는 ) 학교 에 가는중 이다
• I am going to school
• How we can model these steps to make translator?
Abstract Syntax Tree
( like binary tree structure )
am going to
I school
가는중 에
나
이다
학교
Semantic Analysis
• By using “Grammar rule”
• In single hop
• In multi hop
Predicate
Subject Object
Predicate
Subject Predicate
Subject Object
Object Phrase
Sentence generation (finish)
• Korean
• 나 ( 는 ) 학교에 가는중이다
• English
• I am going to school
More Details …
Compiler Phases
Front-End
Back-End
Lexical Analysis
Syntax Analysis
Semantic Analysis
Intermediate Code
Generation
Code Optimization
Executable Binary
Generation
Languages
• Natural Language
• Language for the conversation between Humans or
Animals
• Formal Language
• “Formal” Languages that used by “virtual turing
machine” which is made for impersonating human
Type Grammar Automaton Prod. Rule
0 Recursively
Enumerable
Turing Machine No Rest.
1 Context-Sensitive Linear-bounded
non-determistic
αAβ -> αγβ
2 Context-Free Non-determistic
Push-down
A->γ
3 Regular Expression Finite State A->αB A->Aβ A->α
Regular Expression
• 문자열 유효성 검사를 위한 검사식
• [] : 하나의 문자 선택 ( - : 범위지정 ex. A-Z : A 부터 Z )
• () : 문자열 그룹화
• {x,y} : 최소 x 번 , 최대 y 번 반복
• | : or 연산자
• . : any one character
• * : 0 or more
• + : 1 or more
• ? : 0 or 1
• ^blabla : blabla 로 시작하는 문장
• blabla$ : blabla 로 끝나는 문장
• d : 숫자 0~9
• D : 숫자 이외의 모든 문자
• w : 대소문자 숫자
• W : 대소문자 숫자 이외의 모든 문자
• s : 공백
• S : 공백 이외의 모든 문자
• ( 특수문자 ) : 특수문자 자체를 나타냄
Terminology
• Token : 글자 한 개 ( 1~2bytes )
• Symbol : 의미를 갖는 Token 하나 혹은 스트링
• Lookahead : 토큰 의미를 파악하기 위해 다음 문
자를 들여다보는 것
• Parse : 구분 분석이나 계산을 위한 트리 생성
Classes of the Symbol
• ID
• 변수 이름 , 함수 이름
• [a-zA-Z][a-zA-Z0-9_]*
• Keyword
• 형 이름 , 예약어 , 제어문
• Digit
• [0-9]
• Operator
• +, -, *, /, %, ==, !=, >=, <=, <, >, !, …
• Delimiter
• ;, (, ), [, ], {, }, ., ->, “, ‘, …
• <, > ( for Template in C++ of Generic in Java )
Grammar
• 모든 문법은 시작 심볼 S 로 시작
• Non-terminal 은 대문자로 terminal 은 소문자로표기
• Terminal 은 ε (empty string) 도 포함한다
• Non-terminal 에서 terminal 로 전이 (derive) 한다고
한다
• Terminal 에서 Non-terminal 로 가는 것은 reduce 라
고 한다 ( 의미를 가진 단어의 길이가 Non-terminal
보다 긴 것에 착안함 )
• 최종 결과는 terminal symbol string 이 되어야 한다
• BNF : Beckus-Naur Form
• S -> E+E | E-E | E*E | E/E
• E -> S | (S) | F
• F -> 0|1|2|3|4|5|6|7|8|9
Eliminate Ambiguity
• If we have a given grammar
• S-> E+E | E*E
• E-> S | F
• F-> 0|1|2|3|4|5|6|7|8|9
• We can generate below parse tree for 2 + 3 * 5
2
*+
*
3 5
+
2 3
5
Eliminate Ambiguity
• Modification (1)
• S -> E+E|E
• E-> T*T|T
• T-> F
• F-> 0|…|9
• Modification (2)
• S -> E
• E -> E+T|T
• T -> T*F|F
• T-> F
• F -> 0|…|9
• Modification (3)
• S -> ES’
• S’-> +ES’|ε
• E -> TE’
• E’-> *TE’|ε
• T -> F
• F -> 0 | … | 9
Eliminate Ambiguity
• Result (Abstract Syntax Tree)
2
+
*
3 5
Classes for Grammar
• LL(x) and LR(x)
• Left input
• Left or Right parse tree.
• x is number of lookahead token
• LL(x) Grammar
• Programming Language
• Mathematical Expression
• LR(x) Grammar
• English-like Language
Tools for Generating Analyzer
• Lex and Yacc
• Lexical Analyzer generator
• Yet Another Compiler Compiler
• Flex and Bison
• Fast LEXical analyzer generator
• is not part of GNU Project
• Bison
• Parser generator which is in the GNU Project
Reference Codes.
• Simple Calculator
• svn://darkcircle.myhome.tv/Calc
• CER Browser for IRCBot
• svn://darkcircle.myhome.tv/ExchangeList
The Plan of
Generating
Translator
Requirements
• Some SQL-Database
To store many words and maintaining matching table
• Should not better to use Regular Expression
Too many case of selection of the word.
• Need some normalized terminology matching list
Such as dictionary for the computer science.
• Language?
• Maybe C is better.
• If you are more friendly to another language, go on.
• Such as perl, python, java, and so on.
Program Structure
Dictionary
PO File
Extr. word
Get msgid
Gen. Tree
Replace
word
Rearrange
Complet
ed?
Write final
msgstr
N
Y
Ins. To
Symb.
Bucket
To be continue
on Part 3

Contenu connexe

Similaire à Dark Circle - Translation : The cool way to contribute to F/OSS #2(우분투와 번역 이야기 두번째) (2011Y10M29D)

C 언어 스터디 01 - 기초
C 언어 스터디 01 - 기초C 언어 스터디 01 - 기초
C 언어 스터디 01 - 기초
Yu Yongwoo
 
NDC 2014, 피할 수 없는 문자열의 세계
NDC 2014, 피할 수 없는 문자열의 세계NDC 2014, 피할 수 없는 문자열의 세계
NDC 2014, 피할 수 없는 문자열의 세계
tcaesvk
 
[0119 박민근] 기술 면접시 자주 나오는 문제들(ver 2013)
[0119 박민근] 기술 면접시 자주 나오는 문제들(ver 2013)[0119 박민근] 기술 면접시 자주 나오는 문제들(ver 2013)
[0119 박민근] 기술 면접시 자주 나오는 문제들(ver 2013)
MinGeun Park
 

Similaire à Dark Circle - Translation : The cool way to contribute to F/OSS #2(우분투와 번역 이야기 두번째) (2011Y10M29D) (20)

유한상태변환기를 이용한 한국어_형태소_분석_이상호
유한상태변환기를 이용한 한국어_형태소_분석_이상호유한상태변환기를 이용한 한국어_형태소_분석_이상호
유한상태변환기를 이용한 한국어_형태소_분석_이상호
 
Python programming for Bioinformatics
Python programming for BioinformaticsPython programming for Bioinformatics
Python programming for Bioinformatics
 
유한 상태 기반의 한국어 형태소 분석기_이상호
유한 상태 기반의 한국어 형태소 분석기_이상호유한 상태 기반의 한국어 형태소 분석기_이상호
유한 상태 기반의 한국어 형태소 분석기_이상호
 
C 언어 스터디 01 - 기초
C 언어 스터디 01 - 기초C 언어 스터디 01 - 기초
C 언어 스터디 01 - 기초
 
Pycon2017 koreannlp
Pycon2017 koreannlpPycon2017 koreannlp
Pycon2017 koreannlp
 
Python
PythonPython
Python
 
Elasticsearch 한글 형태소 분석기 Nori 노리
Elasticsearch 한글 형태소 분석기 Nori 노리Elasticsearch 한글 형태소 분석기 Nori 노리
Elasticsearch 한글 형태소 분석기 Nori 노리
 
iOS 개발자를 위한 영어로 이름 짓기
iOS 개발자를 위한 영어로 이름 짓기iOS 개발자를 위한 영어로 이름 짓기
iOS 개발자를 위한 영어로 이름 짓기
 
Abstract syntax semantic analyze
Abstract syntax semantic analyzeAbstract syntax semantic analyze
Abstract syntax semantic analyze
 
NDC 2014, 피할 수 없는 문자열의 세계
NDC 2014, 피할 수 없는 문자열의 세계NDC 2014, 피할 수 없는 문자열의 세계
NDC 2014, 피할 수 없는 문자열의 세계
 
파이썬 데이터 분석 (18년)
파이썬 데이터 분석 (18년)파이썬 데이터 분석 (18년)
파이썬 데이터 분석 (18년)
 
[0119 박민근] 기술 면접시 자주 나오는 문제들(ver 2013)
[0119 박민근] 기술 면접시 자주 나오는 문제들(ver 2013)[0119 박민근] 기술 면접시 자주 나오는 문제들(ver 2013)
[0119 박민근] 기술 면접시 자주 나오는 문제들(ver 2013)
 
한글 언어 자원과 R: KoNLP 개선과 활용
한글 언어 자원과 R: KoNLP 개선과 활용한글 언어 자원과 R: KoNLP 개선과 활용
한글 언어 자원과 R: KoNLP 개선과 활용
 
R 기초 : R Basics
R 기초 : R BasicsR 기초 : R Basics
R 기초 : R Basics
 
Python basic
Python basicPython basic
Python basic
 
한국어 띄어쓰기 프로그램 도전기
한국어 띄어쓰기 프로그램 도전기한국어 띄어쓰기 프로그램 도전기
한국어 띄어쓰기 프로그램 도전기
 
[Langcon2020]롯데의 딥러닝 모델은 어떻게 자기소개서를 읽고 있을까?
[Langcon2020]롯데의 딥러닝 모델은 어떻게 자기소개서를 읽고 있을까?[Langcon2020]롯데의 딥러닝 모델은 어떻게 자기소개서를 읽고 있을까?
[Langcon2020]롯데의 딥러닝 모델은 어떻게 자기소개서를 읽고 있을까?
 
[Devfest Campus Korea 2021]효율적인 문제해결 With 알고리즘
[Devfest Campus Korea 2021]효율적인 문제해결 With 알고리즘[Devfest Campus Korea 2021]효율적인 문제해결 With 알고리즘
[Devfest Campus Korea 2021]효율적인 문제해결 With 알고리즘
 
파이썬을 활용한 자연어분석 기초
파이썬을 활용한 자연어분석 기초파이썬을 활용한 자연어분석 기초
파이썬을 활용한 자연어분석 기초
 
코딩테스트 합격자 되기 2주차 스터디 - 리스트_딕셔너리
코딩테스트 합격자 되기 2주차 스터디 - 리스트_딕셔너리코딩테스트 합격자 되기 2주차 스터디 - 리스트_딕셔너리
코딩테스트 합격자 되기 2주차 스터디 - 리스트_딕셔너리
 

Plus de Ubuntu Korea Community

Plus de Ubuntu Korea Community (20)

권총 사격하러 우분투 써밋 참가한 썰.txt
 권총 사격하러 우분투 써밋 참가한 썰.txt  권총 사격하러 우분투 써밋 참가한 썰.txt
권총 사격하러 우분투 써밋 참가한 썰.txt
 
머신러닝/딥러닝 개발자/연구자에게 필요한 개발/연구 환경
머신러닝/딥러닝 개발자/연구자에게 필요한 개발/연구 환경머신러닝/딥러닝 개발자/연구자에게 필요한 개발/연구 환경
머신러닝/딥러닝 개발자/연구자에게 필요한 개발/연구 환경
 
우분투한국커뮤니티 2022년 활동 정리
우분투한국커뮤니티 2022년 활동 정리우분투한국커뮤니티 2022년 활동 정리
우분투한국커뮤니티 2022년 활동 정리
 
우분투한국커뮤니티 2022년 신년회
우분투한국커뮤니티 2022년 신년회우분투한국커뮤니티 2022년 신년회
우분투한국커뮤니티 2022년 신년회
 
Ubuntu Korea at FOSSASIA Summit 2022
Ubuntu Korea at FOSSASIA Summit 2022Ubuntu Korea at FOSSASIA Summit 2022
Ubuntu Korea at FOSSASIA Summit 2022
 
Overview of the Flatpak
Overview of the FlatpakOverview of the Flatpak
Overview of the Flatpak
 
Usage of the MQTT
Usage of the MQTTUsage of the MQTT
Usage of the MQTT
 
Open Source and the License
Open Source and the LicenseOpen Source and the License
Open Source and the License
 
Memory Attack - The Memory Attack Techniques
Memory Attack - The Memory Attack TechniquesMemory Attack - The Memory Attack Techniques
Memory Attack - The Memory Attack Techniques
 
Python을 이용한 Linux Desktop Application
Python을 이용한 Linux Desktop ApplicationPython을 이용한 Linux Desktop Application
Python을 이용한 Linux Desktop Application
 
나의 우분투 이야기
나의 우분투 이야기나의 우분투 이야기
나의 우분투 이야기
 
Malware Dataset & Ubuntu
Malware Dataset & UbuntuMalware Dataset & Ubuntu
Malware Dataset & Ubuntu
 
케라스와 함께하는 재밌는 딥러닝 활용 사례들
케라스와 함께하는 재밌는 딥러닝 활용 사례들케라스와 함께하는 재밌는 딥러닝 활용 사례들
케라스와 함께하는 재밌는 딥러닝 활용 사례들
 
딥러닝 세계에 입문하기 위반 분투
딥러닝 세계에 입문하기 위반 분투딥러닝 세계에 입문하기 위반 분투
딥러닝 세계에 입문하기 위반 분투
 
9월 서울지역 세미나 GPG 키사이닝 파티
9월 서울지역 세미나 GPG 키사이닝 파티9월 서울지역 세미나 GPG 키사이닝 파티
9월 서울지역 세미나 GPG 키사이닝 파티
 
우분투한국커뮤니티 2018년도 상반기 활동 보고
우분투한국커뮤니티 2018년도 상반기 활동 보고우분투한국커뮤니티 2018년도 상반기 활동 보고
우분투한국커뮤니티 2018년도 상반기 활동 보고
 
새로운 Libhanjp 라이브러리 구조
새로운 Libhanjp 라이브러리 구조새로운 Libhanjp 라이브러리 구조
새로운 Libhanjp 라이브러리 구조
 
스타트업에서 하드웨어 개발 프로세스 도입하기
스타트업에서 하드웨어 개발 프로세스 도입하기스타트업에서 하드웨어 개발 프로세스 도입하기
스타트업에서 하드웨어 개발 프로세스 도입하기
 
기계들의 소셜 미디어, MQTT
기계들의 소셜 미디어, MQTT기계들의 소셜 미디어, MQTT
기계들의 소셜 미디어, MQTT
 
모바일에 딥러닝 심기
모바일에 딥러닝 심기모바일에 딥러닝 심기
모바일에 딥러닝 심기
 

Dark Circle - Translation : The cool way to contribute to F/OSS #2(우분투와 번역 이야기 두번째) (2011Y10M29D)

  • 1. Seong-ho, Cho darkcircle . 0426 at gmail dot com 그놈 한국 로컬팀 Xfce 한국 로컬 커미터 Translation : The cool way to contribute to F/OSS Part 2. Translating Automation (1)
  • 3. At the viewpoint of the engineer . . . • 언제까지 이걸 일일히 손으로 다 쳐야됨 ? • 번역기의 번역이 엉망이면 , 차라리 내가 번역기를 만 들어버려 ? -> LET YOU DO IT! IF YOU CAN.
  • 4. Making translator is easy, but … • 번역기를 만들기 전에 배워두면 좋은 기초학문 • 번역할 언어들에 대한 언어학 ( 국어 , 영어 , 언어개 론 ) • 이산수학 ( 집합 , 그래프 , 위상수학 , etc. ) • 자료구조 ( + 알고리즘 ) • 프로그래밍 언어론 • 컴파일러 ( + 오토마타와 형식언어 )
  • 6. Before we translate some sentences • Need something to know • Grammar • Grammar generation rule • A kind of Sentence components • Transition relation of sentence structure between each different languages
  • 7. Token Analysis • 나 는 학교 에 가 는 중 이다 ^^ ^^ ^^^^ ^^ ^^ ^^ ^^ ^^^^ 주어 조사 명사 조사 동사 조사 형용사 서술 • I am going to school ^^^ ^^^ ^^^^^ ^^ ^^^^^^ Subject verb adjective preposition noun
  • 8. Rearranging components of each sentences after replacing words • 나 ( 는 ) 학교 에 가는중 이다 • I am going to school • How we can model these steps to make translator?
  • 9. Abstract Syntax Tree ( like binary tree structure ) am going to I school 가는중 에 나 이다 학교
  • 10. Semantic Analysis • By using “Grammar rule” • In single hop • In multi hop Predicate Subject Object Predicate Subject Predicate Subject Object Object Phrase
  • 11. Sentence generation (finish) • Korean • 나 ( 는 ) 학교에 가는중이다 • English • I am going to school
  • 13. Compiler Phases Front-End Back-End Lexical Analysis Syntax Analysis Semantic Analysis Intermediate Code Generation Code Optimization Executable Binary Generation
  • 14. Languages • Natural Language • Language for the conversation between Humans or Animals • Formal Language • “Formal” Languages that used by “virtual turing machine” which is made for impersonating human Type Grammar Automaton Prod. Rule 0 Recursively Enumerable Turing Machine No Rest. 1 Context-Sensitive Linear-bounded non-determistic αAβ -> αγβ 2 Context-Free Non-determistic Push-down A->γ 3 Regular Expression Finite State A->αB A->Aβ A->α
  • 15. Regular Expression • 문자열 유효성 검사를 위한 검사식 • [] : 하나의 문자 선택 ( - : 범위지정 ex. A-Z : A 부터 Z ) • () : 문자열 그룹화 • {x,y} : 최소 x 번 , 최대 y 번 반복 • | : or 연산자 • . : any one character • * : 0 or more • + : 1 or more • ? : 0 or 1 • ^blabla : blabla 로 시작하는 문장 • blabla$ : blabla 로 끝나는 문장 • d : 숫자 0~9 • D : 숫자 이외의 모든 문자 • w : 대소문자 숫자 • W : 대소문자 숫자 이외의 모든 문자 • s : 공백 • S : 공백 이외의 모든 문자 • ( 특수문자 ) : 특수문자 자체를 나타냄
  • 16. Terminology • Token : 글자 한 개 ( 1~2bytes ) • Symbol : 의미를 갖는 Token 하나 혹은 스트링 • Lookahead : 토큰 의미를 파악하기 위해 다음 문 자를 들여다보는 것 • Parse : 구분 분석이나 계산을 위한 트리 생성
  • 17. Classes of the Symbol • ID • 변수 이름 , 함수 이름 • [a-zA-Z][a-zA-Z0-9_]* • Keyword • 형 이름 , 예약어 , 제어문 • Digit • [0-9] • Operator • +, -, *, /, %, ==, !=, >=, <=, <, >, !, … • Delimiter • ;, (, ), [, ], {, }, ., ->, “, ‘, … • <, > ( for Template in C++ of Generic in Java )
  • 18. Grammar • 모든 문법은 시작 심볼 S 로 시작 • Non-terminal 은 대문자로 terminal 은 소문자로표기 • Terminal 은 ε (empty string) 도 포함한다 • Non-terminal 에서 terminal 로 전이 (derive) 한다고 한다 • Terminal 에서 Non-terminal 로 가는 것은 reduce 라 고 한다 ( 의미를 가진 단어의 길이가 Non-terminal 보다 긴 것에 착안함 ) • 최종 결과는 terminal symbol string 이 되어야 한다 • BNF : Beckus-Naur Form • S -> E+E | E-E | E*E | E/E • E -> S | (S) | F • F -> 0|1|2|3|4|5|6|7|8|9
  • 19. Eliminate Ambiguity • If we have a given grammar • S-> E+E | E*E • E-> S | F • F-> 0|1|2|3|4|5|6|7|8|9 • We can generate below parse tree for 2 + 3 * 5 2 *+ * 3 5 + 2 3 5
  • 20. Eliminate Ambiguity • Modification (1) • S -> E+E|E • E-> T*T|T • T-> F • F-> 0|…|9 • Modification (2) • S -> E • E -> E+T|T • T -> T*F|F • T-> F • F -> 0|…|9 • Modification (3) • S -> ES’ • S’-> +ES’|ε • E -> TE’ • E’-> *TE’|ε • T -> F • F -> 0 | … | 9
  • 21. Eliminate Ambiguity • Result (Abstract Syntax Tree) 2 + * 3 5
  • 22. Classes for Grammar • LL(x) and LR(x) • Left input • Left or Right parse tree. • x is number of lookahead token • LL(x) Grammar • Programming Language • Mathematical Expression • LR(x) Grammar • English-like Language
  • 23. Tools for Generating Analyzer • Lex and Yacc • Lexical Analyzer generator • Yet Another Compiler Compiler • Flex and Bison • Fast LEXical analyzer generator • is not part of GNU Project • Bison • Parser generator which is in the GNU Project
  • 24. Reference Codes. • Simple Calculator • svn://darkcircle.myhome.tv/Calc • CER Browser for IRCBot • svn://darkcircle.myhome.tv/ExchangeList
  • 26. Requirements • Some SQL-Database To store many words and maintaining matching table • Should not better to use Regular Expression Too many case of selection of the word. • Need some normalized terminology matching list Such as dictionary for the computer science. • Language? • Maybe C is better. • If you are more friendly to another language, go on. • Such as perl, python, java, and so on.
  • 27. Program Structure Dictionary PO File Extr. word Get msgid Gen. Tree Replace word Rearrange Complet ed? Write final msgstr N Y Ins. To Symb. Bucket