File size: 1,178 Bytes
af0817c
 
 
 
 
 
 
 
 
 
874d2b4
af0817c
 
 
 
0d2ab19
 
 
 
af0817c
 
 
 
 
 
179c270
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90dd267
179c270
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
---
dataset_info:
  features:
  - name: label
    dtype:
      class_label:
        names:
          '0': all-domains
          '1': it-domain
  - name: images
    list: image
  - name: text
    dtype: string
  splits:
  - name: train
    num_bytes: 115281378.25917527
    num_examples: 1585
  download_size: 114806537
  dataset_size: 115281378.25917527
configs:
- config_name: default
  data_files:
  - split: train
    path: data/train-*
---

Extracted lists of pages from PDF resumes and the PDF texts.

Created using this code:

```python
import io
import PIL.Image
from datasets import load_dataset

def render(pdf):
    images = []
    for page in pdf.pages:
        buffer = io.BytesIO()
        page.to_image(height=840).save(buffer)
        images.append(PIL.Image.open(buffer))
    return images

def extract_text(pdf):
    return "\n".join(page.extract_text() for page in pdf.pages)

ds = load_dataset("d4rk3r/resumes-raw-pdf", split="train")
ds = ds.map(lambda x: {
    "images": render(x["pdf"]),
    "text": extract_text(x["pdf"])
}, remove_columns=["pdf"])
ds = ds.filter(lambda x: len(x["text"].strip()) > 0)
ds.push_to_hub("lhoestq/resumes-raw-pdf-for-ocr")
```