An explainable politeness styler for the Korean Language
Project description
Politely
Politely is an explainable politeness styler for the Korean language (work in progress) |
---|
Quick Start ๐
1๏ธโฃ setup politely
Install politely
directly from github
pip3 install git+https://github.com/eubinecto/politely.git@v2.6.1
politely
heavily relies on khaiii
for morpheme analysis. Install khaiii
, as instructed in the official document
git clone https://github.com/kakao/khaiii.git
mkdir khaiii/build
cmake khaiii
make package_python
pip3 install package_python/.
2๏ธโฃ Speak politely
with Styler
from politely import Styler
styler = Styler()
print(styler("๋ ๋ด ๋ชฉํ๋ฅผ ํฅํด ๋ฌ๋ ค.", 2)) # casual -> polite
print(styler("๋ ๋ด ๋ชฉํ๋ฅผ ํฅํด ๋ฌ๋ ค.", 3)) # casual -> formal
print(styler("์ ์ ๋ชฉํ๋ฅผ ํฅํด ๋ฌ๋ ค์.", 1)) # polite -> casual
print(styler("์ ์ ๋ชฉํ๋ฅผ ํฅํด ๋ฌ๋ ค์.", 3)) # polite -> formal
์ ์ ๋ชฉํ๋ฅผ ํฅํด ๋ฌ๋ ค์.
์ ์ ๋ชฉํ๋ฅผ ํฅํด ๋ฌ๋ฆฝ๋๋ค.
๋ ๋ด ๋ชฉํ๋ฅผ ํฅํด ๋ฌ๋ ค.
์ ์ ๋ชฉํ๋ฅผ ํฅํด ๋ฌ๋ฆฝ๋๋ค.
print(styler("์ค๋์ด ์ด์ ๋ณด๋ค ๋์.", 2)) # casual -> polite
print(styler("์ค๋์ด ์ด์ ๋ณด๋ค ๋์.", 3)) # casual -> formal
print(styler("์ค๋์ด ์ด์ ๋ณด๋ค ๋์์.", 1)) # polite -> casual
print(styler("์ค๋์ด ์ด์ ๋ณด๋ค ๋์์.", 3)) # polite -> formal
์ค๋์ด ์ด์ ๋ณด๋ค ๋์์.
์ค๋์ด ์ด์ ๋ณด๋ค ๋ฅ์ต๋๋ค.
์ค๋์ด ์ด์ ๋ณด๋ค ๋์.
์ค๋์ด ์ด์ ๋ณด๋ค ๋ฅ์ต๋๋ค.
Coverage ๐
We have test-covered, and will test-cover, the following cases. Please feel free to contribute if you feel like you could cover more of these cases.
- -ใด๋์
- -๊ฒ
- -์ด
- -์ด์ผ
- -๋ง
- -๋ด
- -๋?
- -์ด?
- -์์ด?
- -๋?
- ๋๋ชจ์ ํ๋ฝ
- ใท ๋ถ๊ท์น
- ใ ๋ถ๊ท์น
- ใ ๋ถ๊ท์น
- ์ค ๋ถ๊ท์น
- ๊ฐ๋ผ ๋ถ๊ท์น
- ๋๋ผ ๋ถ๊ท์น
- ์ผ ๋ถ๊ท์น
- ๋ฅด ๋ถ๊ท์น
- ์ฐ ๋ถ๊ท์น
- ใ ๋ถ๊ท์น
- ... (more to be added)
Hosting the interactive demo
You can either host the interactive demo locally (you first have to sign up for papago API to get your secrets)
export NAVER_CLIENT_ID = ...
export NAVER_CLIENT_SECRET = ...
# host the demo via streamlit
streamlit run main_deploy.py
Or just visit the demo we are hosting for you |
---|
What Politely can't ๐
politely
's Styler
cannnot take contexts into account because its conjugation algorithm is fundamentally rule-based. The algorithm is nothing but a chain of glorified if-else's. As a consequence of this, Styler
can't disambiguate context-dependent conjugations, like so:
# ๊ถ์ / ์ฒญ์ ์ ์ฐจ์ด๋ ๋งฅ๋ฝ์ ์์กด
print(styler("์ ๋ ์ฐ๋ ๊ธฐ๋ฅผ ์ฃผ์์.", 3))
print(styler("์, ๊ฐ์ด ์ฐ๋ ๊ธฐ๋ฅผ ์ฃผ์์.", 3))
์ ๋ ์ฐ๋ ๊ธฐ๋ฅผ ์ค์ต๋๋ค.
์, ๊ฐ์ด ์ฐ๋ ๊ธฐ๋ฅผ ์ค์ต๋๋ค. (should be "์, ๊ฐ์ด ์ฐ๋ ๊ธฐ๋ฅผ ์ฃผ์์๋ค")
# ์ด๋ฅด + ์ด -> ์ด๋ฅด๋ฌ/์ผ๋ฌ ๋ํ ๋งฅ๋ฝ์ ์์กด
print(styler("ํ์ง ๋ง๋ผ๊ณ ์ผ๋ ๋ค.", 3))
print(styler("์ ์์ ์ด๋ฅด๋ ๋ค.", 3))
ํ์ง ๋ง๋ผ๊ณ ์ผ๋ ์ต๋๋ค.
์ ์์ ์ผ๋ ์ต๋๋ค. (should be "์ ์์ ์ด๋ฅด๋ ์ต๋๋ค")
By whom? ๐
- funded by: Faculty of Oriental Studies at the University of Oxford
- led & developed by: Jieun Kiaer (Associate Professor of Korean Language and Linguistics at the University of Oxford)
- co-developed by: Research assistant Eu-Bin KIM (Msc. in Applied Linguistics at the University of Oxford, Bsc. in AI at the University of Manchester )
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.