-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #849 from raccoonyy/korean
Implement basic Korean support
- Loading branch information
Showing
15 changed files
with
217 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
= Instances Overview | ||
Author's Name <person@email.address> | ||
v1.2, 2015-08 | ||
|
||
This is the optional preamble (an untitled section body). Useful for writing simple sectionless documents consisting only of a preamble. | ||
|
||
NOTE: The abstract, preface, appendix, bibliography, glossary and index section titles are significant ('specialsections'). | ||
|
||
:numbered!: | ||
[abstract] | ||
[suppress='Contraction WeakExpression'] | ||
|
||
= 눈송이 서버 | ||
|
||
서버 운영을 오래 해 본 사람이라도,처음 들어가는 서버에서는 마음 먹은 대로 문제를 해결하기가 어렵습니다. 이는 서버를 다루는 기술과는 별개로, 각 서버마다 운영 기록이 다르기 때문입니다. 똑같은 일을 하는 두 서버가 있다 해도, A 서버는 한 달 전에 구성했고 B 서버는 이제 막 구성했다면, 운영체제부터 컴파일러, 설치된 패키지까지 완벽하게 같기는 쉽지 않습니다. 그리고 이러한 차이점들이 장애를 일으키고 말죠. 'A 서버는 잘 되는데 B 서버는 왜 죽었지?"와 같은 일 (혹은 그 반대)이 벌어지는 겁니다. | ||
이렇게 서로 모양이 다른 서버들이 존재하는 상황을 눈송이 서버(Snowflakes Server)라고도 합니다. 모든 눈송이의 모양이 다르듯, 서버들도 서로 다른 모습이라는 말이죠. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<!-- @suppress Contraction WeakExpression --> | ||
# 눈송이 서버 | ||
|
||
서버 운영을 오래 해 본 사람이라도,처음 들어가는 서버에서는 마음 먹은 대로 문제를 해결하기가 어렵습니다. 이는 서버를 다루는 기술과는 별개로, 각 서버마다 운영 기록이 다르기 때문입니다. 똑같은 일을 하는 두 서버가 있다 해도, A 서버는 한 달 전에 구성했고 B 서버는 이제 막 구성했다면, 운영체제부터 컴파일러, 설치된 패키지까지 완벽하게 같기는 쉽지 않습니다. 그리고 이러한 차이점들이 장애를 일으키고 말죠. 'A 서버는 잘 되는데 B 서버는 왜 죽었지?"와 같은 일 (혹은 그 반대)이 벌어지는 겁니다. | ||
이렇게 서로 모양이 다른 서버들이 존재하는 상황을 눈송이 서버(Snowflakes Server)라고도 합니다. 모든 눈송이의 모양이 다르듯, 서버들도 서로 다른 모습이라는 말이죠. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#@# @suppress Contraction WeakExpression | ||
= 눈송이 서버 | ||
|
||
서버 운영을 오래 해 본 사람이라도,처음 들어가는 서버에서는 마음 먹은 대로 문제를 해결하기가 어렵습니다. 이는 서버를 다루는 기술과는 별개로, 각 서버마다 운영 기록이 다르기 때문입니다. 똑같은 일을 하는 두 서버가 있다 해도, A 서버는 한 달 전에 구성했고 B 서버는 이제 막 구성했다면, 운영체제부터 컴파일러, 설치된 패키지까지 완벽하게 같기는 쉽지 않습니다. 그리고 이러한 차이점들이 장애를 일으키고 말죠. 'A 서버는 잘 되는데 B 서버는 왜 죽었지?"와 같은 일 (혹은 그 반대)이 벌어지는 겁니다. | ||
이렇게 서로 모양이 다른 서버들이 존재하는 상황을 눈송이 서버(Snowflakes Server)라고도 합니다. 모든 눈송이의 모양이 다르듯, 서버들도 서로 다른 모습이라는 말이죠. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
######## | ||
눈송이 서버 | ||
######## | ||
|
||
서버 운영을 오래 해 본 사람이라도,처음 들어가는 서버에서는 마음 먹은 대로 문제를 해결하기가 어렵습니다. 이는 서버를 다루는 기술과는 별개로, 각 서버마다 운영 기록이 다르기 때문입니다. 똑같은 일을 하는 두 서버가 있다 해도, A 서버는 한 달 전에 구성했고 B 서버는 이제 막 구성했다면, 운영체제부터 컴파일러, 설치된 패키지까지 완벽하게 같기는 쉽지 않습니다. 그리고 이러한 차이점들이 장애를 일으키고 말죠. 'A 서버는 잘 되는데 B 서버는 왜 죽었지?"와 같은 일 (혹은 그 반대)이 벌어지는 겁니다. | ||
이렇게 서로 모양이 다른 서버들이 존재하는 상황을 눈송이 서버(Snowflakes Server)라고도 합니다. 모든 눈송이의 모양이 다르듯, 서버들도 서로 다른 모습이라는 말이죠. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
\documentclass[a4paper, 10pt]{article} | ||
|
||
\usepackage{url} | ||
\usepackage{color} | ||
\usepackage{listings} | ||
|
||
\title{눈송이 서버} | ||
\author{Alan Kim} | ||
|
||
\begin{document} | ||
\maketitle | ||
\begin{abstract} | ||
운영하면서 만들어지는 눈송이 서버들 | ||
\end{abstract} | ||
|
||
% @suppress Contraction WeakExpression | ||
\section{Summary} | ||
|
||
서버 운영을 오래 해 본 사람이라도,처음 들어가는 서버에서는 마음 먹은 대로 문제를 해결하기가 어렵습니다. 이는 서버를 다루는 기술과는 별개로, 각 서버마다 운영 기록이 다르기 때문입니다. 똑같은 일을 하는 두 서버가 있다 해도, A 서버는 한 달 전에 구성했고 B 서버는 이제 막 구성했다면, 운영체제부터 컴파일러, 설치된 패키지까지 완벽하게 같기는 쉽지 않습니다. 그리고 이러한 차이점들이 장애를 일으키고 말죠. 'A 서버는 잘 되는데 B 서버는 왜 죽었지?"와 같은 일 (혹은 그 반대)이 벌어지는 겁니다. | ||
이렇게 서로 모양이 다른 서버들이 존재하는 상황을 눈송이 서버(Snowflakes Server)라고도 합니다. 모든 눈송이의 모양이 다르듯, 서버들도 서로 다른 모습이라는 말이죠. | ||
|
||
%% \bibliographystyle{plain} | ||
%% \bibliography{reference} | ||
|
||
\end{document} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
서버 운영을 오래 해 본 사람이라도,처음 들어가는 서버에서는 마음 먹은 대로 문제를 해결하기가 어렵습니다. 이는 서버를 다루는 기술과는 별개로, 각 서버마다 운영 기록이 다르기 때문입니다. 똑같은 일을 하는 두 서버가 있다 해도, A 서버는 한 달 전에 구성했고 B 서버는 이제 막 구성했다면, 운영체제부터 컴파일러, 설치된 패키지까지 완벽하게 같기는 쉽지 않습니다. 그리고 이러한 차이점들이 장애를 일으키고 말죠. 'A 서버는 잘 되는데 B 서버는 왜 죽었지?"와 같은 일 (혹은 그 반대)이 벌어지는 겁니다. | ||
이렇게 서로 모양이 다른 서버들이 존재하는 상황을 눈송이 서버(Snowflakes Server)라고도 합니다. 모든 눈송이의 모양이 다르듯, 서버들도 서로 다른 모습이라는 말이죠. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
redpen-core/src/main/java/cc/redpen/tokenizer/KoreanTokenizer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/** | ||
* redpen: a text inspection tool | ||
* Copyright (c) 2014-2015 Recruit Technologies Co., Ltd. and contributors | ||
* (see CONTRIBUTORS.md) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package cc.redpen.tokenizer; | ||
|
||
import kr.co.shineware.nlp.komoran.core.Komoran; | ||
import kr.co.shineware.nlp.komoran.model.KomoranResult; | ||
import kr.co.shineware.nlp.komoran.model.Token; | ||
import kr.co.shineware.nlp.komoran.constant.DEFAULT_MODEL; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class KoreanTokenizer implements RedPenTokenizer { | ||
private Komoran tokenizer; | ||
|
||
public KoreanTokenizer() { | ||
this.tokenizer = new Komoran(DEFAULT_MODEL.FULL); | ||
} | ||
|
||
@Override | ||
public List<TokenElement> tokenize(String content) { | ||
List<TokenElement> tokens = new ArrayList<>(); | ||
if (content == "") { return tokens; } | ||
|
||
KomoranResult resultList = tokenizer.analyze(content); | ||
List<Token> tokenList = resultList.getTokenList(); | ||
|
||
for (Token token : tokenList) { | ||
List<String> pos = new ArrayList<String>(); | ||
pos.add(token.getPos()); | ||
tokens.add(new TokenElement(token.getMorph(), pos, token.getBeginIndex())); | ||
} | ||
|
||
return tokens; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
redpen-core/src/test/java/cc/redpen/tokenizer/KoreanTokenizerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/** | ||
* redpen: a text inspection tool | ||
* Copyright (c) 2014-2015 Recruit Technologies Co., Ltd. and contributors | ||
* (see CONTRIBUTORS.md) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package cc.redpen.tokenizer; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import java.util.List; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
public class KoreanTokenizerTest { | ||
@Test | ||
public void testTokenize() { | ||
KoreanTokenizer tokenizer = new KoreanTokenizer(); | ||
List<TokenElement> tokens = tokenizer.tokenize("도움이 될 것이다."); | ||
assertEquals(8, tokens.size()); | ||
assertEquals("도움", tokens.get(0).getSurface()); | ||
assertEquals("NNG", tokens.get(0).getTags().get(0)); | ||
assertEquals("이", tokens.get(1).getSurface()); | ||
assertEquals("JKS", tokens.get(1).getTags().get(0)); | ||
assertEquals("되", tokens.get(2).getSurface()); | ||
assertEquals("VV", tokens.get(2).getTags().get(0)); | ||
assertEquals("ㄹ", tokens.get(3).getSurface()); | ||
assertEquals("ETM", tokens.get(3).getTags().get(0)); | ||
assertEquals("것", tokens.get(4).getSurface()); | ||
assertEquals("NNB", tokens.get(4).getTags().get(0)); | ||
assertEquals("이", tokens.get(5).getSurface()); | ||
assertEquals("VCP", tokens.get(5).getTags().get(0)); | ||
assertEquals("다", tokens.get(6).getSurface()); | ||
assertEquals("EF", tokens.get(6).getTags().get(0)); | ||
assertEquals(".", tokens.get(7).getSurface()); | ||
assertEquals("SF", tokens.get(7).getTags().get(0)); | ||
} | ||
|
||
@Test | ||
public void testTokenizeVoid() { | ||
KoreanTokenizer tokenizer = new KoreanTokenizer(); | ||
List<TokenElement> tokens = tokenizer.tokenize(""); | ||
assertEquals(0, tokens.size()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters