Skip to main content

An explainable politeness styler for the Korean Language

Project description

Politely

Open in Streamlit Open In Colab Hits

Politely is an explainable politeness styler for the Korean language (work in progress)
image

Quick Start ๐Ÿš€

1๏ธโƒฃ Install politely

pip3 install politely

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
image

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

politely-2.7.0a0.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

politely-2.7.0a0-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file politely-2.7.0a0.tar.gz.

File metadata

  • Download URL: politely-2.7.0a0.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.23.0

File hashes

Hashes for politely-2.7.0a0.tar.gz
Algorithm Hash digest
SHA256 2942fb60a992ee4eb45125613052bb95a8d02479e68670bd8be1b12367b06e09
MD5 a63ac90a8fb85b625b285371a98869b9
BLAKE2b-256 d9f32a904e99e89afe9a9bc492be7c92af55d600b35f11ebde76068be4edc5cc

See more details on using hashes here.

File details

Details for the file politely-2.7.0a0-py3-none-any.whl.

File metadata

  • Download URL: politely-2.7.0a0-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.23.0

File hashes

Hashes for politely-2.7.0a0-py3-none-any.whl
Algorithm Hash digest
SHA256 383364b5491006073ed73b12ae629e43cce3d3b9c95cb0715e181d4ade5b708b
MD5 503cba2c900f5a02d77ea8a5b6934cb9
BLAKE2b-256 d8d73d7e4c2214911a8640e178cde6333bd3f6142984c4766849dfd6ecc893b0

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page