hyw 0.1.1

Querying embeddings for hyw
Documentation

hyw - 合义维

GitHub License GitHub Workflow Status GitHub Release GitHub Downloads (all assets, all releases) Crates.io Version Crates.io Total Downloads docs.rs

穷举排列组 ,寻找最接近的语 于上千 度中。

ℹ️ Introduction

hyw Combination & hyw Sequence

A valid hyw combination consists of three characters, with the pinyin for each character being he, yi and wei. To systematically cover all possibilities, we can generate all possible hyw combinations through permutations. The hyw sequence is defined as the ordered list of all hyw combinations. For detailed implementation and character set, you can refer to hyw-base crate.

hyw (合义维)

hyw (合义维) is a CLI tool designed to explore the hyw sequence. It can:

  • List the entire hyw sequence (list)
  • Query given hyw combinations' indices in the hyw sequence and vice versa (query)
  • Search the closest hyw sequence to input in terms of semantics (search)

This project is heavily inspired by Liu Cixin's science fiction novel "Poetry Cloud"[^1] and BV1c3PuewEmu[^2].

📥 Installation

Using binstall

cargo binstall hyw

Downloading from Releases

Navigate to the Releases page and download respective binary for your platform. Make sure to give it execute permissions.

Compiling from Source

cargo install hyw

📊 Embedding Data

You can download pre-computed data from this Release, or generate one via the hyw-embed crate.

📖 Usage

Usage: hyw [<action>] [-k <api-key>] [-m <map-path>]

合义维

Positional Arguments:
  action            the action to take, can be 'list'/'l', 'query'/'q' or
                    'search'/'s' (default)

Options:
  -k, --api-key     key for SiliconFlow API, required for search, using
                    environment variable SILICONFLOW_API_KEY if not provided
  -m, --map-path    path to the embedding map file, default is "./hyw.postcard"
  -h, --help        display usage information

Note that the api key is only required for "search" action. If you don't have one, simply create an account and get one from their API keys page. Their embedding API is free to use.

💡 Examples

$ hyw -k sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Loading embedding map from ../data/hyw.postcard
Embedding map has been loaded!

Enter search query (or press Enter to exit): 电流的原理
#1: 荷移为 (Distance: 1.1049)
#2: 荷移位 (Distance: 1.1298)
#3: 荷易位 (Distance: 1.1337)
#4: 詥移帏 (Distance: 1.1353)
#5: 翯移磈 (Distance: 1.1353)

Enter search query (or press Enter to exit): 长江中飘散着臭味
#1: 河异味 (Distance: 0.8056)
#2: 嗬异味 (Distance: 0.9125)
#3: 翯异味 (Distance: 0.9142)
#4: 翮异味 (Distance: 0.9142)
#5: 菏异味 (Distance: 0.9147)

Enter search query (or press Enter to exit): 花凋零了
#1: 荷已萎 (Distance: 0.9007)
#2: 荷矣萎 (Distance: 0.9700)
#3: 呵已萎 (Distance: 0.9754)
#4: 荷已微 (Distance: 0.9954)
#5: 荷亦萎 (Distance: 0.9985)

Enter search query (or press Enter to exit): 下巴脱臼
#1: 颌易位 (Distance: 0.9067)
#2: 颌移位 (Distance: 0.9143)
#3: 颌异位 (Distance: 0.9153)
#4: 颌已萎 (Distance: 0.9544)
#5: 颌逸萎 (Distance: 0.9582)

Enter search query (or press Enter to exit):
Exiting. Goodbye!

🔗 References

[^1]: 刘慈欣. 诗云[J]. 科幻世界, 2003(3). [^2]: 害怕的狗XGGGGGGGG258. 这是我个人的一小步,却是CCB的一大步[EB/OL]. Bilibili, (2025-02-22)[2026-01-01]. https://www.bilibili.com/video/BV1c3PuewEmu