jeanflop commited on
Commit
ed4d88a
·
verified ·
1 Parent(s): 4e7f6d6

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +46 -0
README.md ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ task_categories:
4
+ - text2text-generation
5
+ language:
6
+ - fr
7
+ tags:
8
+ - postocr
9
+ - ocr
10
+ size_categories:
11
+ - 1M<n<10M
12
+ ---
13
+
14
+ # Synthetic OCR Correction Dataset
15
+ This dataset is a synthetic dataset generated for post-OCR correction tasks. It contains over 2,000,000 rows of French text pairs and follows the Croissant format. It is designed to train small language models (LLMs) for text correction.
16
+
17
+ ## Description
18
+ To ensure the dataset closely resembles OCR-malformed texts, we applied various transformations randomly. This approach helps avoid the LLM identifying specific patterns and encourages it to select the correct word based on the surrounding context. Below are some of the transformations applied:
19
+
20
+ ```bash
21
+
22
+ alterations = [
23
+ lambda x: re.sub(r'[aeiouAEIOU]', '', x), # Remove vowels
24
+ lambda x: re.sub(r'\s+', ' ', x), # Replace multiple spaces with a single space
25
+ lambda x: re.sub(r'\b\w\b', '', x), # Remove single letters
26
+ lambda x: re.sub(r'[^\w\s]', '', x), # Remove punctuation
27
+ lambda x: ''.join(random.choice((char, '')) for char in x), # Randomly drop characters
28
+ lambda x: ' '.join([
29
+ ''.join(random.sample(word, len(word))) if random.random() < X else word # Scramble words with X% probability
30
+ for word in x.split()
31
+ ]) # Randomly scramble words
32
+ ]
33
+
34
+ ```
35
+
36
+ In addition to the transformations listed above, we also modify punctuation, add words, and create repetitions. Feel free to customize these transformations as needed.
37
+
38
+ ## Recipe
39
+ Each word in the text has a 50% chance of being selected for alteration.
40
+ A random number of alterations is applied to the selected words.
41
+ In this release, between 10% and 50% of the words in each text can be altered.
42
+ We welcome community feedback to improve this dataset further. Please feel free to share your thoughts or suggestions!
43
+
44
+
45
+
46
+