Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tone detector #690

Merged
merged 13 commits into from
Aug 5, 2022
Merged

Add tone detector #690

merged 13 commits into from
Aug 5, 2022

Conversation

wannaphong
Copy link
Member

@wannaphong wannaphong commented Aug 2, 2022

This is tone detector for Thai syllables. It can output the tone.

I write by thai-language.com/ref/tone-rules documentation.

Fix #63

This is include

  • syllable_length - This function is use for find syllable's length. (long or short)
from pythainlp.util import sound_syllable

print(sound_syllable("มา"))
# output: live

print(sound_syllable("เลข"))
# output: dead
  • tone_detector - Thai tone detector for syllables
from pythainlp.util import tone_detector

print(tone_detector("มา"))
# output: m

print(tone_detector("ไม้"))
# output: h
  • syllable_open_close_detector - This function is use for find Thai syllable that open or closed sound.
from pythainlp.util import syllable_open_close_detector

print(syllable_open_close_detector("มาก"))
# output: close

print(syllable_open_close_detector("คะ"))
# output: open
  • thai_word_tone_detector - Thai tone detector for word.
from pythainlp.util import thai_word_tone_detector

print(thai_word_tone_detector("มือถือ"))
# output: [('มือ', 'm'), ('ถือ', 'r')]

print(thai_word_tone_detector("ราคา"))
# output: [('รา', 'm'), ('คา', 'm')]

Your checklist for this pull request

🚨Please review the guidelines for contributing to this repository.

  • Passed code styles and structures
  • Passed code linting checks and unit test

@pep8speaks
Copy link

pep8speaks commented Aug 2, 2022

Hello @wannaphong! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2022-08-05 13:32:03 UTC

@wannaphong wannaphong added this to the 3.1 milestone Aug 2, 2022
@coveralls
Copy link

coveralls commented Aug 2, 2022

Coverage Status

Coverage increased (+0.009%) to 95.549% when pulling 0f890c0 on add-tone-detector into 25fc1ee on dev.

@wannaphong wannaphong changed the title [WIP] Add tone detector Add tone detector Aug 2, 2022
@sonarcloud
Copy link

sonarcloud bot commented Aug 5, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 4 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@wannaphong wannaphong merged commit c6c8824 into dev Aug 5, 2022
This was referenced Aug 31, 2022
wannaphong added a commit that referenced this pull request Sep 1, 2022
See [3.1 Milestone](https://github.com/PyThaiNLP/pythainlp/milestone/16).

## What is new?
### Deprecation and other API changes
#687 Remove deprecated function
- pythainlp.word_vector; doesnt_match, get_model, most_similar_cosmul, sentence_vectorizer, similarity. use WordVector class instead
- pythainlp.util.delete_tone. use pythainlp.util.remove_tonemark instead
- Remove pythainlp.util.time_time. use pythainlp.util.time_to_thaiword instead
- pythainlp.tokenize.syllable_tokenize. use pythainlp.tokenize.subword_tokenize instead

### Name Entity Tagging
- #665 Add Thai-NNER `pythainlp.tag.NNER`
- #658 Add LST20NER onnx model. It is LST20NER model to onnx model from fine-turning by [WangchanBERTa model](https://huggingface.co/airesearch/wangchanberta-base-att-spm-uncased).

### Transliteration
- #659 Add ISO 11940 transliteration
- #660 Add Thai W2P v0.2
- #686 Add wunsen
- #694 Wunsen Mandarin and Japanese update

### PyThaiNLP Corpus downloader
- #656 Add support zip/tar.gz to download corpus

### Text normalization
- #673 Add a normalising rule for Lakkhangyao ๅ

### Translate
- #674 add gpu option

### Text summarize
- #679 Add mt5 cpe kmutt thai sentence sum

### Util
- #682 Add live-dead syllable classification
- #684 Add live dead syllable classify
- #690 Add tone detector

### Other
- #689 map NG tag to PART
- #691 Remove TinyDB as a dependency
- #692 Fix notifications that newer versions of corpora are available
@wannaphong wannaphong mentioned this pull request Sep 1, 2022
@wannaphong wannaphong deleted the add-tone-detector branch September 19, 2022 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tone detector for syllables - Determine Thai tone rule for syllable?
3 participants