Peter
commited on
Commit
•
6ab8466
1
Parent(s):
69955b6
🚸 add test script
Browse filesSigned-off-by: Peter <[email protected]>
test.py
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""
|
2 |
+
|
3 |
+
test.py is a test script for the module.
|
4 |
+
|
5 |
+
"""
|
6 |
+
# %%
|
7 |
+
|
8 |
+
from neuspell import BertChecker
|
9 |
+
|
10 |
+
checker = BertChecker()
|
11 |
+
checker.from_pretrained(".")
|
12 |
+
# %%
|
13 |
+
|
14 |
+
test1 = "I luk foward to receving your reply"
|
15 |
+
test1_result = checker.correct(test1) # correct a string
|
16 |
+
|
17 |
+
print(f"Original: {test1}", f"Corrected: {test1_result}", sep="\t")
|
18 |
+
|
19 |
+
test2 = [test1, "were did wendigo goe boating?", "I am a good at math"]
|
20 |
+
test2_result = checker.correct_strings(test2) # correct a list of strings
|
21 |
+
print(f"Original: {test1}", f"Corrected: {test2_result}", sep="\t")
|
22 |
+
|
23 |
+
|
24 |
+
# %%
|