• No results found

Filtering of Noisy Parallel Corpora Based on Hypothesis Generation

N/A
N/A
Protected

Academic year: 2020

Share "Filtering of Noisy Parallel Corpora Based on Hypothesis Generation"

Copied!
7
0
0

Loading.... (view fulltext now)

Full text

(1)

000

001

002

003

004

005

006

007

008

009

010

011

012

013

014

015

016

017

018

019

020

021

022

023

024

025

026

027

028

029

030

031

032

033

034

035

036

037

038

039

040

041

042

043

044

045

046

047

048

049

050

051

052

053

054

055

056

057

058

059

060

061

062

063

064

065

066

067

068

069

070

071

072

073

074

075

076

077

078

079

080

081

082

083

084

085

086

087

088

089

090

091

092

093

094

095

096

097

098

099

Filtering of Noisy Parallel Corpora Based on Hypothesis Generation

Zuzanna Parcheta1 Germ´an Sanchis-Trilles1

1Sciling S.L.,Carrer del Riu 321, Pinedo, 46012, Spain

{zparcheta, gsanchis}@sciling.com

2PRHLT Research Center, Camino de Vera s/n, 46022 Valencia, Spain

[email protected]

Francisco Casacuberta2

Abstract

The filtering task of noisy parallel corpora in WMT2019 aims to challenge participants to create filtering methods to be useful for train-ing machine translation systems. In this work, we introduce a noisy parallel corpora filter-ing system based on generatfilter-ing hypotheses by means of a translation model. We train trans-lation models in both language pairs: Nepali– English and Sinhala–English using provided parallel corpora. To create the best possible translation model, we first join all provided parallel corpora (Nepali, Sinhala and Hindi to English) and after that, we applied bilingual cross-entropy selection for both language pairs (Nepali–English and Sinhala–English). Once the translation models are trained, we trans-late the noisy corpora and generate a hypoth-esis for each sentence pair. We compute the smoothed BLEU score between the target sen-tence and generated hypothesis. In addition, we apply several rules to discard very noisy or inadequate sentences which can lower the translation score. These heuristics are based on sentence length, source and target similar-ity and source language detection. We com-pare our results with the baseline published on the shared task website, which uses the Zip-porah model, over which we achieve signifi-cant improvements in one of the conditions in the shared task. The designed filtering system is domain independent and all experiments are conducted using neural machine translation.

1 Introduction

A large amount of parallel corpora can be ex-tracted using web-crawling. This technique of data acquisition is very useful to increase the train-ing set for low-resourced languages. Unfortu-nately, the extracted data can include noisy sen-tence pairs, such as unaligned sensen-tences, partially translated pairs, or sentences containing different languages than those intended. For these reasons

the creation of systems for filtering of noisy paral-lel corpora are needed.

In this paper, we introduce a filtering method for noisy parallel corpora based mainly on generating hypotheses for each sentence pair from noisy data and scoring based on hypothesis and target sen-tence similarity. This technique consists of build-ing the best possible translation engine for each language pair and generating a translation hypoth-esis for each sentence of the noisy data. Once the hypotheses are generated, we compute the BLEU (Papineni et al., 2002), smoothed by adding one to both numerator and denominator from (Lin and Och, 2004), between each target and hypothesis. To create a translation engine, which will be used for generating hypothesis for each sentence from noisy corpus, we select sentence pairs using bilin-gual cross-entropy selection (Axelrod et al.,2011) from all parallel corpora provided (Nepali, Sin-hala, Hindi to English) jointly. To apply bilingual cross-entropy, we first train language models using the provided monolingual corpora in Nepali, Sin-hala and English. In addition, we use some rules to discard useless sentences by filtering according to sentence length, Nepali and Sinhala characters detection, and BLEU scoring between source and target sentences. The last rule is used to discard highly similar sentence pairs.

(2)

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 2 WMT 2019 shared task on parallel

corpus filtering for low-resource conditions

