Skip to main content

끝말잇기 package for python

Project description

korean-word-relay

끝말잇기 package for python

  • 한국어 낱말 게임 끝말잇기를 쉽게 커스터마이징 할 수 있는 패키지
  • 모델이 사용할 끝말잇기 단어 직접 선택 (난이도 조절 가능)
  • 두음법칙 적용 (여부 선택)
  • 이전 단어와 이어지지 않거나 이미 나왔던 단어 입력시 패배

Installation

Using pip:

pip install korean-word-relay

Usage

Quick Start

from korean_word_relay import WordRelay

word_relay = WordRelay()
word_relay.play()

result

--------------끝말잇기----------------
시작 단어: 파이썬
<< 썬샤인
>> 인간
<< 간택
>> 택시
<< 시리
>> 리그
<< 그대
>> 대략
<< 약관
>> 관람
<< 람보
>> 보도
<< 도로묵
------------------------------
no word to answer
YOU WIN!

Default optional parameter

word_relay = WordRelay(import_default=True, words_path=None, use_dueum=True, debug_print=True):
)
  • import_default(boolean): If True, import candidates of korean words from '자주 쓰이는 한국어 낱말 모음 5800'
  • words_path(None|string): If given path(.txt), import candidates of words list from txt file
  • use_dueum(boolean): If True, 두음법칙 is allowed
  • debug_print(boolean): If True, print warning message on console

Example format for words_path

words_path should be None or list of korean words in txt extension. For instance, word_list.txt should be

사랑
우정
믿음
.
.
여자친구

If you want to make game much difficult, get killing_words.txt from here.


Methods of WordRelay

word_relay = WordRelay()

# 주어진 낱말에 이어지는 단어 리턴
# set log_history=False if you don't want to add word in history
next_word = word_relay.get_next('성질') # next_word is None or 질X (예: 질문)

# 두 낱말이 이어지는지 여부 체크
is_continue = word_relay.check_continue('질문', '문지기') # is_continue == True

# 특정 낱말을 이미 나온말(history)에 추가
word_relay.add_history('문지기')
print(word_relay.history) # word_relay.history = ['질문', '문지기'], 질문 was added get_next above

# history 를 초기화
word_relay.reset()
print(word_relay.history) # word_relay.history = []

etc

Checking whether word is valid or not is not implemented in this project, since 1. criteria for valid language is keep changing, 2. including korean dictionary can make this package too big. You can implement your own code to check whether word is valid or not.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

korean_word_relay-0.0.6-py3-none-any.whl (18.8 kB view details)

Uploaded Python 3

File details

Details for the file korean_word_relay-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: korean_word_relay-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 18.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.4.2 requests/2.23.0 setuptools/49.3.1 requests-toolbelt/0.8.0 tqdm/4.48.2 CPython/3.8.10

File hashes

Hashes for korean_word_relay-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 3d95f01f25110782b29cb71301bb879624177197d669d3c08410ea9a89bfb222
MD5 51fa237fa5515ed55c6f341f3073b929
BLAKE2b-256 49069e2c11131e9163caa53c9ccff2574636c3b581b7bd134d051ecaa83b9054

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