Skip to main content

Utilities for handling Chinese pinyin

Project description

README.md

Utilities for handling Chinese pinyin

The utilities in this library make it easy to use Chinese pinyin

The unit tests are directly in the files and therefore serve as documentation of the utility functions in it. To execute the unit tests, you can just run:

pytest -s pinyin_utils.py

To get the library into a project:

pip install pinyin_utils

SYNOPSIS of pinyin_utils.py

coming soon

SYNOPSIS of translate.py

import os, time, trio, asks, pprint

from translate import translate, initDB, setApiKey

async def main():

	# --- The database need not exist.
	#     Furthermore, if you leave out this call,
	#     the database will be put at ./Translations.db by default
	initDB('./Translations.db')

	# --- This env var key is the default if you leave this out
	setApiKey(os.environ['GOOGLE_APIKEY'])

	hWords = {
		'cat': None,
		'dog': None,
		}

	start_time = time.time()
	async with trio.open_nursery() as nursery:
		nursery.start_soon(translate, hWords)
	total = time.time() - start_time
	print(f"Total time: {total}")

	pprint.PrettyPrinter(indent=3).pprint(hWords)

asks.init('trio')
trio.run(main)

# SYNOPSIS of tabdb.py

	coming soon

# SYNOPSIS of englishWords.py

	coming soon

# SYNOPSIS of ChineseDB.py

	coming soon

Project details


Download files

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

Files for pinyin-utils, version 0.3.0
Filename, size File type Python version Upload date Hashes
Filename, size pinyin_utils-0.3.0-py3-none-any.whl (9.3 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size pinyin_utils-0.3.0.tar.gz (8.4 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page