The task “Parallel Corpus Filtering for Low-Resource Conditions”1 tackles the problem of cleaning noisy parallel corpora for low-resourced language pairs. Given a noisy parallel corpus, par-ticipants are required to develop methods to fil-ter it down to a smaller size with a high qual-ity subset. This year there are two language pairs: Nepali–English and Sinhala–English. Par-ticipants are asked to provide score files for each sentence in each of the noisy parallel sets. The scores will be used to subsample sentence pairs into two different training set sizes: 1 million and 5 million English words. For this task, very noisy corpora of 40.6 million English words in Nepali–English and 59.6 million English words in Sinhala–English are provided. The data were crawled from the web as part of the Paracrawl project2. The quality of the resulting subsets is determined by the quality of a statistical machine translation (SMT) and neural machine translation (NMT) systems trained on this data. The qual-ity of the machine translation system is measured with the sacreBLEU score (Post,2018) on a held-out test set of Wikipedia translations for Nepali-English (ne–en) and Sinhala-Nepali-English (si–en). The organisers provide development and test sets for each pair of languages but due to the fact that the task addresses the challenge of data quality and not domain-relatedness of the data for a particular use case, the test sets may be very different from the final official test set in terms of topics.

2.1 Data provided

Organisers provide noisy corpora for the Nepali– English and Sinhala–English language pairs. The main figures of both corpora are shown in Table1. In addition, organisers provide links to the permissible third-party sources of bilingual data to be used in the competition. Parallel cor-pora for the Nepali–English language pair comes from the Bible, Global Voices, Penn Tree Bank, GNOME/KDE/Ubuntu and Nepali Dictionary cor-pora. For the Sinhala–English language pair, the Open Subtitles and GNOME/KDE/Ubuntu paral-lel corpora are provided. The main figures of the

1

http://www.statmt.org/wmt19/parallel-corpus-filtering.html

[image:2.595.311.522.156.242.2]

2https://paracrawl.eu/

Table 1: Main figures of the noisy corpora for the Nepali–English and Sinhala–English language pairs. k denotes thousands of elements and M denotes millions of elements. |S|stands for number of sentences,|W| for number of running words, and|V|for vocabulary size. Figures computed on tokenised and lowercased corpora.

corpus language |S| |W| |V|

ne–en Nepali 2.2M 52.3M 925.3k

English 56.0M 782.9k

si–en Sinhala 3.6M 61.2M 822.6k

English 62.6M 803.0k

[image:2.595.313.519.371.456.2]

parallel corpora are shown in Table2.

Table 2: Allowed parallel corpora for Nepali–English and Sinhala–English main figures. k denotes thousands of elements and M denotes millions of elements. |S| stands for number of sentences,|W|for number of run-ning words, and|V|for vocabulary size. Figures com-puted on tokenised and lowercased corpora.

corpus language |S| |W| |V|

ne–en Nepali 573k 4.2M 141.3k

English 4.5M 64.5k

si–en Sinhala 692k 4.5M 178.5k

English 5.0M 69.9k

In addition to the parallel data above, mono-lingual corpora are also provided. The main fig-ures of the monolingual corpora for Nepali, Sin-hala and English are shown in Table3.

Table 3: Main figures of the monolingual data for Nepali, Sinhala and English languages. k denotes thou-sands of elements and M denotes millions of elements. |S|stands for number of sentences,|W|for number of running words, and|V| for vocabulary size. Figures computed on tokenised and lowercased corpora.

language |S| |W| |V|

Nepali 3.7M 116.1M 1.4M

Sinhala 5.3M 43.2M 766.7k English 448.2M 760.2M 9.6M

Additional resources provided in the shared task were a Hindi–English (hi–en) parallel corpus and Hindi monolingual data. The main figures of these two corpora are shown in Table4.

[image:2.595.320.510.618.683.2]
(3)

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

249

250

251

252

253

254

255

256

257

258

259

260

261

262

263

264

265

266

267

268

269

270

271

272

273

274

275

276

277

278

279

280

281

282

283

284

285

286

287

288

289

290

291

292

293

294

295

296

297

298

[image:3.595.84.281.421.615.2]

299 Table 4: Main figures of the monolingual (mono.) data

