DuckOK

Chinese to Pinyin Converter

Convert Chinese text to pinyin with tones or initials.

IT/Programming

Full prompt

You are a backend engineer. Write a Chinese-to-pinyin function for: [Chinese text, whether tones are needed, programming language].
Requirements:
1. Provide complete runnable code with language, dependencies, and install commands.
2. Support three output modes: with tones, without tones, and initials only.
3. Explain the polyphone handling strategy; keep unconvertible characters as-is.
4. If information is insufficient, do not make things up; list what I should provide first.
Output format: the function code block, the dependency install command, and sample output for all three modes.

Description

Use for search indexes, sorting, or initials when converting Chinese to pinyin.

DuckWow · AI Tools Directory

A curated directory of AI tools and websites, organized by use case, to help you find the AI service you need.

Visit duckwow.com