Read Pinyin and Write Chinese Characters
Overview
Converts Chinese text to pinyin and generates a "Read Pinyin and Write Characters" practice-sheet PDF (including rice-grid squares). The conversion runs locally; see the installation instructions below for the CLI's default analytics and update-notification network requests and how to disable them.
bash
cyeam pinyin "你好世界" # Get the pinyin for each character
cyeam pinyin sheet "你好世界" # Generate a practice sheet (base64-encoded PDF)
cyeam pinyin sheet --out practice.pdf "你好世界" # Save the PDF to a file
PDF Mode Entry
You can also generate the same practice sheet from a file or stdin:
bash
printf '%s' '你好' | cyeam pdf --mode pinyin -o practice.pdf
cyeam pdf words.txt --mode pinyin -o practice.pdf
A4 portrait, with pinyin hints, blank rice-grid squares, and a correction area at the bottom. Spaces, line breaks, and punctuation separate phrases; long phrases are split automatically, long text is paginated automatically, and nothing is truncated. An error is returned when there are no Chinese characters. Chinese text in PDF mode requires an available Chinese font on the system; check polyphonic characters in context.
Installation
Read the commands below before installation. The example is pinned to v1.1.4 and does not follow latest; it downloads a binary archive. Execute it only when you need to install the CLI; do not repeat the installation every time you invoke a command.
macOS / Linux: Verify and Install to the User Directory
Run this in Bash or Zsh;
,
,
, and either
or
are required. The script automatically selects arm64 or x86_64 for macOS / Linux and stops on unsupported platforms.
bash
(
set -eu
version='v1.1.4'
case "$(uname -s)/$(uname -m)" in
Darwin/arm64)
asset='cyeam_Darwin_arm64.tar.gz'
sha256='06b5af004ab4f0f05d5829ea6bd18b97c4449c262af7df14c67175f7d3cb29db' ;;
Darwin/x86_64)
asset='cyeam_Darwin_x86_64.tar.gz'
sha256='107342bb9d2fa444b96155c468e71b8cc63e0f5ad0acc784698afe221548efa6' ;;
Linux/aarch64|Linux/arm64)
asset='cyeam_Linux_arm64.tar.gz'
sha256='ed87697f3948bead67b585e9881c3bef20e8d2d903beb5b125587281a5091c5b' ;;
Linux/x86_64)
asset='cyeam_Linux_x86_64.tar.gz'
sha256='873d6805fab8ab56540bb034aaf2f57f12eb672fcabd322ebe401e8250a5966d' ;;
*) echo 'Unsupported platform. Please check the pinned Release.' >&2; exit 1 ;;
esac
workdir=$(mktemp -d)
trap 'rm -rf "$workdir"' EXIT
cd "$workdir"
curl --fail --show-error --silent --location --proto '=https' --proto-redir '=https' \
--output "$asset" "https://github.com/mnhkahn/cyeam-cli/releases/download/$version/$asset"
printf '%s %s\n' "$sha256" "$asset" > expected.sha256
if command -v sha256sum >/dev/null 2>&1; then
sha256sum -c expected.sha256
else
shasum -a 256 -c expected.sha256
fi
# set -e ensures that the archive will not be extracted or installed if the download or checksum verification fails.
tar -xzf "$asset" cyeam
mkdir -p "$HOME/.local/bin"
install -m 0755 cyeam "$HOME/.local/bin/cyeam"
CYEAM_CLI_NO_UPDATE_NOTIFIER=1 "$HOME/.local/bin/cyeam" --no-analytics version
)
This writes only to a temporary directory and
(an existing executable with the same name will be replaced), requires no administrator privileges, and does not modify system directories, services, or shell configuration. To use it in the current shell:
bash
export PATH="$HOME/.local/bin:$PATH"
To make the change permanent, you can add the line above to your shell configuration. You can verify the checksum on the
v1.1.4 Release page and
checksums.txt. When upgrading to a pinned version, you must verify and replace the version number and corresponding SHA-256 at the same time. A checksum is used to verify the consistency of release artifacts; it is not equivalent to independent signing or a security audit.
External Requests and Permission Purposes
- Installation download: Downloads only the selected archive from the pinned GitHub Release; GitHub may redirect to its asset CDN. After downloading, it verifies the fixed SHA-256 specified in this document before extracting the single file. The installation check disables analytics and the update notifier.
- Pinyin and practice sheets: Uses a local dictionary and fonts to process user-specified text; it does not upload the text and requires no login. and PDF mode's write to the specified path, and existing files may be overwritten.
- Usage analytics: By default, sends command names, the CLI version, system information, and a random installation ID to . The service may determine the geographic region from the outgoing IP address; it does not send command arguments, image content, or login credentials. The random ID is stored in and can be disabled with or .
- Update notifier: By default, checks GitHub for the latest version at most once every 24 hours and caches the result in
~/.cyeam/update-state.json
; the notification itself does not replace the program. Set CYEAM_CLI_NO_UPDATE_NOTIFIER=1
to disable it. is an explicit upgrade command that downloads and verifies the latest Release, replaces the current program, and, on success, also attempts to synchronize skills via ; do not run it when you need to remain on a pinned version—install the selected version using the steps above.
To disable CLI analytics and update notifications (network requests made by the core functionality are unaffected), set the following in the current shell:
bash
export CYEAM_CLI_NO_ANALYTICS=1
export CYEAM_CLI_NO_UPDATE_NOTIFIER=1
Output
json
{"ok":true,"data":"{\"pinyin\":[{\"char\":\"你\",\"pinyin\":\"nǐ\"},{\"char\":\"好\",\"pinyin\":\"hǎo\"}]}"}
additionally includes a
field containing the base64-encoded PDF.
Notes
- Purely local generation using the go-pinyin library and gofpdf
- The embedded font is only 21 KB (), keeping the binary small
- The practice sheet includes rice-grid squares with diagonals, pinyin hints, and a correction area at the bottom
- Phrases separated by spaces are automatically wrapped onto new lines