for Hindi and bilingual data for Hindi–English (hi–en). k denotes thousands of elements and M denotes mil-lions of elements. |S|stands for number of sentences, |W|for number of running words, and|V|for vocab-ulary size. Figures computed on tokenised and lower-cased corpora.

corpus lang. |S| |W| |V|

mono. Hindi 45.1M 838.8k 4.0M

hi–en Hindi 1.6M 22.4M 333.3k

English 20.7M 192.5k

are provided in the shared task. Both sets are drawn from Wikipedia articles. These may be very different from the final official test set in terms of topics due to the fact that the task addresses the challenge of data quality and not domain-relatedness of the data. Main figures of develop-ment sets are shown in Table5.

Table 5: Development sets main figures. k denotes thousands of elements. |S|stands for number of sen-tences,|W|for number of running words, and|V|for vocabulary size. Figures computed on tokenised and lowercased corpora.

Validation sets

corpus lang. |S| |W| |V|

ne–en Nepali 2.6k 10.2k 37.1k

English 37.1k 10.2k

si–en Sinhala 2.9k 48.7k 103.3k

English 53.5k 6.2k

Test sets

corpus lang. |S| |W| |V|

ne–en Nepali 2.8k 43.2k 10.9k

English 51.5k 6.4k

si–en Sinhala 2.8k 46.4k 9.6k

English 51.0k 6.1k

2.2 Sub-sampling of noisy data

Participants submit files with numerical scores, giving one score per line for the original unfiltered parallel corpus. A tool provided by the organisers takes as input the scores and the noisy parallel cor-pus. The tool then selects sentences with higher scores to complete the desired 1M and 5M words in target. Systems trained on these data sets are used for evaluation by the organisers.

2.3 Translation evaluation

As specified in the shared task, the evaluation of a selected subset of sentences is done using SMT and NMT. The SMT system is implemented using Moses (Koehn et al.,2007) and the NMT system is built using the FAIRseq (Ott et al.,2019) toolkit. Organisers provided scripts which allow for im-plementing the same translation system which will be used in the final evaluation. However, we only conducted experiments using NMT. The FAIRseq system tokenises source and target sentences and applies BPE (Sennrich et al., 2016). The tokeni-sation of Nepali, Sinhala and Hindi sentences is done using the Indic NLP Library3. The system (Guzm´an et al., 2019) uses a Transformer archi-tecture with 5 encoder and 5 decoder layers, where the number of attention heads, embedding dimen-sion and inner-layer dimendimen-sion are 2, 512 and 2048, respectively. The model is regularised with dropout, label smoothing and weight decay. The model is optimised with Adam (Kingma and Ba,

2014) usingβ1= 0.9,β2 = 0.98, and= 1e−8.

The learning rate is fixed tolr= 1e3, as described in (Ott et al.,2019). The NMT system from the shared task is trained for 100 epochs and mod-els are saved every 10 epochs. The best model is chosen according to validation set loss function value. The script which allowed us to reproduce the network used in the shared task can be found at https://github.com/facebookresearch/flores. All experiments were performed using NVidia Titan Xp GPUs.

3 System description

In this section, the entire process of sentence scor-ing is detailed.

Our process for scoring noisy corpora is as fol-lows:

1. We apply bilingual cross-entropy selection (described in3.1.1) to select the best set of sentences from Nepali, Sinhala and Hindi to English jointly for each language pair: Nepali–English and Sinhala–English.

2. We train an NMT engine using the above se-lected data for each language pair.

3. Once the NMT engine is trained, we generate a hypothesis for each sentence in the noisy corpus.

(4)

300

301

302

303

304

305

306

307

308

309

310

311

312

313

314

315

316

317

318

319

320

321

322

323

324

325

326

327

328

329

330

331

332

333

334

335

336

337

338

339

340

341

342

343

344

345

346

347

348

349

350

351

352

353

354

355

356

357

358

359

360

361

362

363

364

365

366

367

368

369

370

371

372

373

374

375

376

377

378

379

380

381

382

383

384

385

386

387

388

389

390

391

392

393

394

395

396

397

398

399 4. We then compute smoothed BLEU for each

target sentence in the noisy corpus, along with its corresponding hypothesis. These computed BLEU scores will be used for the selection of the required subsets of 1M and 5M words of English tokens for the final eval-uation.

