DewiBrynJones
commited on
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: mit
|
3 |
+
language:
|
4 |
+
- cy
|
5 |
+
---
|
6 |
+
# Priflythrennu Cymraeg // _Welsh Language Capitalization_
|
7 |
+
|
8 |
+
Dyma cydran syml a chyflym sydd yn priflythrennu geiriau o fewn destunau Cymraeg.
|
9 |
+
|
10 |
+
I'w ddefnyddio rhaid gosod [Sacremoses](https://pypi.org/project/sacremoses/)
|
11 |
+
|
12 |
+
```bash
|
13 |
+
$ pip install sacremoses
|
14 |
+
```
|
15 |
+
|
16 |
+
A'i defnyddio fel hyn...
|
17 |
+
|
18 |
+
```python
|
19 |
+
from sacremoses import MosesTruecaser
|
20 |
+
from huggingface_hub import hf_hub_download
|
21 |
+
|
22 |
+
tc_model_path = hf_hub_download(repo_id="DewiBrynJones/sacremoses-truecaser-cy", filename="tc.model")
|
23 |
+
mtr = MosesTruecaser(tc_model_path)
|
24 |
+
|
25 |
+
capitalized_str = mtr.truecase("mae pwllheli yn dref ym mhen llŷn", return_str=True)
|
26 |
+
print (capitalized_str)
|
27 |
+
|
28 |
+
Mae Pwllheli yn dref ym Mhen Llŷn
|
29 |
+
|
30 |
+
```
|