diff --git a/.gitignore b/.gitignore index bd5f7e2..7c5ce4a 100644 --- a/.gitignore +++ b/.gitignore @@ -119,4 +119,7 @@ dmypy.json .pyre/ # automatic document build file -docs/_site \ No newline at end of file +docs/_site + +#idea +.idea/ \ No newline at end of file diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 73f69e0..0000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml -# Editor-based HTTP Client requests -/httpRequests/ diff --git a/.idea/aws.xml b/.idea/aws.xml deleted file mode 100644 index 99de319..0000000 --- a/.idea/aws.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml deleted file mode 100644 index 03d9549..0000000 --- a/.idea/inspectionProfiles/Project_Default.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml deleted file mode 100644 index 105ce2d..0000000 --- a/.idea/inspectionProfiles/profiles_settings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index 8161a60..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 11066dd..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/pyjosa.iml b/.idea/pyjosa.iml deleted file mode 100644 index b7077a5..0000000 --- a/.idea/pyjosa.iml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 94a25f7..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git "a/docs/1_\354\204\244\354\271\230/README.md" "b/docs/1_\354\204\244\354\271\230/README.md" index 3f48323..bc1b6d6 100644 --- "a/docs/1_\354\204\244\354\271\230/README.md" +++ "b/docs/1_\354\204\244\354\271\230/README.md" @@ -1,3 +1,21 @@ # 설치 방법 -설치 방법에 대해서 소개합니다. +## pip install + +1. pip를 이용하여 설치하는 방법 (pip command) + +```console +pip install pyjosa +``` + +2. pip를 이용하여 설치하는 방법 (python3 command) + +```console +python3 -m pip install pyjosa +``` + +3. 최신 버전 설치 방법(업데이트) + +```console +python3 -m pip install pyjosa -U +``` diff --git "a/docs/1_\354\204\244\354\271\230/install.md" "b/docs/1_\354\204\244\354\271\230/install.md" deleted file mode 100644 index e38f212..0000000 --- "a/docs/1_\354\204\244\354\271\230/install.md" +++ /dev/null @@ -1,13 +0,0 @@ -# pip install - -1. pip를 이용하여 설치하는 방법 (pip command) - -```console -pip install pyjosa -``` - -2. pip를 이용하여 설치하는 방법 (python3 command) - -```console -python3 -m pip install pyjosa -``` diff --git "a/docs/2_\354\230\210\354\240\234/README.md" "b/docs/2_\354\230\210\354\240\234/README.md" index ddb8be2..9501d0b 100644 --- "a/docs/2_\354\230\210\354\240\234/README.md" +++ "b/docs/2_\354\230\210\354\240\234/README.md" @@ -1,3 +1,49 @@ -# 사용 예시 +# 간단한 사용 방법 -사용 예시에 대해 소개합니다. \ No newline at end of file +```python +from pyjosa.josa import Josa + +print(Josa.get_josa("철수", "은")) # 는 +print(Josa.get_josa("오리", "을")) # 를 +print(Josa.get_josa("닭", "는")) # 은 +print(Josa.get_josa("산", "으로")) # 으로 +print(Josa.get_josa("명예", "과")) # 와 +print(Josa.get_josa("물", "나")) # 이나 +# 사람 이름 + 이가/가 를 구분하기 위해서는 조사부분에 '이가'를 입력합니다. +print(Josa.get_josa("예나", "이가")) # 가 +print(Josa.get_josa("세환", "이가")) # 이가 + +print(Josa.get_full_string("철수", "은")) # 철수는 +print(Josa.get_full_string("오리", "을")) # 오리를 +print(Josa.get_full_string("닭", "는")) # 닭은 +print(Josa.get_full_string("산", "으로")) # 산으로 +print(Josa.get_full_string("명예", "과")) # 명예와 +print(Josa.get_full_string("물", "나")) # 물이나 +# 사람 이름 + 이가/가 를 구분하기 위해서는 조사부분에 '이가'를 입력합니다. +print(Josa.get_full_string("예나", "이가")) # 예나가 +print(Josa.get_full_string("세환", "이가")) # 세환이가 +``` + +# 유용한 사용 방법 + +```python +from pyjosa.josa import Josa + +subject = '철수' +obj = '산' + +full_string = f'{Josa.get_full_string(subject, "은")} {Josa.get_full_string(obj, "를")} 간다' + +print(full_string) # 철수는 산을 오른다 +``` + +```python +from pyjosa.josa import Josa + +subjects = ['철수', '세환', '길동'] +obj = ['산', '바다', '집'] + +for i, v in enumerate(subjects): + print(f'{Josa.get_full_string(v, "은")} {Josa.get_full_string(obj[i], "를")} 간다') + +``` \ No newline at end of file diff --git "a/docs/2_\354\230\210\354\240\234/example1.md" "b/docs/2_\354\230\210\354\240\234/example1.md" deleted file mode 100644 index 980e7e5..0000000 --- "a/docs/2_\354\230\210\354\240\234/example1.md" +++ /dev/null @@ -1,25 +0,0 @@ -# 간단한 사용 방법 - -```python -from pyjosa.josa import Josa - -print(Josa.get_josa("철수", "은")) # 는 -print(Josa.get_josa("오리", "을")) # 를 -print(Josa.get_josa("닭", "는")) # 은 -print(Josa.get_josa("산", "으로")) # 으로 -print(Josa.get_josa("명예", "과")) # 와 -print(Josa.get_josa("물", "나")) # 이나 -# 사람 이름 + 이가/가 를 구분하기 위해서는 조사부분에 '이가'를 입력합니다. -print(Josa.get_josa("예나", "이가")) # 가 -print(Josa.get_josa("세환", "이가")) # 이가 - -print(Josa.get_full_string("철수", "은")) # 철수는 -print(Josa.get_full_string("오리", "을")) # 오리를 -print(Josa.get_full_string("닭", "는")) # 닭은 -print(Josa.get_full_string("산", "으로")) # 산으로 -print(Josa.get_full_string("명예", "과")) # 명예와 -print(Josa.get_full_string("물", "나")) # 물이나 -# 사람 이름 + 이가/가 를 구분하기 위해서는 조사부분에 '이가'를 입력합니다. -print(Josa.get_full_string("예나", "이가")) # 예나가 -print(Josa.get_full_string("세환", "이가")) # 세환이가 -``` \ No newline at end of file diff --git "a/docs/2_\354\230\210\354\240\234/example2.md" "b/docs/2_\354\230\210\354\240\234/example2.md" deleted file mode 100644 index 2e60b28..0000000 --- "a/docs/2_\354\230\210\354\240\234/example2.md" +++ /dev/null @@ -1,23 +0,0 @@ -# 유용한 사용 방법 - -```python -from pyjosa.josa import Josa - -subject = '철수' -obj = '산' - -full_string = f'{Josa.get_full_string(subject, "은")} {Josa.get_full_string(obj, "를")} 간다' - -print(full_string) # 철수는 산을 오른다 -``` - -```python -from pyjosa.josa import Josa - -subjects = ['철수', '세환', '길동'] -obj = ['산', '바다', '집'] - -for i, v in enumerate(subjects): - print(f'{Josa.get_full_string(v, "은")} {Josa.get_full_string(obj[i], "를")} 간다') - -``` \ No newline at end of file diff --git a/pyjosa/josa.py b/pyjosa/josa.py index e720c05..77669c1 100644 --- a/pyjosa/josa.py +++ b/pyjosa/josa.py @@ -1,7 +1,6 @@ from pyjosa.jonsung import Jongsung from pyjosa.exceptions import JosaTypeException - class Josa: @staticmethod @@ -38,38 +37,16 @@ def get_josa(string: str, josa: str) -> str: else: raise JosaTypeException - @staticmethod - def get_full_string(string: str, josa: str) -> str: + @classmethod + def get_full_string(cls, string: str, josa: str) -> str: """ 단어 뒤에 조사를 붙여서 반환하는 정적 메서드 :param string: 입력받는 한글 단어 :param josa: 체크하고자 하는 조사 :return: 단어와 조사를 붙인 문자열을 반환 """ - if (josa == '을') or (josa == '를'): - return string + '을' if Jongsung.has_jongsung(string) else string + '를' - elif (josa == '은') or (josa == '는'): - return string + '은' if Jongsung.has_jongsung(string) else string + '는' - elif (josa == '이') or (josa == '가'): - return string + '이' if Jongsung.has_jongsung(string) else string + '가' - elif (josa == '과') or (josa == '와'): - return string + '과' if Jongsung.has_jongsung(string) else string + '와' - elif (josa == '이나') or (josa == '나'): - return string + '이나' if Jongsung.has_jongsung(string) else string + '나' - elif (josa == '으로') or (josa == '로'): - return string + '으로' if Jongsung.has_jongsung(string) else string + '로' - elif (josa == '아') or (josa == '야'): - return string + '아' if Jongsung.has_jongsung(string) else string + '야' - elif (josa == '이랑') or (josa == '랑'): - return string + '이랑' if Jongsung.has_jongsung(string) else string + '랑' - elif (josa == '이며') or (josa == '며'): - return string + '이며' if Jongsung.has_jongsung(string) else string + '며' - elif (josa == '이다') or (josa == '다'): - return string + '이다' if Jongsung.has_jongsung(string) else string + '다' - elif josa == '이가': - return string + '이가' if Jongsung.has_jongsung(string) else string + '가' - else: - raise JosaTypeException + return string + cls.get_josa(string, josa) + # TODO : Refactor pyjosa's architecture with oop. # TODO : need to remove duplicated codes with 'if ... elif...' (refactor) diff --git a/setup.py b/setup.py index 96bbcee..eac6c68 100644 --- a/setup.py +++ b/setup.py @@ -1,19 +1,19 @@ -from setuptools import setup, find_packages +from setuptools import setup, find_packages setup( - name = 'pyjosa', - version = '1.0.2', - description = '한국어 조사 처리 패키지', - author = 'sehwan.kim', - author_email = 'sehwan.kim@ingkle.com', - url = 'https://github.com/kimsehwan96/pyjosa', - packages = find_packages(exclude=[]), + name='pyjosa', + version='1.0.3', + description='한국어 조사 처리 패키지', + author='sehwan.kim', + author_email='sehwan.kim@ingkle.com', + url='https://github.com/kimsehwan96/pyjosa', + packages=find_packages(exclude=[]), license='MIT', install_requires=[], classifiers=[ 'Programming Language :: Python :: 3.7' ], - package_data = {}, + package_data={}, zip_safe=False, - keyword = ['pypi', 'korea'], -) \ No newline at end of file + keyword=['pypi', 'korea'], +)