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.

Source Distribution

pinyin_utils-0.3.0.tar.gz (8.4 kB view hashes)

Uploaded Source

Built Distribution

pinyin_utils-0.3.0-py3-none-any.whl (9.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page