5. Additionally, we apply a few rules (described in 3.3) to discard some sentences which are considered useless, by replacing their smoothed BLEU score to zero, effectively avoiding that the selection algorithm includes such sentences into the selected subsets.

3.1 Translation engine

The main core of the scoring process is hypothesis generation using a well-trained translation model. To create the translation model we used the NMT system from the shared task and we selected sen-tences from all provided bilingual corpora in all three language pairs jointly: Nepali, Sinhala and Hindi to English. To select the subset of sentences to train the translation model we used the bilin-gual cross-entropy selection method (Moore and Lewis,2010) described in the next subsection.

3.1.1 Bilingual Cross-Entropy selection

We ranked sentences from all bilingual corpora by their perplexity score according to a language model trained on the monolingual corpora in Nepali, Sinhala and English. The perplexity ppl

of a strings with empirical ngram distributionp

given a language modelqis:

ppl(s) = 2−Px∈sp(x)log q(x)= 2H(p,q) (1)

whereH(p, q)is the cross-entropy betweenpand

q. Selecting the sentences with the lowest per-plexity is therefore equivalent to choosing the sen-tences with the lowest cross-entropy according to the language model trained on monolingual data. To compute bilingual cross-entropy scoreX(s)of a sentences, we sum the cross-entropy difference over each side of the corpus, both source and tar-get:

X(s) = [HM−src(s)−HN−src(s)]+

[HM−tgt(s)−HN−tgt(s)]

(2)

where HM−src(s) andHM−trg(s) are the

cross-entropy of a source/target sentence, respectively, according to a language model trained on the

monolingual data provided, and HN−src(s) and

HN−trg(s)are the cross-entropy of a source/target

sentence, respectively, according to a language model trained on the noisy corpora. Lower scores are presumed to be better.

3.2 Filtering by hypothesis

[image:4.595.353.479.468.708.2]

Here, the purpose is to filter the noisy data accord-ing to the potential smoothed BLEU score of the sentence pair and the generated hypothesis. With the purpose of building a translation system for ob-taining this probability, we trained an NMT sys-tem with different training set sizes selected us-ing the bilus-ingual cross-entropy technique above. The system was trained for 200 epochs, which was enough to achieve convergence. As development set, and for selecting the best model for comput-ing the BLEU score of the hypothesis associated to a sentence pair, we used the same development set as provided in the shared task. We selected the best epoch according to validation set loss func-tion value. In Table6we show sacreBLEU scores for models trained with different number of sen-tences.

Table 6: Validation sacreBLEU scores for bilin-gual cross-entropy selection results depending on the number of training sentences for Nepali–English and Sinhala–English. M denotes millions of elements. Best system marked in bold.

Nepali–English Training size Validation

1.0M 11.7

1.5M 12.3

2.0M 12.2

2.5M 12.2

3.0M 14.9

3.5M 13.5

Sinhala–English Training size Validation

1.0M 8.3

1.5M 8.8

2.0M 9.8

2.5M 9.5

3.0M 9.9

3.5M 9.5

(5)

se-400

401

402

403

404

405

406

407

408

409

410

411

412

413

414

415

416

417

418

419

420

421

422

423

424

425

426

427

428

429

430

431

432

433

434

435

436

437

438

439

440

441

442

443

444

445

446

447

448

449

450

451

452

453

454

455

456

457

458

459

460

461

462

463

464

465

466

467

468

469

470

471

472

473

474

475

476

477

478

479

480

481

482

483

484

485

486

487

488

489

490

491

492

493

494

495

496

497

498

499 lected, we translated the noisy corpora and we

ob-tained the hypothesis for each sentence, which al-lowed us to compute the corresponding smoothed BLEU score. This is the final score provided as competition result. However, and before providing the score, we also applied other filtering strategies, as described in the following subsections.

3.3 Rule based Filtering

After obtaining the hypothesis for each sentence from the noisy corpora, we applied a few rules to filter the sentence pairs. These rules are the fol-lowing:

1. Remove sentence pairs where the source or target sentence contains more than 250 BPE segments.

