Spaces:
Running
Running
Improvements
Browse files- app.py +2 -2
- modules/m_apvoice.py +3 -3
- modules/m_connector.py +1 -1
app.py
CHANGED
@@ -5,7 +5,7 @@ iface = gr.Blocks(css="container {max-width: 78%; margin: auto;}")
|
|
5 |
conn = Connector()
|
6 |
|
7 |
with iface:
|
8 |
-
gr.Markdown("<center><h5>Active to Passive Voice</h5></center>")
|
9 |
with gr.Row():
|
10 |
with gr.Column(scale=2):
|
11 |
in_sentence = gr.Textbox(
|
@@ -43,7 +43,7 @@ with iface:
|
|
43 |
)
|
44 |
|
45 |
iface.launch(
|
46 |
-
# server_port= 9090,
|
47 |
server_name = "0.0.0.0",
|
|
|
48 |
# share = True
|
49 |
)
|
|
|
5 |
conn = Connector()
|
6 |
|
7 |
with iface:
|
8 |
+
gr.Markdown("<center><h5>Active to Passive Voice (Beta)</h5></center>")
|
9 |
with gr.Row():
|
10 |
with gr.Column(scale=2):
|
11 |
in_sentence = gr.Textbox(
|
|
|
43 |
)
|
44 |
|
45 |
iface.launch(
|
|
|
46 |
server_name = "0.0.0.0",
|
47 |
+
# server_port= 9090,
|
48 |
# share = True
|
49 |
)
|
modules/m_apvoice.py
CHANGED
@@ -197,7 +197,7 @@ class APVoice:
|
|
197 |
active_sentence = active_sentence.strip()
|
198 |
if active_sentence == "":
|
199 |
raise RuntimeError(
|
200 |
-
f"Error: The sentence
|
201 |
)
|
202 |
|
203 |
subj_data, subj_str = self.get_subj(active_sentence)
|
@@ -242,7 +242,7 @@ class APVoice:
|
|
242 |
p_verb = self.verb2participle(main_data[0][0].text)
|
243 |
|
244 |
# Convert active_object to pasive_agent
|
245 |
-
p_agent = "
|
246 |
for tk,_,tag in subj_data:
|
247 |
word = tk.text
|
248 |
if tag == 'PRP':
|
@@ -253,6 +253,6 @@ class APVoice:
|
|
253 |
'subject': p_subj.capitalize(),
|
254 |
'tobe':p_tobe,
|
255 |
'participle': p_verb,
|
256 |
-
'agent': p_agent[0].lower() + p_agent[1:].strip(),
|
257 |
'complement':complement
|
258 |
}
|
|
|
197 |
active_sentence = active_sentence.strip()
|
198 |
if active_sentence == "":
|
199 |
raise RuntimeError(
|
200 |
+
f"Error: The sentence cannot be empty!"
|
201 |
)
|
202 |
|
203 |
subj_data, subj_str = self.get_subj(active_sentence)
|
|
|
242 |
p_verb = self.verb2participle(main_data[0][0].text)
|
243 |
|
244 |
# Convert active_object to pasive_agent
|
245 |
+
p_agent = ""
|
246 |
for tk,_,tag in subj_data:
|
247 |
word = tk.text
|
248 |
if tag == 'PRP':
|
|
|
253 |
'subject': p_subj.capitalize(),
|
254 |
'tobe':p_tobe,
|
255 |
'participle': p_verb,
|
256 |
+
'agent': 'by '+ p_agent[0].lower() + p_agent[1:].strip(),
|
257 |
'complement':complement
|
258 |
}
|
modules/m_connector.py
CHANGED
@@ -12,7 +12,7 @@ class Connector:
|
|
12 |
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
|
13 |
<center>{}</center>
|
14 |
"""
|
15 |
-
self.__error_template = "<center><
|
16 |
|
17 |
def create_category(
|
18 |
self,
|
|
|
12 |
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
|
13 |
<center>{}</center>
|
14 |
"""
|
15 |
+
self.__error_template = "<center><h2><b>{}</b></h2></center>"
|
16 |
|
17 |
def create_category(
|
18 |
self,
|