Commit
·
11a1eff
1
Parent(s):
cc816c5
added library sample
Browse files
README.md
CHANGED
|
@@ -28,14 +28,46 @@ This multilanguage model was trained on the [Europarl Dataset](https://huggingfa
|
|
| 28 |
|
| 29 |
The model restores the following punctuation markers: **"." "," "?" "-" ":"**
|
| 30 |
## Sample Code
|
|
|
|
| 31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
```python
|
| 33 |
-
from
|
| 34 |
|
| 35 |
-
|
| 36 |
-
|
|
|
|
|
|
|
| 37 |
```
|
| 38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
|
| 40 |
## Results
|
| 41 |
|
|
|
|
| 28 |
|
| 29 |
The model restores the following punctuation markers: **"." "," "?" "-" ":"**
|
| 30 |
## Sample Code
|
| 31 |
+
We provide a simple python package that allows you to process text of any length.
|
| 32 |
|
| 33 |
+
## Install
|
| 34 |
+
|
| 35 |
+
To get started install the package from [pypi](https://pypi.org/project/deepmultilingualpunctuation/):
|
| 36 |
+
|
| 37 |
+
```bash
|
| 38 |
+
pip install deepmultilingualpunctuation
|
| 39 |
+
```
|
| 40 |
+
### Restore Punctuation
|
| 41 |
```python
|
| 42 |
+
from deepmultilingualpunctuation import PunctuationModel
|
| 43 |
|
| 44 |
+
model = PunctuationModel()
|
| 45 |
+
text = "My name is Clara and I live in Berkeley California Ist das eine Frage Frau Müller"
|
| 46 |
+
result = model.restore_punctuation(text)
|
| 47 |
+
print(result)
|
| 48 |
```
|
| 49 |
|
| 50 |
+
**output**
|
| 51 |
+
> My name is Clara and I live in Berkeley, California. Ist das eine Frage, Frau Müller?
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
### Predict Labels
|
| 55 |
+
```python
|
| 56 |
+
from deepmultilingualpunctuation import PunctuationModel
|
| 57 |
+
|
| 58 |
+
model = PunctuationModel()
|
| 59 |
+
text = "My name is Clara and I live in Berkeley California Ist das eine Frage Frau Müller"
|
| 60 |
+
clean_text = model.preprocess(text)
|
| 61 |
+
labled_words = model.predict(clean_text)
|
| 62 |
+
print(labled_words)
|
| 63 |
+
```
|
| 64 |
+
|
| 65 |
+
**output**
|
| 66 |
+
|
| 67 |
+
> [['My', '0', 0.9999887], ['name', '0', 0.99998665], ['is', '0', 0.9998579], ['Clara', '0', 0.6752215], ['and', '0', 0.99990904], ['I', '0', 0.9999877], ['live', '0', 0.9999839], ['in', '0', 0.9999515], ['Berkeley', ',', 0.99800044], ['California', '.', 0.99534047], ['Ist', '0', 0.99998784], ['das', '0', 0.99999154], ['eine', '0', 0.9999918], ['Frage', ',', 0.99622655], ['Frau', '0', 0.9999889], ['Müller', '?', 0.99863917]]
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
|
| 71 |
|
| 72 |
## Results
|
| 73 |
|