Beracles commited on
Commit
3818a89
·
1 Parent(s): f950953

normalize nlp_command

Browse files
Files changed (2) hide show
  1. app.py +2 -0
  2. str_util.py +5 -0
app.py CHANGED
@@ -9,6 +9,7 @@ import app_util
9
  from pgsoft.pgconst.const import service_list, functionality_list, game_list
10
  from pgsoft.pgdate.date_utils import beijing
11
  import call_ai
 
12
 
13
  #######################
14
  # proxy version
@@ -52,6 +53,7 @@ def run(hf_token, service, game, functionality, nlp_command):
52
  space = redirect
53
  url = f"https://{space}.hf.space"
54
 
 
55
  if token is None or token == "":
56
  return "please specify hf token"
57
 
 
9
  from pgsoft.pgconst.const import service_list, functionality_list, game_list
10
  from pgsoft.pgdate.date_utils import beijing
11
  import call_ai
12
+ from str_util import normalize_text
13
 
14
  #######################
15
  # proxy version
 
53
  space = redirect
54
  url = f"https://{space}.hf.space"
55
 
56
+ nlp_command = normalize_text(nlp_command)
57
  if token is None or token == "":
58
  return "please specify hf token"
59
 
str_util.py ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ def normalize_text(text: str) -> str:
2
+ text = text.lower()
3
+ tmp = text.split(" ")
4
+ tmp = [word for word in tmp if word != ""]
5
+ return " ".join(tmp)