A program that generates a look-up chart for the game Chinese Idiom Solitaire.
Idiom Solitaire is a classic game among Chinese speakers. In this game, players take turns to come up with an four-character idiom that starts with the last (forth) character of the last player's idiom. This first player that fails to come up with one loses (and have to take a shot of spirit -- at least this was how I learned the game when I was 8 years old).
How is that a game? There are ~50,000 four-character idioms in the Chinese language (at least in the dictionary that I'm using in this repo), each of which start with one of ~3,500 unique characters. Thus, each round of game may end up with an unique path of idioms presented.
Technical details: The chart will be in PDF format, generated by graphviz
, and is a direct graph. Notice that the graph might not be connected (in the graph-theory sense).
- Create a conda environment with the required packages:
conda create --name idiom --file conda-requirements.txt
conda activate idiom
- Run this command to retrieve a list of idioms:
curl https://raw.githubusercontent.com/fighting41love/funNLP/master/data/%E6%88%90%E8%AF%AD%E8%AF%8D%E5%BA%93/ChengYu_Corpus%EF%BC%885W%EF%BC%89.txt > idioms.txt
- Run the main script:
python main.py generate
- IdiomGraph: Implemented with
neo4j
. - Chinese-Idiom-Solitaire