Spaces:
Runtime error
Runtime error
Peter
commited on
Commit
•
d080a18
1
Parent(s):
146762d
update from basic sc
Browse files
app.py
CHANGED
@@ -124,7 +124,6 @@ def ask_gpt(
|
|
124 |
if basic_sc and not detect_propers(rawtxt):
|
125 |
cln_resp = symspeller(rawtxt, sym_checker=schnellspell)
|
126 |
elif not detect_propers(rawtxt):
|
127 |
-
cln_resp = neuspell_correct(rawtxt, checker=ns_checker)
|
128 |
cln_resp = synthesize_grammar(corrector=grammarbot, message=cln_resp)
|
129 |
else:
|
130 |
# no correction needed
|
@@ -165,7 +164,7 @@ def get_parser():
|
|
165 |
parser.add_argument(
|
166 |
"--basic-sc",
|
167 |
required=False,
|
168 |
-
default=
|
169 |
action="store_true",
|
170 |
help="turn on symspell (baseline) correction instead of the more advanced neural net models",
|
171 |
)
|
@@ -199,8 +198,7 @@ if __name__ == "__main__":
|
|
199 |
print("Using the baseline spellchecker")
|
200 |
schnellspell = build_symspell_obj()
|
201 |
else:
|
202 |
-
print("using
|
203 |
-
ns_checker = load_ns_checker(fast=False)
|
204 |
grammarbot = pipeline("'text2text-generation", gram_model, device=device)
|
205 |
|
206 |
print(f"using model stored here: \n {model_loc} \n")
|
|
|
124 |
if basic_sc and not detect_propers(rawtxt):
|
125 |
cln_resp = symspeller(rawtxt, sym_checker=schnellspell)
|
126 |
elif not detect_propers(rawtxt):
|
|
|
127 |
cln_resp = synthesize_grammar(corrector=grammarbot, message=cln_resp)
|
128 |
else:
|
129 |
# no correction needed
|
|
|
164 |
parser.add_argument(
|
165 |
"--basic-sc",
|
166 |
required=False,
|
167 |
+
default=False, # TODO: change this back to False once Neuspell issues are resolved.
|
168 |
action="store_true",
|
169 |
help="turn on symspell (baseline) correction instead of the more advanced neural net models",
|
170 |
)
|
|
|
198 |
print("Using the baseline spellchecker")
|
199 |
schnellspell = build_symspell_obj()
|
200 |
else:
|
201 |
+
print("using neural spell checker")
|
|
|
202 |
grammarbot = pipeline("'text2text-generation", gram_model, device=device)
|
203 |
|
204 |
print(f"using model stored here: \n {model_loc} \n")
|