KwabsHug commited on
Commit
24185ae
1 Parent(s): f174f81

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +38 -12
app.py CHANGED
@@ -239,8 +239,28 @@ def group_words(inlist):
239
  current_group_time += 10
240
 
241
  yield " ".join(word_groups[current_group_index])
242
- time.sleep(10)
243
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
244
 
245
  groupinput_text = gr.inputs.Textbox(lines=2, label="Enter a list of words")
246
  groupoutput_text = gr.outputs.Textbox(label="Grouped words")
@@ -290,16 +310,22 @@ with gr.Blocks() as lliface:
290
  gr.Interface.load("spaces/RASMUS/Whisper-youtube-crosslingual-subtitles", title="Subtitles")
291
  with gr.Tab("Advanced - LingQ Addons ideas"):
292
  gr.HTML("Extra functions needed - Persitent Sentence translation, UNWFWO, POS tagging and Word Count per user of words in their account. Macaronic Text is also another way to practice only the important information")
293
- with gr.Row():
294
- RomanFile = gr.File(label="Paste Roman")
295
- W4WFile = gr.File(label="Paste Word 4 Word")
296
- FullMeanFile = gr.File(label="Paste Full Meaning")
297
- MacaronicFile = gr.File(label="Paste Macaronic Text")
298
- with gr.Row():
299
- MergeButton = gr.Button()
300
- with gr.Row():
301
- MergeOutput = gr.TextArea(label="Output")
302
- MergeButton.click(merge_lines, inputs=[RomanFile, W4WFile, FullMeanFile, MacaronicFile], outputs=[MergeOutput])
 
 
 
 
 
 
303
  with gr.Tab("Dictionary from text"):
304
  gr.Interface(fn=create_dictionary, inputs="text", outputs="text", title="Two Letter Dictionary")
305
 
 
239
  current_group_time += 10
240
 
241
  yield " ".join(word_groups[current_group_index])
242
+ time.sleep(10)
243
+
244
+ def split_verbs_nouns(text):
245
+ nlp = spacy.load("en_core_web_sm")
246
+ doc = nlp(text)
247
+
248
+ verbs_nouns = []
249
+ other_words = []
250
+
251
+ for token in doc:
252
+ if token.pos_ in ["VERB", "NOUN"]:
253
+ verbs_nouns.append(token.text)
254
+ elif token.text in [punct.text for punct in doc if punct.is_punct]:
255
+ verbs_nouns.append(token.text)
256
+ other_words.append(token.text)
257
+ else:
258
+ other_words.append(token.text)
259
+
260
+ verbs_nouns_text = " ".join(verbs_nouns)
261
+ other_words_text = " ".join(other_words)
262
+
263
+ return verbs_nouns_text, other_words_text
264
 
265
  groupinput_text = gr.inputs.Textbox(lines=2, label="Enter a list of words")
266
  groupoutput_text = gr.outputs.Textbox(label="Grouped words")
 
310
  gr.Interface.load("spaces/RASMUS/Whisper-youtube-crosslingual-subtitles", title="Subtitles")
311
  with gr.Tab("Advanced - LingQ Addons ideas"):
312
  gr.HTML("Extra functions needed - Persitent Sentence translation, UNWFWO, POS tagging and Word Count per user of words in their account. Macaronic Text is also another way to practice only the important information")
313
+ with gr.Tab("Merged Subtitles"):
314
+ gr.Text("Put the SRT Conversion functions here")
315
+ with gr.Row():
316
+ RomanFile = gr.File(label="Paste Roman")
317
+ W4WFile = gr.File(label="Paste Word 4 Word")
318
+ FullMeanFile = gr.File(label="Paste Full Meaning")
319
+ MacaronicFile = gr.File(label="Paste Macaronic Text")
320
+ SentGramFormula = gr.File(label="Paste Sentence Grammar Formula Text")
321
+ with gr.Row():
322
+ MergeButton = gr.Button()
323
+ with gr.Row():
324
+ MergeOutput = gr.TextArea(label="Output")
325
+ MergeButton.click(merge_lines, inputs=[RomanFile, W4WFile, FullMeanFile, MacaronicFile], outputs=[MergeOutput])
326
+ with gr.Tab("Sentence to Format"):
327
+ gr.Interface(fn=split_verbs_nouns , inputs="text", outputs=["text", "text"], title="Comprehension reading and Sentence Format Creator")
328
+ gr.Text("Text to Closed Class + Adjectives + Punctuation or Noun Verb + Punctuation ")
329
  with gr.Tab("Dictionary from text"):
330
  gr.Interface(fn=create_dictionary, inputs="text", outputs="text", title="Two Letter Dictionary")
331