mannus commited on
Commit
0f6649e
·
1 Parent(s): 42496cc
Files changed (1) hide show
  1. app.py +9 -1
app.py CHANGED
@@ -15,7 +15,15 @@ class InputText(BaseModel):
15
  async def segment_text(payload: InputText):
16
  text = payload.text
17
  result = nlp(text)
18
- return result
 
 
 
 
 
 
 
 
19
 
20
  @app.get("/")
21
  def greet_json():
 
15
  async def segment_text(payload: InputText):
16
  text = payload.text
17
  result = nlp(text)
18
+ output = ""
19
+ for e in result:
20
+ if "##" in e["word"]:
21
+ output += e["word"].replace("##", "")
22
+ elif e["entity"] == "I":
23
+ output += "_" + e["word"]
24
+ else:
25
+ output += " " + e["word"]
26
+ return {"segmented_text": output.strip()}
27
 
28
  @app.get("/")
29
  def greet_json():