Git Product home page Git Product logo

zhhk2ipa's Introduction

zhhk2ipa

Convert Hong Kong Chinese sentences to the International Phonetic Alphabet (IPA).

Introduction

The zhhk2ipa project provides tools to convert text from Hong Kong Chinese into the International Phonetic Alphabet (IPA). It supports phrase-level and word-level transcription based on a comprehensive vocabulary table.

Installation

Install the required dependencies by running:

pip install -r requirements.txt

Usage

To use zhhk2ipa, follow these steps:

import zhhk2ipa

# Load the vocabulary table
zhhk2ipa.init("data/zhhk_ipa.txt")

# Convert text to IPA
output = zhhk2ipa.convert("同朕check吓")
print(output)

output = zhhk2ipa.convert("返屋企,樂而忘返。")
print(output)

Example Output

[('同', ['tʰʊŋ˨˩']), ('朕', ['tsɐm˨']), ('check吓', ['tsʰɛ:k˥', 'ha:˩˧'])]
[('返屋企', ['fa:n˥', 'ŋʊk˥', 'kʰei˧˥']), (',', ','), ('樂而忘返', ['lɔ:k˨', 'ji:˨˩', 'mɔ:ŋ˨˩', 'fa:n˧˥']), ('。', '。')]

Handling Tokens Not in Vocabulary

If a token is not in the vocabulary table, it will be marked as None in the output:

output = zhhk2ipa.convert("我ABCD你")
print(output)
[('我', ['ŋɔ:˩˧']), ('A', None), ('B', ['pi:˥']), ('C', None), ('D', None), ('你', ['nei˩˧'])]

Disclaimer

Reliability and Testing

Please note that the functionality of this software has been tested with a limited number of test cases. While preliminary results are promising, the reliability across diverse and extensive datasets has not been fully established. Users are encouraged to conduct their own tests and report any issues or discrepancies they encounter. This will assist in improving the tool and extending its reliability for broader usage.

Credits

The vocabulary for zhhk2ipa is adapted from data provided by lotusfa/IPA-Translator with additional entries included for broader coverage.

zhhk2ipa's People

Contributors

r5dwmg avatar

Stargazers

Joseph Cheng avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.