File size: 5,542 Bytes
f1d5efc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
common:
  output_directory: local/opus

steps:
  # The quality of wikimatrix is really really bad for this pair: very poor alignment
  # - type: opus_read
  #   parameters:
  #     corpus_name: WikiMatrix
  #     source_language: br
  #     target_language: fr
  #     release: latest
  #     preprocessing: raw
  #     src_output: wiki.br.gz
  #     tgt_output: wiki.fr.gz
  
  # The quality of ccmatrix is really really bad for this pair: very few usable breton sentences
  # - type: opus_read
  #   parameters:
  #     corpus_name: MultiCCAligned
  #     source_language: br
  #     target_language: fr
  #     release: latest
  #     preprocessing: raw
  #     src_output: cc.br.gz
  #     tgt_output: cc.fr.gz

  - type: opus_read
    parameters:
      corpus_name: OfisPublik
      source_language: br
      target_language: fr
      release: latest
      preprocessing: raw
      src_output: ofis.br.gz
      tgt_output: ofis.fr.gz
      suppress_prompts: true

  - type: opus_read
    parameters:
      corpus_name: OpenSubtitles
      source_language: br
      target_language: fr
      release: latest
      preprocessing: raw
      src_output: ost.br.gz
      tgt_output: ost.fr.gz
      suppress_prompts: true

  - type: opus_read
    parameters:
      corpus_name: Tatoeba
      source_language: br
      target_language: fr
      release: latest
      preprocessing: raw
      src_output: tatoeba.br.gz
      tgt_output: tatoeba.fr.gz
      suppress_prompts: true

  # - type: opus_read
  #   parameters:
  #     corpus_name: wikimedia
  #     source_language: br
  #     target_language: fr
  #     release: latest
  #     preprocessing: raw
  #     src_output: wikimedia.br.gz
  #     tgt_output: wikimedia.fr.gz
  #     suppress_prompts: true

  # - type: opus_read
  #   parameters:
  #     corpus_name: Mozilla-I10n
  #     source_language: br
  #     target_language: fr
  #     release: latest
  #     preprocessing: raw
  #     src_output: mozilla.br.gz
  #     tgt_output: mozilla.fr.gz
  #     suppress_prompts: true

  # - type: opus_read
  #   parameters:
  #     corpus_name: KDE4
  #     source_language: br
  #     target_language: fr
  #     release: latest
  #     preprocessing: raw
  #     src_output: kde.br.gz
  #     tgt_output: kde.fr.gz
  #     suppress_prompts: true

  # - type: opus_read
  #   parameters:
  #     corpus_name: GNOME
  #     source_language: br
  #     target_language: fr
  #     release: latest
  #     preprocessing: raw
  #     src_output: gnome.br.gz
  #     tgt_output: gnome.fr.gz
  #     suppress_prompts: true

  - type: concatenate
    parameters:
      inputs:
      - ofis.br.gz
      - tatoeba.br.gz
      output: good.br.gz

  - type: concatenate
    parameters:
      inputs:
      - ofis.fr.gz
      - tatoeba.fr.gz
      output: good.fr.gz

  - type: concatenate
    parameters:
      inputs:
        # - wiki.br.gz
        # - cc.br.gz
        # - wikimedia.br.gz
        # - gnome.br.gz
        # - kde.br.gz
        # - mozilla.br.gz
        - ost.br.gz
      output: dubious.br.gz

  - type: concatenate
    parameters:
      inputs:
        # - wiki.fr.gz
        # - cc.fr.gz
        # - wikimedia.fr.gz
        # - gnome.fr.gz
        # - kde.fr.gz
        # - mozilla.fr.gz
        - ost.fr.gz
      output: dubious.fr.gz

  - type: concatenate
    parameters:
      inputs:
        - dubious.br.gz
        - good.br.gz
      output: align_train.br.gz

  - type: concatenate
    parameters:
      inputs:
        - dubious.fr.gz
        - good.fr.gz
      output: align_train.fr.gz

  - type: filter
    parameters:
      inputs:
        - align_train.br.gz
        - align_train.fr.gz
      outputs:
        - align_train-filtered.br.gz
        - align_train-filtered.fr.gz
      filters:
        - LengthFilter:
            unit: word
            min_length: 1
            max_length: 128

  - type: train_alignment
    parameters:
      src_data: align_train-filtered.br.gz
      tgt_data: align_train-filtered.fr.gz
      output: alignment.priors
      parameters: {}

# TODO: dedup and more agressive filtering
  - type: filter
    parameters:
      inputs:
        - dubious.br.gz
        - dubious.fr.gz
      outputs:
        - dubious-filtered.br.gz
        - dubious-filtered.fr.gz
      filters:
        - LengthFilter:
            unit: word
            min_length: 4
            max_length: 128
        - WordAlignFilter:
            priors: alignment.priors
  
  - type: concatenate
    parameters:
      inputs:
        - dubious-filtered.br.gz
        - good.br.gz
      output: all.br.gz

  - type: concatenate
    parameters:
      inputs:
        - dubious-filtered.fr.gz
        - good.fr.gz
      output: all.fr.gz

  # - type: remove_duplicates
  #   parameters:
  #     inputs:
  #       - all.br.gz
  #     outputs:
  #       - dedup.br.gz

  # - type: remove_duplicates
  #   parameters:
  #     inputs:
  #       - all.fr.gz
  #     outputs:
  #       - dedup.fr.gz

  - type: filter
    parameters:
      inputs:
        - all.br.gz
        - all.fr.gz
      outputs:
        - filtered.br.gz
        - filtered.fr.gz
      filters: &myfilters
        - LengthFilter:
            unit: word
            min_length: 1
            max_length: 128

        - LengthRatioFilter:
            unit: word
            threshold: 3

        - NonZeroNumeralsFilter: {}
        - AlphabetRatioFilter: {}
        - SimilarityFilter: {}
        - RepetitionFilter:
            threshold: 3
            min_length: 5
            max_length: 128