2. Remove sentences where the lower-cased source sentence is equal to the lower-cased target sentence.

3. Remove sentence pairs which do not contain any Nepali/Sinhala characters in the source sentence.

4. Remove sentences where the smoothed BLEU score between the source and the tar-get sentence is higher than a fixed thresh-oldµ. We explored different values for this threshold µ = {0.20,0.25,0.30,0.35,1.0}. Note that the space between0.35and1.0was not explored because values ofµonly slightly above0.35already implied that no sentences were filtered.

The order in which the rules are applied is impor-tant, since sentences that are filtered out with zero score assigned by one rule will not be a candidate for selection in subsequent rules. After applying different threshold values we used the provided script to subsample sentence pairs to amount to 1 million and 5 million English words. The results of training the final NMT system by applying dif-ferent thresholdsµare shown in Tables7and8.

Finally, we selected thresholdsµ= 0.35for the Nepali–English corpus, andµ= 1.00(no thresh-old, all BLEU values between source and target sentences accepted) for the Sinhala–English lan-guage pair. In Table 9, the number of removed sentences by each rule are shown.

[image:5.595.336.495.106.290.2]

In total, we discarded 1.2M from Nepali noisy corpus and 1.9M sentences from Sinhala noisy

Table 7: SacreBLEU scores for final NMT system trained using sentences selected with different values of thresholdµfor Nepali–English.

Nepali–English

Eng. words µ Valid Test

1M

0.20 0.1 0.2 0.25 3.3 4.1 0.30 3.4 4.2 0.35 3.4 4.3

1.00 2.4 3.0

5M

0.20 0.2 0.2 0.25 2.6 3.0 0.30 2.8 3.2 0.35 3.0 3.4

1.00 3.0 3.3

Table 8: SacreBLEU scores for final NMT system trained using sentences selected with different values of thresholdµfor Sinhala–English.

Sinhala–English

Eng. words µ Valid Test

1M

0.20 2.0 2.4 0.25 2.2 2.2 0.30 2.3 3.1 0.35 2.3 2.4 1.00 2.4 2.3

5M

0.20 2.6 2.8 0.25 3.1 3.0 0.30 3.6 3.4 0.35 3.3 3.4 1.00 4.2 4.3

corpus. The rest of sentences from noisy cor-pus were scored using target-hypothesis smoothed BLEU described previously.

3.4 Baseline comparision

[image:5.595.337.495.349.531.2]
(6)

500

501

502

503

504

505

506

507

508

509

510

511

512

513

514

515

516

517

518

519

520

521

522

523

524

525

526

527

528

529

530

531

532

533

534

535

536

537

538

539

540

541

542

543

544

545

546

547

548

549

550

551

552

553

554

555

556

557

558

559

560

561

562

563

564

565

566

567

568

569

570

571

572

573

574

575

576

577

578

579

580

581

582

583

584

585

586

587

588

589

590

591

592

593

594

595

596

597

598

[image:6.595.72.292.145.358.2]

599 Table 9: Statistics of how many sentences of noisy

cor-pus were set their final score as zero after applying dif-ferent rules. The number in parenthesis indicates the rule described in the enumerated list above. k denotes thousands of elements and M denotes millions of ele-ments.

Nepali–English

Rule Removed sentences

(1) BPE>250 89.4k

(2) src=trg 186.8k

(3) No Nepali symbols 722.7k (4) src-trg BLEU>0.35 207.2k

Sinhala–English

Rule Removed sentences

(1) BPE>250 76.7k

(2) src=trg 78.3k

(3) No Sinhala symbols 1.7M

(4) src-trg BLEU>1.00 None

Table 10: SacreBLEU scores for NMT system compar-ison with the Zipporah model.

Nepali–English Eng. words Model Test

1M Sciling 4.3

Zipporah 5.2

5M Sciling 3.4

Zipporah 1.9

Sinhala–English Eng. words Model Test

1M Sciling 2.3

Zipporah 4.7

5M Sciling 4.3

Zipporah 3.7

4 Conclusions and future work

