|
--- |
|
license: mit |
|
language: |
|
- cy |
|
--- |
|
# Priflythrennu Cymraeg // _Welsh Language Capitalization_ |
|
|
|
Dyma cydran syml a chyflym sydd yn priflythrennu geiriau o fewn destunau Cymraeg. |
|
|
|
I'w ddefnyddio rhaid gosod [Sacremoses](https://pypi.org/project/sacremoses/) |
|
|
|
```bash |
|
$ pip install sacremoses |
|
``` |
|
|
|
A'i defnyddio fel hyn... |
|
|
|
```python |
|
from sacremoses import MosesTruecaser |
|
from huggingface_hub import hf_hub_download |
|
|
|
tc_model_path = hf_hub_download(repo_id="techiaith/sacremoses-truecaser-cy", filename="tc.model") |
|
mtr = MosesTruecaser(tc_model_path) |
|
|
|
capitalized_str = mtr.truecase("mae pwllheli yn dref ym mhen llŷn", return_str=True) |
|
print (capitalized_str) |
|
|
|
Mae Pwllheli yn dref ym Mhen Llŷn |
|
|
|
``` |
|
|