diff --git a/korea_nlp/Example.md b/korea_nlp/Example.md index 6d40dad240e728536399f32acf017362ca615ccc..4d39fdfe30a201edd571e7fd1c688cc9e6b24be7 100644 --- a/korea_nlp/Example.md +++ b/korea_nlp/Example.md @@ -6,7 +6,6 @@ ## 주의사항 - 사용을 원하는 python file과 동일한 폴더에 다운로드 후 import 하셔서 정상 실행이 됩니다. -- Library file에 import를 하시는 경우 korea_nlp_library.py file을 Download 해주세요. #### 예제 - 위 class 를 import 하여 사용하시면 됩니다. @@ -52,10 +51,10 @@ kn.tokenize(sentence,scores) <br> **input**: <pre><code>import korea_nlp -kn = korea_nlp.noun_extract() +kn = korea_nlp.Tokenizer() sentence = '김치헌은 바보다.' scores = {} -kn.tokenize(sentence,scores) +kn.noun_extract(sentence,scores) </code></pre> <br> **output**: @@ -67,10 +66,10 @@ kn.tokenize(sentence,scores) <br> **input**: <pre><code>import korea_nlp -kn = korea_nlp.noun_extract() +kn = korea_nlp.Tokenizer() sentence = '김치헌은 바보다.' scores = {'김치헌':1.0} -kn.tokenize(sentence,scores) +kn.noun_extract(sentence,scores) </code></pre> <br> **output**: @@ -82,4 +81,37 @@ Score 값을 지정한 '김치헌'이라는 고유명사가 추출됨을 알 수 <br> 특정 'Noun' 갯수 측정 -- 추가예정 \ No newline at end of file +<br> + +**input**: +<pre><code>import korea_nlp +kn = korea_nlp.Tokenizer() +sentence = '김치헌은 김치를 좋아한다.' +scores = {} +word = "김치" +kn.noun_counter(sentence,scores,word) +</code></pre> +<br> +**output**: +<pre><code> 2 +</code></pre> + +Score 값을 따로 지정해주지 않아서 default 로 지정된 library 자체 data를 기반으로 문장을 token화하여 '김치' 라는 단어의 갯수를 Counting 하여 '2'가 출력됩니다. + +<br> +**input**: +<pre><code>import korea_nlp +kn = korea_nlp.Tokenizer() +sentence = '김치헌은 김치를 좋아한다.' +scores = {'김치헌':1.0} +word = "김치" +kn.noun_counter(sentence,scores,word) +</code></pre> +<br> +**output**: +<pre><code> 1 +</code></pre> + +Score에 '김치헌' 이라는 고유명사를 추출할 수 있도록 지정해주어 '김치' 라는 단어 counting 시 counting 되지 않습니다. +<br> +고유명사를 불필요하게 Counting 하는 경우를 배제합니다. \ No newline at end of file