We introduced filtering of noisy parallel corpora based on hypothesis generation and combined this filtering with several filtering rules. We submitted only the best set of scores for each language pair to the shared task. In both language pairs, Nepali– English and Sinhala–English, we achieved results that performed better than the Zipporah baseline with corpora containing 5M English words. Our conclusion is that the designed filtering method is able to reach better performance when confronted

with larger amounts of data.

Future work should concentrate on further im-proving of our filtering method. We would train a logistic model to combine the BLEU score be-tween the generated hypothesis and target with the BLEU score between source and target in-stead of threshold values. Also, we would ap-ply data selection techniques such as infrequent n-gram selection (Parcheta et al., 2018) or con-tinuous vector-space representation of sentences (Chinea-Rios et al.,2019).

Acknowledgments

Work partially supported by MINECO under grant DI-15-08169 and by Sciling under its R+D pro-gramme. The authors would like to thank NVIDIA for their donation of Titan Xp GPU that allowed to conduct this research.

References

Amittai Axelrod, Xiaodong He, and Jianfeng Gao. 2011. Domain adaptation via pseudo in-domain data selection. InProc. of EMNLP, pages 355–362.

Mara Chinea-Rios, Germ´an Sanchis-Trilles, and Fran-cisco Casacuberta. 2019. Vector sentences represen-tation for data selection in statistical machine trans-lation.Computer Speech & Language, 56:1–16.

Francisco Guzm´an, Peng-Jen Chen, Myle Ott, Juan Pino, Guillaume Lample, Philipp Koehn, Vishrav Chaudhary, and Marc’Aurelio Ranzato. 2019. Two new evaluation datasets for low-resource machine translation: Nepali-english and sinhala-english.

arXiv preprint arXiv:1902.01382.

Diederik P. Kingma and Jimmy Ba. 2014. Adam: A method for stochastic optimization. CoRR, abs/1412.6980.

Philipp Koehn, Hieu Hoang, Alexandra Birch, Chris Callison-Burch, Marcello Federico, Nicola Bertoldi, Brooke Cowan, Wade Shen, Christine Moran, Richard Zens, et al. 2007. Moses: Open source toolkit for statistical machine translation. InProc. of ACL, pages 177–180.

Chin-Yew Lin and Franz Josef Och. 2004. Auto-matic evaluation of machine translation quality us-ing longest common subsequence and skip-bigram statistics. InProc. of ACL, pages 605–615.

Robert C. Moore and William Lewis. 2010. Intelligent selection of language model training data. InProc. of ACL, pages 220–224.

[image:6.595.109.255.402.589.2]
(7)

600

601

602

603

604

605

606

607

608

609

610

611

612

613

614

615

616

617

618

619

620

621

622

623

624

625

626

627

628

629

630

631

632

633

634

635

636

637

638

639

640

641

642

643

644

645

646

647

648

649

650

651

652

653

654

655

656

657

658

659

660

661

662

663

664

665

666

667

668

669

670

671

672

673

674

675

676

677

678

679

680

681

682

683

684

685

686

687

688

689

690

691

692

693

694

695

696

697

698

699 Michael Auli. 2019. fairseq: A fast,

extensi-ble toolkit for sequence modeling. arXiv preprint arXiv:1904.01038.

Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu. 2002. BLEU: a method for automatic evaluation of machine translation. InProc. of ACL, pages 311–318.

Zuzanna Parcheta, Germ´an Sanchis-Trilles, and Fran-cisco Casacuberta. 2018. Data selection for nmt us-ing infrequent n-gram recovery. pages 219–228.

Matt Post. 2018. A call for clarity in reporting BLEU scores. InProc. of WMT, pages 186–191.

Figure

Table 1: Main figures of the noisy corpora for theNepali–English and Sinhala–English language pairs
Table 4: Main figures of the monolingual (mono.) datafor Hindi and bilingual data for Hindi–English (hi–en).ulary size
Table 6:Validation sacreBLEU scores for bilin-gual cross-entropy selection results depending on thenumber of training sentences for Nepali–English andSinhala–English
Table 7: SacreBLEU scores for final NMT systemtrained using sentences selected with different valuesof threshold µ for Nepali–English.
+2

References

Related documents