Update README.md
Browse files
README.md
CHANGED
@@ -60,6 +60,19 @@ files/jomleh-sp-32000-o5-prune01111.probing
|
|
60 |
4. Write your own code to instantiate a model and use it:
|
61 |
|
62 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
```
|
64 |
|
65 |
# What are the different files you can find in this repository?
|
|
|
60 |
4. Write your own code to instantiate a model and use it:
|
61 |
|
62 |
```
|
63 |
+
from model import KenlmModel
|
64 |
+
|
65 |
+
|
66 |
+
# Load a model
|
67 |
+
model = KenlmModel.from_pretrained("2000", "3", "011")
|
68 |
+
|
69 |
+
# Get perplexity
|
70 |
+
print(model.perplexity("من در را بستم"))
|
71 |
+
# Outputs: 67.6
|
72 |
+
|
73 |
+
# Get score
|
74 |
+
print(model.score("من در را بستم"))
|
75 |
+
# Outputs: -12.810975074768066
|
76 |
```
|
77 |
|
78 |
# What are the different files you can find in this repository?
|