Example #1
0
 def test_iter_pages(self):
     pdf_file = os.path.join(RESOURCE_ROOT, 'CSE_Result.pdf')
     for i, page in enumerate(
             ggsipu_result.iter_pages(pdf_file, verbose=True)):
         with open(
                 os.path.join(RESOURCE_ROOT, 'CSE_Result',
                              str(i + 1) + '.txt'), 'r') as txtf:
             self.assertEqual(txtf.read(), page)
def get_2018_result(pdf):
    results = {}
    for page in iter_pages(pdf):
        if has_page_results(page):
            results.update(
                {r.roll_num: r
                 for r in iter_results(page) if r.batch == 2018})
    return results
Example #3
0
from ggsipu_result import iter_pages, iter_results, has_page_results

FILE = "document1.pdf"

cgpa = []

for page in iter_pages(FILE):
    if has_page_results(page):
        for res in iter_results(page):
            # Filtered for specific batch
            if res.batch == 2018:
                cgpa.append(res.cgpa)

avg_cgpa = sum(i for i in cgpa) / len(cgpa)
print(avg_cgpa)
import ggsipu_result

FILE = "document1.pdf"

with open('subj_dump.json', 'a') as fs, open('res_dump.json', 'a') as fr:
    for page in ggsipu_result.iter_pages(FILE):
        if ggsipu_result.has_page_results(page):
            results = list(ggsipu_result.iter_results(page))
            fr.write(ggsipu_result.toJSON(results))
        elif ggsipu_result.has_page_subejcts(page):
            subjects = list(ggsipu_result.iter_subjects(page))
            fs.write(ggsipu_result.toJSON(subjects))
Example #5
0
from ggsipu_result import iter_pages

FILE = 'document1.pdf'

for i, page in enumerate(iter_pages(FILE)):
    with open(str(i + 1) + ".txt") as f:
        f.write(page)