49 lines
789 B
Python
49 lines
789 B
Python
import os
|
|
import pdftotext
|
|
|
|
def process_jpg(f):
|
|
pass
|
|
|
|
def process_pdf(f):
|
|
pdf = pdftotext.PDF(f)
|
|
aggregate = "\n\n".join(pdf)
|
|
return aggregate
|
|
|
|
def process_docx(f):
|
|
pass
|
|
|
|
def process_file(f):
|
|
# TODO proper file format distinguishing, not only by suffix?
|
|
_, ext = os.path.splitext(f.filename)
|
|
print(ext)
|
|
if ext == '.jpg':
|
|
return process_jpg(f)
|
|
elif ext == '.pdf':
|
|
return process_pdf(f)
|
|
elif ext == '.docx':
|
|
return process_docx(f)
|
|
|
|
|
|
|
|
def validate_court(lawsuit):
|
|
pass
|
|
|
|
def validate_accuser(lawsuit):
|
|
pass
|
|
|
|
# hard to implement
|
|
def validate_topic():
|
|
pass
|
|
|
|
# also hard to implement
|
|
def validate_intent():
|
|
pass
|
|
|
|
def validate_signature():
|
|
pass
|
|
|
|
def validate_date():
|
|
pass
|
|
|
|
def validate(text):
|
|
pass |