Skip to content

Commit

Permalink
Merge pull request #30 from kimsehwan96/master
Browse files Browse the repository at this point in the history
release v1.0.3
  • Loading branch information
kimsehwan96 authored Jul 6, 2021
2 parents 4ec448e + f852afb commit 779e6a8
Show file tree
Hide file tree
Showing 16 changed files with 86 additions and 166 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,7 @@ dmypy.json
.pyre/

# automatic document build file
docs/_site
docs/_site

#idea
.idea/
8 changes: 0 additions & 8 deletions .idea/.gitignore

This file was deleted.

17 changes: 0 additions & 17 deletions .idea/aws.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/inspectionProfiles/Project_Default.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/inspectionProfiles/profiles_settings.xml

This file was deleted.

4 changes: 0 additions & 4 deletions .idea/misc.xml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/modules.xml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/pyjosa.iml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

20 changes: 19 additions & 1 deletion docs/1_설치/README.md
Original file line number Diff line number Diff line change
@@ -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
```
13 changes: 0 additions & 13 deletions docs/1_설치/install.md

This file was deleted.

50 changes: 48 additions & 2 deletions docs/2_예제/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,49 @@
# 사용 예시
# 간단한 사용 방법

사용 예시에 대해 소개합니다.
```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], "")} 간다')

```
25 changes: 0 additions & 25 deletions docs/2_예제/example1.md

This file was deleted.

23 changes: 0 additions & 23 deletions docs/2_예제/example2.md

This file was deleted.

31 changes: 4 additions & 27 deletions pyjosa/josa.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from pyjosa.jonsung import Jongsung
from pyjosa.exceptions import JosaTypeException


class Josa:

@staticmethod
Expand Down Expand Up @@ -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)
22 changes: 11 additions & 11 deletions setup.py
Original file line number Diff line number Diff line change
@@ -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'],
)
keyword=['pypi', 'korea'],
)

0 comments on commit 779e6a8

Please sign in to comment.