Spaces:
Build error
Build error
santoshtyss
commited on
Commit
·
27675c8
1
Parent(s):
e2b7024
Update app.py
Browse files
app.py
CHANGED
@@ -192,7 +192,7 @@ def docx_replace(doc, data):
|
|
192 |
#print(p.text)
|
193 |
break
|
194 |
|
195 |
-
input_output_trans = {"NON-DISCLOSURE
|
196 |
|
197 |
|
198 |
def translate_fill(document_name,output_file, src, trg):
|
@@ -374,7 +374,7 @@ def run_contract_extraction(document_name, output_file):
|
|
374 |
|
375 |
return output_file
|
376 |
|
377 |
-
input_output_key = {"NON-DISCLOSURE
|
378 |
|
379 |
def run_key_clause(document_name, output_name,source_language):
|
380 |
doc = docx.Document(document_name)
|
@@ -480,7 +480,7 @@ def extract_questions(document_name, output_file):
|
|
480 |
|
481 |
return output_file
|
482 |
|
483 |
-
input_output_qg = {"NON-DISCLOSURE
|
484 |
|
485 |
|
486 |
def run_generate_questions(document_name, output_file, questions_file, delimiter, source_language):
|
@@ -507,7 +507,7 @@ from docx.shared import RGBColor
|
|
507 |
import time
|
508 |
import re
|
509 |
|
510 |
-
input_output_red = {"NON-DISCLOSURE
|
511 |
|
512 |
def run_redflags(filename, output_file):
|
513 |
print("Red flags")
|
@@ -518,7 +518,7 @@ def run_redflags(filename, output_file):
|
|
518 |
for para in doc.paragraphs:
|
519 |
inline = para.runs
|
520 |
colour = False
|
521 |
-
if (len(para.text.split())>
|
522 |
colour = True
|
523 |
if colour:
|
524 |
for i in range(len(inline)):
|
@@ -587,7 +587,7 @@ def extract_info(questions, context):
|
|
587 |
variables.append({"{{"+question+"}}" : answer})
|
588 |
return variables, unanswered
|
589 |
|
590 |
-
input_output_exin = {"
|
591 |
|
592 |
def run_extract_info(document_name, context, output_file, source_language):
|
593 |
print("Extract")
|
@@ -712,7 +712,8 @@ def get_similar_clauses(filename, output_file,clauses, source_language):
|
|
712 |
return output_file, highlighted_paras
|
713 |
|
714 |
|
715 |
-
input_output_similar = {"NON-DISCLOSURE
|
|
|
716 |
def get_highlighted_clauses(filename):
|
717 |
doc = docx.Document(filename)
|
718 |
para_highlighted = []
|
|
|
192 |
#print(p.text)
|
193 |
break
|
194 |
|
195 |
+
input_output_trans = {"NON-DISCLOSURE AGREEMENT":{"hindi":"NON-DISCLOSURE hindi.docx","telugu":"NON-DISCLOSURE telugu.docx"}}
|
196 |
|
197 |
|
198 |
def translate_fill(document_name,output_file, src, trg):
|
|
|
374 |
|
375 |
return output_file
|
376 |
|
377 |
+
input_output_key = {"NON-DISCLOSURE AGREEMENT":"NON-DISCLOSURE key_clauses.txt"}
|
378 |
|
379 |
def run_key_clause(document_name, output_name,source_language):
|
380 |
doc = docx.Document(document_name)
|
|
|
480 |
|
481 |
return output_file
|
482 |
|
483 |
+
input_output_qg = {"NON-DISCLOSURE AGREEMENT":"NON-DISCLOSURE QG.docx"}
|
484 |
|
485 |
|
486 |
def run_generate_questions(document_name, output_file, questions_file, delimiter, source_language):
|
|
|
507 |
import time
|
508 |
import re
|
509 |
|
510 |
+
input_output_red = {"NON-DISCLOSURE AGREEMENT":"NON-DISCLOSURE red flag.docx"}
|
511 |
|
512 |
def run_redflags(filename, output_file):
|
513 |
print("Red flags")
|
|
|
518 |
for para in doc.paragraphs:
|
519 |
inline = para.runs
|
520 |
colour = False
|
521 |
+
if (len(para.text.split())>10) and random.random()>0.5 and para.paragraph_format.left_indent!=None:
|
522 |
colour = True
|
523 |
if colour:
|
524 |
for i in range(len(inline)):
|
|
|
587 |
variables.append({"{{"+question+"}}" : answer})
|
588 |
return variables, unanswered
|
589 |
|
590 |
+
input_output_exin = {"NON-DISCLOSURE AGREEMENT":"NON-DISCLOSURE Info.docx"}
|
591 |
|
592 |
def run_extract_info(document_name, context, output_file, source_language):
|
593 |
print("Extract")
|
|
|
712 |
return output_file, highlighted_paras
|
713 |
|
714 |
|
715 |
+
input_output_similar = {"NON-DISCLOSURE AGREEMENT":[{"clauses":["procedure when information needs to be revealed to third person"], "file":"NON-DISCLOSURE 1.docx"},{"clauses":["term","validity period","time period","duration"], "file":"NON-DISCLOSURE 2.docx"}], "dummy.docx":[{"clauses":["lets see","whatever"],"file":"dummy_colored.docx"}]}
|
716 |
+
|
717 |
def get_highlighted_clauses(filename):
|
718 |
doc = docx.Document(filename)
|
719 |
para_highlighted = []
|