File size: 97,282 Bytes
b1d4de0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
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
299
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
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
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
599
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
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
# File: open_asr_leaderboard-main/ctranslate2/run_eval.py
""""""
import argparse
import os
import time
import evaluate
from faster_whisper import WhisperModel
from tqdm import tqdm
from normalizer import data_utils
wer_metric = evaluate.load('wer')

def main(args) -> None:
    asr_model = WhisperModel(model_size_or_path=args.model_id, compute_type='float16', device='cuda', device_index=args.device)

    def benchmark(batch):
        start_time = time.time()
        (segments, _) = asr_model.transcribe(batch['audio']['array'], language='en')
        outputs = [segment._asdict() for segment in segments]
        batch['transcription_time_s'] = time.time() - start_time
        batch['predictions'] = data_utils.normalizer(''.join([segment['text'] for segment in outputs])).strip()
        batch['references'] = batch['norm_text']
        return batch
    if args.warmup_steps is not None:
        dataset = data_utils.load_data(args)
        dataset = data_utils.prepare_data(dataset)
        if args.streaming:
            warmup_dataset = dataset.take(args.warmup_steps)
        else:
            warmup_dataset = dataset.select(range(min(args.warmup_steps, len(dataset))))
        warmup_dataset = iter(warmup_dataset.map(benchmark, remove_columns=['audio']))
        for _ in tqdm(warmup_dataset, desc='Warming up...'):
            continue
    dataset = data_utils.load_data(args)
    if args.max_eval_samples is not None and args.max_eval_samples > 0:
        print(f'Subsampling dataset to first {args.max_eval_samples} samples!')
        if args.streaming:
            dataset = dataset.take(args.max_eval_samples)
        else:
            dataset = dataset.select(range(min(args.max_eval_samples, len(dataset))))
    dataset = data_utils.prepare_data(dataset)
    dataset = dataset.map(benchmark, remove_columns=['audio'])
    all_results = {'audio_length_s': [], 'transcription_time_s': [], 'predictions': [], 'references': []}
    result_iter = iter(dataset)
    for result in tqdm(result_iter, desc='Samples...'):
        for key in all_results:
            all_results[key].append(result[key])
    manifest_path = data_utils.write_manifest(all_results['references'], all_results['predictions'], args.model_id, args.dataset_path, args.dataset, args.split, audio_length=all_results['audio_length_s'], transcription_time=all_results['transcription_time_s'])
    print('Results saved at path:', os.path.abspath(manifest_path))
    wer = wer_metric.compute(references=all_results['references'], predictions=all_results['predictions'])
    wer = round(100 * wer, 2)
    rtfx = round(sum(all_results['audio_length_s']) / sum(all_results['transcription_time_s']), 2)
    print('WER:', wer, '%', 'RTFx:', rtfx)
if __name__ == '__main__':
    parser = argparse.ArgumentParser()
    parser.add_argument('--model_id', type=str, required=True, help='Model identifier. Should be loadable with faster-whisper')
    parser.add_argument('--dataset_path', type=str, default='esb/datasets', help='Dataset path. By default, it is `esb/datasets`')
    parser.add_argument('--dataset', type=str, required=True, help="Dataset name. *E.g.* `'librispeech_asr` for the LibriSpeech ASR dataset, or `'common_voice'` for Common Voice. The full list of dataset names can be found at `https://huggingface.co/datasets/esb/datasets`")
    parser.add_argument('--split', type=str, default='test', help="Split of the dataset. *E.g.* `'validation`' for the dev split, or `'test'` for the test split.")
    parser.add_argument('--device', type=int, default=-1, help='The device to run the pipeline on. -1 for CPU (default), 0 for the first GPU and so on.')
    parser.add_argument('--max_eval_samples', type=int, default=None, help='Number of samples to be evaluated. Put a lower number e.g. 64 for testing this script.')
    parser.add_argument('--no-streaming', dest='streaming', action='store_false', help="Choose whether you'd like to download the entire dataset or stream it during the evaluation.")
    parser.add_argument('--warmup_steps', type=int, default=5, help='Number of warm-up steps to run before launching the timed runs.')
    args = parser.parse_args()
    parser.set_defaults(streaming=False)
    main(args)

# File: open_asr_leaderboard-main/nemo_asr/run_eval.py
import argparse
import os
import torch
import evaluate
import soundfile
from tqdm import tqdm
from normalizer import data_utils
import numpy as np
from nemo.collections.asr.models import ASRModel
import time
wer_metric = evaluate.load('wer')

def main(args):
    DATA_CACHE_DIR = os.path.join(os.getcwd(), 'audio_cache')
    DATASET_NAME = args.dataset
    SPLIT_NAME = args.split
    CACHE_DIR = os.path.join(DATA_CACHE_DIR, DATASET_NAME, SPLIT_NAME)
    if not os.path.exists(CACHE_DIR):
        os.makedirs(CACHE_DIR)
    if args.device >= 0:
        device = torch.device(f'cuda:{args.device}')
        compute_dtype = torch.bfloat16
    else:
        device = torch.device('cpu')
        compute_dtype = torch.float32
    if args.model_id.endswith('.nemo'):
        asr_model = ASRModel.restore_from(args.model_id, map_location=device)
    else:
        asr_model = ASRModel.from_pretrained(args.model_id, map_location=device)
    asr_model.to(compute_dtype)
    asr_model.eval()
    dataset = data_utils.load_data(args)

    def download_audio_files(batch):
        audio_paths = []
        durations = []
        for (id, sample) in zip(batch['id'], batch['audio']):
            audio_path = os.path.join(CACHE_DIR, f'{id}.wav')
            if not os.path.exists(audio_path):
                os.makedirs(os.path.dirname(audio_path), exist_ok=True)
                soundfile.write(audio_path, np.float32(sample['array']), 16000)
            audio_paths.append(audio_path)
            durations.append(len(sample['array']) / 16000)
        batch['references'] = batch['norm_text']
        batch['audio_filepaths'] = audio_paths
        batch['durations'] = durations
        return batch
    if args.max_eval_samples is not None and args.max_eval_samples > 0:
        print(f'Subsampling dataset to first {args.max_eval_samples} samples !')
        dataset = dataset.take(args.max_eval_samples)
    dataset = data_utils.prepare_data(dataset)
    if asr_model.cfg.decoding.strategy != 'beam':
        asr_model.cfg.decoding.strategy = 'greedy_batch'
        asr_model.change_decoding_strategy(asr_model.cfg.decoding)
    dataset = dataset.map(download_audio_files, batch_size=args.batch_size, batched=True, remove_columns=['audio'])
    all_data = {'audio_filepaths': [], 'durations': [], 'references': []}
    data_itr = iter(dataset)
    for data in tqdm(data_itr, desc='Downloading Samples'):
        for key in all_data:
            all_data[key].append(data[key])
    sorted_indices = sorted(range(len(all_data['durations'])), key=lambda k: all_data['durations'][k], reverse=True)
    all_data['audio_filepaths'] = [all_data['audio_filepaths'][i] for i in sorted_indices]
    all_data['references'] = [all_data['references'][i] for i in sorted_indices]
    all_data['durations'] = [all_data['durations'][i] for i in sorted_indices]
    total_time = 0
    for _ in range(2):
        if _ == 0:
            audio_files = all_data['audio_filepaths'][:args.batch_size * 4]
        else:
            audio_files = all_data['audio_filepaths']
        start_time = time.time()
        with torch.cuda.amp.autocast(enabled=False, dtype=compute_dtype), torch.inference_mode(), torch.no_grad():
            if 'canary' in args.model_id:
                transcriptions = asr_model.transcribe(audio_files, batch_size=args.batch_size, verbose=False, pnc='no', num_workers=1)
            else:
                transcriptions = asr_model.transcribe(audio_files, batch_size=args.batch_size, verbose=False, num_workers=1)
        end_time = time.time()
        if _ == 1:
            total_time += end_time - start_time
    total_time = total_time
    if isinstance(transcriptions, tuple) and len(transcriptions) == 2:
        transcriptions = transcriptions[0]
    predictions = [data_utils.normalizer(pred) for pred in transcriptions]
    avg_time = total_time / len(all_data['audio_filepaths'])
    manifest_path = data_utils.write_manifest(all_data['references'], predictions, args.model_id, args.dataset_path, args.dataset, args.split, audio_length=all_data['durations'], transcription_time=[avg_time] * len(all_data['audio_filepaths']))
    print('Results saved at path:', os.path.abspath(manifest_path))
    wer = wer_metric.compute(references=all_data['references'], predictions=predictions)
    wer = round(100 * wer, 2)
    audio_length = sum(all_data['durations'])
    rtfx = audio_length / total_time
    rtfx = round(rtfx, 2)
    print('RTFX:', rtfx)
    print('WER:', wer, '%')
if __name__ == '__main__':
    parser = argparse.ArgumentParser()
    parser.add_argument('--model_id', type=str, required=True, help='Model identifier. Should be loadable with NVIDIA NeMo.')
    parser.add_argument('--dataset_path', type=str, default='esb/datasets', help='Dataset path. By default, it is `esb/datasets`')
    parser.add_argument('--dataset', type=str, required=True, help="Dataset name. *E.g.* `'librispeech_asr` for the LibriSpeech ASR dataset, or `'common_voice'` for Common Voice. The full list of dataset names can be found at `https://huggingface.co/datasets/esb/datasets`")
    parser.add_argument('--split', type=str, default='test', help="Split of the dataset. *E.g.* `'validation`' for the dev split, or `'test'` for the test split.")
    parser.add_argument('--device', type=int, default=-1, help='The device to run the pipeline on. -1 for CPU (default), 0 for the first GPU and so on.')
    parser.add_argument('--batch_size', type=int, default=32, help='Number of samples to go through each streamed batch.')
    parser.add_argument('--max_eval_samples', type=int, default=None, help='Number of samples to be evaluated. Put a lower number e.g. 64 for testing this script.')
    parser.add_argument('--no-streaming', dest='streaming', action='store_false', help="Choose whether you'd like to download the entire dataset or stream it during the evaluation.")
    args = parser.parse_args()
    parser.set_defaults(streaming=True)
    main(args)

# File: open_asr_leaderboard-main/normalizer/data_utils.py
from datasets import load_dataset, Audio
from normalizer import EnglishTextNormalizer
from .eval_utils import read_manifest, write_manifest

def is_target_text_in_range(ref):
    if ref.strip() == 'ignore time segment in scoring':
        return False
    else:
        return ref.strip() != ''

def get_text(sample):
    if 'text' in sample:
        return sample['text']
    elif 'sentence' in sample:
        return sample['sentence']
    elif 'normalized_text' in sample:
        return sample['normalized_text']
    elif 'transcript' in sample:
        return sample['transcript']
    elif 'transcription' in sample:
        return sample['transcription']
    else:
        raise ValueError(f"Expected transcript column of either 'text', 'sentence', 'normalized_text' or 'transcript'. Got sample of .join{{sample.keys()}}. Ensure a text column name is present in the dataset.")
normalizer = EnglishTextNormalizer()

def normalize(batch):
    batch['original_text'] = get_text(batch)
    batch['norm_text'] = normalizer(batch['original_text'])
    return batch

def load_data(args):
    dataset = load_dataset(args.dataset_path, args.dataset, split=args.split, streaming=args.streaming, token=True)
    return dataset

def prepare_data(dataset):
    dataset = dataset.cast_column('audio', Audio(sampling_rate=16000))
    dataset = dataset.map(normalize)
    dataset = dataset.filter(is_target_text_in_range, input_columns=['norm_text'])
    return dataset

# File: open_asr_leaderboard-main/normalizer/english_abbreviations.py
english_spelling_normalizer = {'accessorise': 'accessorize', 'accessorised': 'accessorized', 'accessorises': 'accessorizes', 'accessorising': 'accessorizing', 'acclimatisation': 'acclimatization', 'acclimatise': 'acclimatize', 'acclimatised': 'acclimatized', 'acclimatises': 'acclimatizes', 'acclimatising': 'acclimatizing', 'accoutrements': 'accouterments', 'aeon': 'eon', 'aeons': 'eons', 'aerogramme': 'aerogram', 'aerogrammes': 'aerograms', 'aeroplane': 'airplane', 'aeroplanes': 'airplanes', 'aesthete': 'esthete', 'aesthetes': 'esthetes', 'aesthetic': 'esthetic', 'aesthetically': 'esthetically', 'aesthetics': 'esthetics', 'aetiology': 'etiology', 'ageing': 'aging', 'aggrandisement': 'aggrandizement', 'agonise': 'agonize', 'agonised': 'agonized', 'agonises': 'agonizes', 'agonising': 'agonizing', 'agonisingly': 'agonizingly', 'almanack': 'almanac', 'almanacks': 'almanacs', 'aluminium': 'aluminum', 'amortisable': 'amortizable', 'amortisation': 'amortization', 'amortisations': 'amortizations', 'amortise': 'amortize', 'amortised': 'amortized', 'amortises': 'amortizes', 'amortising': 'amortizing', 'amphitheatre': 'amphitheater', 'amphitheatres': 'amphitheaters', 'anaemia': 'anemia', 'anaemic': 'anemic', 'anaesthesia': 'anesthesia', 'anaesthetic': 'anesthetic', 'anaesthetics': 'anesthetics', 'anaesthetise': 'anesthetize', 'anaesthetised': 'anesthetized', 'anaesthetises': 'anesthetizes', 'anaesthetising': 'anesthetizing', 'anaesthetist': 'anesthetist', 'anaesthetists': 'anesthetists', 'anaesthetize': 'anesthetize', 'anaesthetized': 'anesthetized', 'anaesthetizes': 'anesthetizes', 'anaesthetizing': 'anesthetizing', 'analogue': 'analog', 'analogues': 'analogs', 'analyse': 'analyze', 'analysed': 'analyzed', 'analyses': 'analyzes', 'analysing': 'analyzing', 'anglicise': 'anglicize', 'anglicised': 'anglicized', 'anglicises': 'anglicizes', 'anglicising': 'anglicizing', 'annualised': 'annualized', 'antagonise': 'antagonize', 'antagonised': 'antagonized', 'antagonises': 'antagonizes', 'antagonising': 'antagonizing', 'apologise': 'apologize', 'apologised': 'apologized', 'apologises': 'apologizes', 'apologising': 'apologizing', 'appal': 'appall', 'appals': 'appalls', 'appetiser': 'appetizer', 'appetisers': 'appetizers', 'appetising': 'appetizing', 'appetisingly': 'appetizingly', 'arbour': 'arbor', 'arbours': 'arbors', 'archaeologically': 'archeologically', 'archaeologist': 'archeologist', 'archaeologists': 'archeologists', 'archaeology': 'archeology</span>', 'archeological': 'archaeological', 'ardour': 'ardor', 'armour': 'armor', 'armoured': 'armored', 'armourer': 'armorer', 'armourers': 'armorers', 'armouries': 'armories', 'armoury': 'armory', 'artefact': 'artifact', 'artefacts': 'artifacts', 'authorise': 'authorize', 'authorised': 'authorized', 'authorises': 'authorizes', 'authorising': 'authorizing', 'axe': 'ax', 'backpedalled': 'backpedaled', 'backpedalling': 'backpedaling', 'bannister': 'banister', 'bannisters': 'banisters', 'baptise': 'baptize', 'baptised': 'baptized', 'baptises': 'baptizes', 'baptising': 'baptizing', 'bastardise': 'bastardize', 'bastardised': 'bastardized', 'bastardises': 'bastardizes', 'bastardising': 'bastardizing', 'battleax': 'battleaxe', 'baulk': 'balk', 'baulked': 'balked', 'baulking': 'balking', 'baulks': 'balks', 'bedevilled': 'bedeviled', 'bedevilling': 'bedeviling', 'behaviour': 'behavior', 'behavioural': 'behavioral', 'behaviourism': 'behaviorism', 'behaviourist': 'behaviorist', 'behaviourists': 'behaviorists', 'behaviours': 'behaviors', 'behove': 'behoove', 'behoved': 'behooved', 'behoves': 'behooves', 'bejewelled': 'bejeweled', 'belabour': 'belabor', 'belaboured': 'belabored', 'belabouring': 'belaboring', 'belabours': 'belabors', 'bevelled': 'beveled', 'bevvies': 'bevies', 'bevvy': 'bevy', 'biassed': 'biased', 'biassing': 'biasing', 'bingeing': 'binging', 'bougainvillaea': 'bougainvillea', 'bougainvillaeas': 'bougainvilleas', 'bowdlerise': 'bowdlerize', 'bowdlerised': 'bowdlerized', 'bowdlerises': 'bowdlerizes', 'bowdlerising': 'bowdlerizing', 'breathalyse': 'breathalyze', 'breathalysed': 'breathalyzed', 'breathalyser': 'breathalyzer', 'breathalysers': 'breathalyzers', 'breathalyses': 'breathalyzes', 'breathalysing': 'breathalyzing', 'brutalise': 'brutalize', 'brutalised': 'brutalized', 'brutalises': 'brutalizes', 'brutalising': 'brutalizing', 'busses': 'buses', 'bussing': 'busing', 'caesarean': 'cesarean', 'caesareans': 'cesareans', 'calibre': 'caliber', 'calibres': 'calibers', 'calliper': 'caliper', 'callipers': 'calipers', 'callisthenics': 'calisthenics', 'canalise': 'canalize', 'canalised': 'canalized', 'canalises': 'canalizes', 'canalising': 'canalizing', 'cancelation': 'cancellation', 'cancelations': 'cancellations', 'cancelled': 'canceled', 'cancelling': 'canceling', 'candour': 'candor', 'cannibalise': 'cannibalize', 'cannibalised': 'cannibalized', 'cannibalises': 'cannibalizes', 'cannibalising': 'cannibalizing', 'canonise': 'canonize', 'canonised': 'canonized', 'canonises': 'canonizes', 'canonising': 'canonizing', 'capitalise': 'capitalize', 'capitalised': 'capitalized', 'capitalises': 'capitalizes', 'capitalising': 'capitalizing', 'caramelise': 'caramelize', 'caramelised': 'caramelized', 'caramelises': 'caramelizes', 'caramelising': 'caramelizing', 'carbonise': 'carbonize', 'carbonised': 'carbonized', 'carbonises': 'carbonizes', 'carbonising': 'carbonizing', 'carolled': 'caroled', 'carolling': 'caroling', 'catalogue': 'catalog', 'catalogued': 'cataloged', 'catalogues': 'catalogs', 'cataloguing': 'cataloging', 'catalyse': 'catalyze', 'catalysed': 'catalyzed', 'catalyses': 'catalyzes', 'catalysing': 'catalyzing', 'categorise': 'categorize', 'categorised': 'categorized', 'categorises': 'categorizes', 'categorising': 'categorizing', 'cauterise': 'cauterize', 'cauterised': 'cauterized', 'cauterises': 'cauterizes', 'cauterising': 'cauterizing', 'cavilled': 'caviled', 'cavilling': 'caviling', 'centigramme': 'centigram', 'centigrammes': 'centigrams', 'centilitre': 'centiliter', 'centilitres': 'centiliters', 'centimetre': 'centimeter', 'centimetres': 'centimeters', 'centralise': 'centralize', 'centralised': 'centralized', 'centralises': 'centralizes', 'centralising': 'centralizing', 'centre': 'center', 'centred': 'centered', 'centrefold': 'centerfold', 'centrefolds': 'centerfolds', 'centrepiece': 'centerpiece', 'centrepieces': 'centerpieces', 'centres': 'centers', 'channelled': 'channeled', 'channelling': 'channeling', 'characterise': 'characterize', 'characterised': 'characterized', 'characterises': 'characterizes', 'characterising': 'characterizing', 'cheque': 'check', 'chequebook': 'checkbook', 'chequebooks': 'checkbooks', 'chequered': 'checkered', 'cheques': 'checks', 'chilli': 'chili', 'chimaera': 'chimera', 'chimaeras': 'chimeras', 'chiselled': 'chiseled', 'chiselling': 'chiseling', 'circularise': 'circularize', 'circularised': 'circularized', 'circularises': 'circularizes', 'circularising': 'circularizing', 'civilise': 'civilize', 'civilised': 'civilized', 'civilises': 'civilizes', 'civilising': 'civilizing', 'clamour': 'clamor', 'clamoured': 'clamored', 'clamouring': 'clamoring', 'clamours': 'clamors', 'clangour': 'clangor', 'clarinettist': 'clarinetist', 'clarinettists': 'clarinetists', 'collectivise': 'collectivize', 'collectivised': 'collectivized', 'collectivises': 'collectivizes', 'collectivising': 'collectivizing', 'colonisation': 'colonization', 'colonise': 'colonize', 'colonised': 'colonized', 'coloniser': 'colonizer', 'colonisers': 'colonizers', 'colonises': 'colonizes', 'colonising': 'colonizing', 'colour': 'color', 'colourant': 'colorant', 'colourants': 'colorants', 'coloured': 'colored', 'coloureds': 'coloreds', 'colourful': 'colorful', 'colourfully': 'colorfully', 'colouring': 'coloring', 'colourize': 'colorize', 'colourized': 'colorized', 'colourizes': 'colorizes', 'colourizing': 'colorizing', 'colourless': 'colorless', 'colours': 'colors', 'commercialise': 'commercialize', 'commercialised': 'commercialized', 'commercialises': 'commercializes', 'commercialising': 'commercializing', 'compartmentalise': 'compartmentalize', 'compartmentalised': 'compartmentalized', 'compartmentalises': 'compartmentalizes', 'compartmentalising': 'compartmentalizing', 'computerise': 'computerize', 'computerised': 'computerized', 'computerises': 'computerizes', 'computerising': 'computerizing', 'conceptualise': 'conceptualize', 'conceptualised': 'conceptualized', 'conceptualises': 'conceptualizes', 'conceptualising': 'conceptualizing', 'connexion': 'connection', 'connexions': 'connections', 'contextualise': 'contextualize', 'contextualised': 'contextualized', 'contextualises': 'contextualizes', 'contextualising': 'contextualizing', 'cosier': 'cozier', 'cosies': 'cozies', 'cosiest': 'coziest', 'cosily': 'cozily', 'cosiness': 'coziness', 'cosy': 'cozy', 'councillor': 'councilor', 'councillors': 'councilors', 'counselled': 'counseled', 'counselling': 'counseling', 'counsellor': 'counselor', 'counsellors': 'counselors', 'crenelated': 'crenellated', 'criminalise': 'criminalize', 'criminalised': 'criminalized', 'criminalises': 'criminalizes', 'criminalising': 'criminalizing', 'criticise': 'criticize', 'criticised': 'criticized', 'criticises': 'criticizes', 'criticising': 'criticizing', 'crueller': 'crueler', 'cruellest': 'cruelest', 'crystallisation': 'crystallization', 'crystallise': 'crystallize', 'crystallised': 'crystallized', 'crystallises': 'crystallizes', 'crystallising': 'crystallizing', 'cudgelled': 'cudgeled', 'cudgelling': 'cudgeling', 'customise': 'customize', 'customised': 'customized', 'customises': 'customizes', 'customising': 'customizing', 'cypher': 'cipher', 'cyphers': 'ciphers', 'decentralisation': 'decentralization', 'decentralise': 'decentralize', 'decentralised': 'decentralized', 'decentralises': 'decentralizes', 'decentralising': 'decentralizing', 'decriminalisation': 'decriminalization', 'decriminalise': 'decriminalize', 'decriminalised': 'decriminalized', 'decriminalises': 'decriminalizes', 'decriminalising': 'decriminalizing', 'defence': 'defense', 'defenceless': 'defenseless', 'defences': 'defenses', 'dehumanisation': 'dehumanization', 'dehumanise': 'dehumanize', 'dehumanised': 'dehumanized', 'dehumanises': 'dehumanizes', 'dehumanising': 'dehumanizing', 'demeanour': 'demeanor', 'demilitarisation': 'demilitarization', 'demilitarise': 'demilitarize', 'demilitarised': 'demilitarized', 'demilitarises': 'demilitarizes', 'demilitarising': 'demilitarizing', 'demobilisation': 'demobilization', 'demobilise': 'demobilize', 'demobilised': 'demobilized', 'demobilises': 'demobilizes', 'demobilising': 'demobilizing', 'democratisation': 'democratization', 'democratise': 'democratize', 'democratised': 'democratized', 'democratises': 'democratizes', 'democratising': 'democratizing', 'demonise': 'demonize', 'demonised': 'demonized', 'demonises': 'demonizes', 'demonising': 'demonizing', 'demoralisation': 'demoralization', 'demoralise': 'demoralize', 'demoralised': 'demoralized', 'demoralises': 'demoralizes', 'demoralising': 'demoralizing', 'denationalisation': 'denationalization', 'denationalise': 'denationalize', 'denationalised': 'denationalized', 'denationalises': 'denationalizes', 'denationalising': 'denationalizing', 'deodorise': 'deodorize', 'deodorised': 'deodorized', 'deodorises': 'deodorizes', 'deodorising': 'deodorizing', 'depersonalise': 'depersonalize', 'depersonalised': 'depersonalized', 'depersonalises': 'depersonalizes', 'depersonalising': 'depersonalizing', 'deputise': 'deputize', 'deputised': 'deputized', 'deputises': 'deputizes', 'deputising': 'deputizing', 'desensitisation': 'desensitization', 'desensitise': 'desensitize', 'desensitised': 'desensitized', 'desensitises': 'desensitizes', 'desensitising': 'desensitizing', 'destabilisation': 'destabilization', 'destabilise': 'destabilize', 'destabilised': 'destabilized', 'destabilises': 'destabilizes', 'destabilising': 'destabilizing', 'dialled': 'dialed', 'dialling': 'dialing', 'dialogue': 'dialog', 'dialogues': 'dialogs', 'diarrhoea': 'diarrhea', 'digitise': 'digitize', 'digitised': 'digitized', 'digitises': 'digitizes', 'digitising': 'digitizing', 'disc': 'disk', 'discolour': 'discolor', 'discoloured': 'discolored', 'discolouring': 'discoloring', 'discolours': 'discolors', 'discs': 'disks', 'disembowelled': 'disemboweled', 'disembowelling': 'disemboweling', 'disfavour': 'disfavor', 'dishevelled': 'disheveled', 'dishonour': 'dishonor', 'dishonourable': 'dishonorable', 'dishonourably': 'dishonorably', 'dishonoured': 'dishonored', 'dishonouring': 'dishonoring', 'dishonours': 'dishonors', 'disorganisation': 'disorganization', 'disorganised': 'disorganized', 'distil': 'distill', 'distils': 'distills', 'dramatisation': 'dramatization', 'dramatisations': 'dramatizations', 'dramatise': 'dramatize', 'dramatised': 'dramatized', 'dramatises': 'dramatizes', 'dramatising': 'dramatizing', 'draught': 'draft', 'draughtboard': 'draftboard', 'draughtboards': 'draftboards', 'draughtier': 'draftier', 'draughtiest': 'draftiest', 'draughts': 'drafts', 'draughtsman': 'draftsman', 'draughtsmanship': 'draftsmanship', 'draughtsmen': 'draftsmen', 'draughtswoman': 'draftswoman', 'draughtswomen': 'draftswomen', 'draughty': 'drafty', 'drivelled': 'driveled', 'drivelling': 'driveling', 'duelled': 'dueled', 'duelling': 'dueling', 'economise': 'economize', 'economised': 'economized', 'economises': 'economizes', 'economising': 'economizing', 'editorialise': 'editorialize', 'editorialised': 'editorialized', 'editorialises': 'editorializes', 'editorialising': 'editorializing', 'edoema': 'edema', 'empathise': 'empathize', 'empathised': 'empathized', 'empathises': 'empathizes', 'empathising': 'empathizing', 'emphasise': 'emphasize', 'emphasised': 'emphasized', 'emphasises': 'emphasizes', 'emphasising': 'emphasizing', 'enamelled': 'enameled', 'enamelling': 'enameling', 'enamoured': 'enamored', 'encyclopaedia': 'encyclopedia', 'encyclopaedias': 'encyclopedias', 'encyclopaedic': 'encyclopedic', 'endeavour': 'endeavor', 'endeavoured': 'endeavored', 'endeavouring': 'endeavoring', 'endeavours': 'endeavors', 'energise': 'energize', 'energised': 'energized', 'energises': 'energizes', 'energising': 'energizing', 'enrol': 'enroll', 'enrols': 'enrolls', 'enthral': 'enthrall', 'enthrals': 'enthralls', 'epaulette': 'epaulet', 'epaulettes': 'epaulets', 'epicentre': 'epicenter', 'epicentres': 'epicenters', 'epilogue': 'epilog', 'epilogues': 'epilogs', 'epitomise': 'epitomize', 'epitomised': 'epitomized', 'epitomises': 'epitomizes', 'epitomising': 'epitomizing', 'equalisation': 'equalization', 'equalise': 'equalize', 'equalised': 'equalized', 'equaliser': 'equalizer', 'equalisers': 'equalizers', 'equalises': 'equalizes', 'equalising': 'equalizing', 'eulogise': 'eulogize', 'eulogised': 'eulogized', 'eulogises': 'eulogizes', 'eulogising': 'eulogizing', 'evangelise': 'evangelize', 'evangelised': 'evangelized', 'evangelises': 'evangelizes', 'evangelising': 'evangelizing', 'exorcise': 'exorcize', 'exorcised': 'exorcized', 'exorcises': 'exorcizes', 'exorcising': 'exorcizing', 'extemporisation': 'extemporization', 'extemporise': 'extemporize', 'extemporised': 'extemporized', 'extemporises': 'extemporizes', 'extemporising': 'extemporizing', 'externalisation': 'externalization', 'externalisations': 'externalizations', 'externalise': 'externalize', 'externalised': 'externalized', 'externalises': 'externalizes', 'externalising': 'externalizing', 'factorise': 'factorize', 'factorised': 'factorized', 'factorises': 'factorizes', 'factorising': 'factorizing', 'faecal': 'fecal', 'faeces': 'feces', 'familiarisation': 'familiarization', 'familiarise': 'familiarize', 'familiarised': 'familiarized', 'familiarises': 'familiarizes', 'familiarising': 'familiarizing', 'fantasise': 'fantasize', 'fantasised': 'fantasized', 'fantasises': 'fantasizes', 'fantasising': 'fantasizing', 'favour': 'favor', 'favourable': 'favorable', 'favourably': 'favorably', 'favoured': 'favored', 'favouring': 'favoring', 'favourite': 'favorite', 'favourites': 'favorites', 'favouritism': 'favoritism', 'favours': 'favors', 'feminise': 'feminize', 'feminised': 'feminized', 'feminises': 'feminizes', 'feminising': 'feminizing', 'fertilisation': 'fertilization', 'fertilise': 'fertilize', 'fertilised': 'fertilized', 'fertiliser': 'fertilizer', 'fertilisers': 'fertilizers', 'fertilises': 'fertilizes', 'fertilising': 'fertilizing', 'fervour': 'fervor', 'fibre': 'fiber', 'fibreglass': 'fiberglass', 'fibres': 'fibers', 'fictionalisation': 'fictionalization', 'fictionalisations': 'fictionalizations', 'fictionalise': 'fictionalize', 'fictionalised': 'fictionalized', 'fictionalises': 'fictionalizes', 'fictionalising': 'fictionalizing', 'fillet': 'filet', 'filleted': 'fileted', 'filleting': 'fileting', 'fillets': 'filets', 'finalisation': 'finalization', 'finalise': 'finalize', 'finalised': 'finalized', 'finalises': 'finalizes', 'finalising': 'finalizing', 'flautist': 'flutist', 'flautists': 'flutists', 'flavour': 'flavor', 'flavoured': 'flavored', 'flavouring': 'flavoring', 'flavourings': 'flavorings', 'flavourless': 'flavorless', 'flavours': 'flavors', 'flavoursome': 'flavorsome', 'flyer / flier': 'flier / flyer', 'foetal': 'fetal', 'foetid': 'fetid', 'foetus': 'fetus', 'foetuses': 'fetuses', 'formalisation': 'formalization', 'formalise': 'formalize', 'formalised': 'formalized', 'formalises': 'formalizes', 'formalising': 'formalizing', 'fossilisation': 'fossilization', 'fossilise': 'fossilize', 'fossilised': 'fossilized', 'fossilises': 'fossilizes', 'fossilising': 'fossilizing', 'fraternisation': 'fraternization', 'fraternise': 'fraternize', 'fraternised': 'fraternized', 'fraternises': 'fraternizes', 'fraternising': 'fraternizing', 'fulfil': 'fulfill', 'fulfilment': 'fulfillment', 'fulfils': 'fulfills', 'funnelled': 'funneled', 'funnelling': 'funneling', 'gage': 'gauge', 'gaged': 'gauged', 'gages': 'gauges', 'gaging': 'gauging', 'galvanise': 'galvanize', 'galvanised': 'galvanized', 'galvanises': 'galvanizes', 'galvanising': 'galvanizing', 'gambolled': 'gamboled', 'gambolling': 'gamboling', 'gaol': 'jail', 'gaolbird': 'jailbird', 'gaolbirds': 'jailbirds', 'gaolbreak': 'jailbreak', 'gaolbreaks': 'jailbreaks', 'gaoled': 'jailed', 'gaoler': 'jailer', 'gaolers': 'jailers', 'gaoling': 'jailing', 'gaols': 'jails', 'gasses': 'gases', 'generalisation': 'generalization', 'generalisations': 'generalizations', 'generalise': 'generalize', 'generalised': 'generalized', 'generalises': 'generalizes', 'generalising': 'generalizing', 'ghettoise': 'ghettoize', 'ghettoised': 'ghettoized', 'ghettoises': 'ghettoizes', 'ghettoising': 'ghettoizing', 'gipsies': 'gypsies', 'glamor': 'glamour', 'glamorise': 'glamorize', 'glamorised': 'glamorized', 'glamorises': 'glamorizes', 'glamorising': 'glamorizing', 'globalisation': 'globalization', 'globalise': 'globalize', 'globalised': 'globalized', 'globalises': 'globalizes', 'globalising': 'globalizing', 'glueing': 'gluing', 'goitre': 'goiter', 'goitres': 'goiters', 'gonorrhoea': 'gonorrhea', 'gramme': 'gram', 'grammes': 'grams', 'gravelled': 'graveled', 'grey': 'gray', 'greyed': 'grayed', 'greying': 'graying', 'greyish': 'grayish', 'greyness': 'grayness', 'greys': 'grays', 'grovelled': 'groveled', 'grovelling': 'groveling', 'groyne': 'groin', 'groynes': 'groins', 'gruelling': 'grueling', 'gruellingly': 'gruelingly', 'gryphon': 'griffin', 'gryphons': 'griffins', 'gynaecological': 'gynecological', 'gynaecologist': 'gynecologist', 'gynaecologists': 'gynecologists', 'gynaecology': 'gynecology', 'haematological': 'hematological', 'haematologist': 'hematologist', 'haematologists': 'hematologists', 'haematology': 'hematology', 'haemoglobin': 'hemoglobin', 'haemophilia': 'hemophilia', 'haemophiliac': 'hemophiliac', 'haemophiliacs': 'hemophiliacs', 'haemorrhage': 'hemorrhage', 'haemorrhaged': 'hemorrhaged', 'haemorrhages': 'hemorrhages', 'haemorrhaging': 'hemorrhaging', 'haemorrhoids': 'hemorrhoids', 'harbour': 'harbor', 'harboured': 'harbored', 'harbouring': 'harboring', 'harbours': 'harbors', 'harmonisation': 'harmonization', 'harmonise': 'harmonize', 'harmonised': 'harmonized', 'harmonises': 'harmonizes', 'harmonising': 'harmonizing', 'homoeopath': 'homeopath', 'homoeopathic': 'homeopathic', 'homoeopaths': 'homeopaths', 'homoeopathy': 'homeopathy', 'homogenise': 'homogenize', 'homogenised': 'homogenized', 'homogenises': 'homogenizes', 'homogenising': 'homogenizing', 'honour': 'honor', 'honourable': 'honorable', 'honourably': 'honorably', 'honoured': 'honored', 'honouring': 'honoring', 'honours': 'honors', 'hospitalisation': 'hospitalization', 'hospitalise': 'hospitalize', 'hospitalised': 'hospitalized', 'hospitalises': 'hospitalizes', 'hospitalising': 'hospitalizing', 'humanise': 'humanize', 'humanised': 'humanized', 'humanises': 'humanizes', 'humanising': 'humanizing', 'humour': 'humor', 'humoured': 'humored', 'humouring': 'humoring', 'humourless': 'humorless', 'humours': 'humors', 'hybridise': 'hybridize', 'hybridised': 'hybridized', 'hybridises': 'hybridizes', 'hybridising': 'hybridizing', 'hypnotise': 'hypnotize', 'hypnotised': 'hypnotized', 'hypnotises': 'hypnotizes', 'hypnotising': 'hypnotizing', 'hypothesise': 'hypothesize', 'hypothesised': 'hypothesized', 'hypothesises': 'hypothesizes', 'hypothesising': 'hypothesizing', 'idealisation': 'idealization', 'idealise': 'idealize', 'idealised': 'idealized', 'idealises': 'idealizes', 'idealising': 'idealizing', 'idolise': 'idolize', 'idolised': 'idolized', 'idolises': 'idolizes', 'idolising': 'idolizing', 'immobilisation': 'immobilization', 'immobilise': 'immobilize', 'immobilised': 'immobilized', 'immobiliser': 'immobilizer', 'immobilisers': 'immobilizers', 'immobilises': 'immobilizes', 'immobilising': 'immobilizing', 'immortalise': 'immortalize', 'immortalised': 'immortalized', 'immortalises': 'immortalizes', 'immortalising': 'immortalizing', 'immunisation': 'immunization', 'immunise': 'immunize', 'immunised': 'immunized', 'immunises': 'immunizes', 'immunising': 'immunizing', 'impanelled': 'impaneled', 'impanelling': 'impaneling', 'imperilled': 'imperiled', 'imperilling': 'imperiling', 'individualise': 'individualize', 'individualised': 'individualized', 'individualises': 'individualizes', 'individualising': 'individualizing', 'industrialise': 'industrialize', 'industrialised': 'industrialized', 'industrialises': 'industrializes', 'industrialising': 'industrializing', 'inflexion': 'inflection', 'inflexions': 'inflections', 'initialise': 'initialize', 'initialised': 'initialized', 'initialises': 'initializes', 'initialising': 'initializing', 'initialled': 'initialed', 'initialling': 'initialing', 'instal': 'install', 'instalment': 'installment', 'instalments': 'installments', 'instals': 'installs', 'instil': 'instill', 'instils': 'instills', 'institutionalisation': 'institutionalization', 'institutionalise': 'institutionalize', 'institutionalised': 'institutionalized', 'institutionalises': 'institutionalizes', 'institutionalising': 'institutionalizing', 'intellectualise': 'intellectualize', 'intellectualised': 'intellectualized', 'intellectualises': 'intellectualizes', 'intellectualising': 'intellectualizing', 'internalisation': 'internalization', 'internalise': 'internalize', 'internalised': 'internalized', 'internalises': 'internalizes', 'internalising': 'internalizing', 'internationalisation': 'internationalization', 'internationalise': 'internationalize', 'internationalised': 'internationalized', 'internationalises': 'internationalizes', 'internationalising': 'internationalizing', 'ionisation': 'ionization', 'ionise': 'ionize', 'ionised': 'ionized', 'ioniser': 'ionizer', 'ionisers': 'ionizers', 'ionises': 'ionizes', 'ionising': 'ionizing', 'italicise': 'italicize', 'italicised': 'italicized', 'italicises': 'italicizes', 'italicising': 'italicizing', 'itemise': 'itemize', 'itemised': 'itemized', 'itemises': 'itemizes', 'itemising': 'itemizing', 'jeopardise': 'jeopardize', 'jeopardised': 'jeopardized', 'jeopardises': 'jeopardizes', 'jeopardising': 'jeopardizing', 'jewelled': 'jeweled', 'jeweller': 'jeweler', 'jewellers': 'jewelers', 'jewellery': 'jewelry', 'judgement': 'judgment', 'kilogramme': 'kilogram', 'kilogrammes': 'kilograms', 'kilometre': 'kilometer', 'kilometres': 'kilometers', 'labelled': 'labeled', 'labelling': 'labeling', 'labour': 'labor', 'laboured': 'labored', 'labourer': 'laborer', 'labourers': 'laborers', 'labouring': 'laboring', 'labours': 'labors', 'lacklustre': 'lackluster', 'legalisation': 'legalization', 'legalise': 'legalize', 'legalised': 'legalized', 'legalises': 'legalizes', 'legalising': 'legalizing', 'legitimise': 'legitimize', 'legitimised': 'legitimized', 'legitimises': 'legitimizes', 'legitimising': 'legitimizing', 'leukaemia': 'leukemia', 'levelled': 'leveled', 'leveller': 'leveler', 'levellers': 'levelers', 'levelling': 'leveling', 'libelled': 'libeled', 'libelling': 'libeling', 'libellous': 'libelous', 'liberalisation': 'liberalization', 'liberalise': 'liberalize', 'liberalised': 'liberalized', 'liberalises': 'liberalizes', 'liberalising': 'liberalizing', 'licence': 'license', 'licenced': 'licensed', 'licences': 'licenses', 'licencing': 'licensing', 'likeable': 'likable', 'lionisation': 'lionization', 'lionise': 'lionize', 'lionised': 'lionized', 'lionises': 'lionizes', 'lionising': 'lionizing', 'liquidise': 'liquidize', 'liquidised': 'liquidized', 'liquidiser': 'liquidizer', 'liquidisers': 'liquidizers', 'liquidises': 'liquidizes', 'liquidising': 'liquidizing', 'litre': 'liter', 'litres': 'liters', 'localise': 'localize', 'localised': 'localized', 'localises': 'localizes', 'localising': 'localizing', 'louvre': 'louver', 'louvred': 'louvered', 'louvres': 'louvers', 'lustre': 'luster', 'magnetise': 'magnetize', 'magnetised': 'magnetized', 'magnetises': 'magnetizes', 'magnetising': 'magnetizing', 'manoeuvrability': 'maneuverability', 'manoeuvrable': 'maneuverable', 'manoeuvre': 'maneuver', 'manoeuvred': 'maneuvered', 'manoeuvres': 'maneuvers', 'manoeuvring': 'maneuvering', 'manoeuvrings': 'maneuverings', 'marginalisation': 'marginalization', 'marginalise': 'marginalize', 'marginalised': 'marginalized', 'marginalises': 'marginalizes', 'marginalising': 'marginalizing', 'marshalled': 'marshaled', 'marshalling': 'marshaling', 'marvelled': 'marveled', 'marvelling': 'marveling', 'marvellous': 'marvelous', 'marvellously': 'marvelously', 'materialisation': 'materialization', 'materialise': 'materialize', 'materialised': 'materialized', 'materialises': 'materializes', 'materialising': 'materializing', 'maximisation': 'maximization', 'maximise': 'maximize', 'maximised': 'maximized', 'maximises': 'maximizes', 'maximising': 'maximizing', 'meagre': 'meager', 'mechanisation': 'mechanization', 'mechanise': 'mechanize', 'mechanised': 'mechanized', 'mechanises': 'mechanizes', 'mechanising': 'mechanizing', 'mediaeval': 'medieval', 'memorialise': 'memorialize', 'memorialised': 'memorialized', 'memorialises': 'memorializes', 'memorialising': 'memorializing', 'memorise': 'memorize', 'memorised': 'memorized', 'memorises': 'memorizes', 'memorising': 'memorizing', 'mesmerise': 'mesmerize', 'mesmerised': 'mesmerized', 'mesmerises': 'mesmerizes', 'mesmerising': 'mesmerizing', 'metabolise': 'metabolize', 'metabolised': 'metabolized', 'metabolises': 'metabolizes', 'metabolising': 'metabolizing', 'metre': 'meter', 'metres': 'meters', 'mhm': 'hmm', 'micrometre': 'micrometer', 'micrometres': 'micrometers', 'militarise': 'militarize', 'militarised': 'militarized', 'militarises': 'militarizes', 'militarising': 'militarizing', 'milligramme': 'milligram', 'milligrammes': 'milligrams', 'millilitre': 'milliliter', 'millilitres': 'milliliters', 'millimetre': 'millimeter', 'millimetres': 'millimeters', 'miniaturisation': 'miniaturization', 'miniaturise': 'miniaturize', 'miniaturised': 'miniaturized', 'miniaturises': 'miniaturizes', 'miniaturising': 'miniaturizing', 'minibusses': 'minibuses', 'minimise': 'minimize', 'minimised': 'minimized', 'minimises': 'minimizes', 'minimising': 'minimizing', 'misbehaviour': 'misbehavior', 'misdemeanour': 'misdemeanor', 'misdemeanours': 'misdemeanors', 'misspelt': 'misspelled', 'mitre': 'miter', 'mitres': 'miters', 'mm': 'hmm', 'mmm': 'hmm', 'mobilisation': 'mobilization', 'mobilise': 'mobilize', 'mobilised': 'mobilized', 'mobilises': 'mobilizes', 'mobilising': 'mobilizing', 'modelled': 'modeled', 'modeller': 'modeler', 'modellers': 'modelers', 'modelling': 'modeling', 'modernise': 'modernize', 'modernised': 'modernized', 'modernises': 'modernizes', 'modernising': 'modernizing', 'moisturise': 'moisturize', 'moisturised': 'moisturized', 'moisturiser': 'moisturizer', 'moisturisers': 'moisturizers', 'moisturises': 'moisturizes', 'moisturising': 'moisturizing', 'monologue': 'monolog', 'monologues': 'monologs', 'monopolisation': 'monopolization', 'monopolise': 'monopolize', 'monopolised': 'monopolized', 'monopolises': 'monopolizes', 'monopolising': 'monopolizing', 'moralise': 'moralize', 'moralised': 'moralized', 'moralises': 'moralizes', 'moralising': 'moralizing', 'motorised': 'motorized', 'mould': 'mold', 'moulded': 'molded', 'moulder': 'molder', 'mouldered': 'moldered', 'mouldering': 'moldering', 'moulders': 'molders', 'mouldier': 'moldier', 'mouldiest': 'moldiest', 'moulding': 'molding', 'mouldings': 'moldings', 'moulds': 'molds', 'mouldy': 'moldy', 'moult': 'molt', 'moulted': 'molted', 'moulting': 'molting', 'moults': 'molts', 'moustache': 'mustache', 'moustached': 'mustached', 'moustaches': 'mustaches', 'moustachioed': 'mustachioed', 'multicoloured': 'multicolored', 'nationalisation': 'nationalization', 'nationalisations': 'nationalizations', 'nationalise': 'nationalize', 'nationalised': 'nationalized', 'nationalises': 'nationalizes', 'nationalising': 'nationalizing', 'naturalisation': 'naturalization', 'naturalise': 'naturalize', 'naturalised': 'naturalized', 'naturalises': 'naturalizes', 'naturalising': 'naturalizing', 'neighbour': 'neighbor', 'neighbourhood': 'neighborhood', 'neighbourhoods': 'neighborhoods', 'neighbouring': 'neighboring', 'neighbourliness': 'neighborliness', 'neighbourly': 'neighborly', 'neighbours': 'neighbors', 'neutralisation': 'neutralization', 'neutralise': 'neutralize', 'neutralised': 'neutralized', 'neutralises': 'neutralizes', 'neutralising': 'neutralizing', 'normalisation': 'normalization', 'normalise': 'normalize', 'normalised': 'normalized', 'normalises': 'normalizes', 'normalising': 'normalizing', 'odour': 'odor', 'odourless': 'odorless', 'odours': 'odors', 'oesophagus': 'esophagus', 'oesophaguses': 'esophaguses', 'oestrogen': 'estrogen', 'offence': 'offense', 'offences': 'offenses', 'omelette': 'omelet', 'omelettes': 'omelets', 'optimise': 'optimize', 'optimised': 'optimized', 'optimises': 'optimizes', 'optimising': 'optimizing', 'organisation': 'organization', 'organisational': 'organizational', 'organisations': 'organizations', 'organise': 'organize', 'organised': 'organized', 'organiser': 'organizer', 'organisers': 'organizers', 'organises': 'organizes', 'organising': 'organizing', 'orthopaedic': 'orthopedic', 'orthopaedics': 'orthopedics', 'ostracise': 'ostracize', 'ostracised': 'ostracized', 'ostracises': 'ostracizes', 'ostracising': 'ostracizing', 'outmanoeuvre': 'outmaneuver', 'outmanoeuvred': 'outmaneuvered', 'outmanoeuvres': 'outmaneuvers', 'outmanoeuvring': 'outmaneuvering', 'overemphasise': 'overemphasize', 'overemphasised': 'overemphasized', 'overemphasises': 'overemphasizes', 'overemphasising': 'overemphasizing', 'oxidisation': 'oxidization', 'oxidise': 'oxidize', 'oxidised': 'oxidized', 'oxidises': 'oxidizes', 'oxidising': 'oxidizing', 'paederast': 'pederast', 'paederasts': 'pederasts', 'paediatric': 'pediatric', 'paediatrician': 'pediatrician', 'paediatricians': 'pediatricians', 'paediatrics': 'pediatrics', 'paedophile': 'pedophile', 'paedophiles': 'pedophiles', 'paedophilia': 'pedophilia', 'palaeolithic': 'paleolithic', 'palaeontologist': 'paleontologist', 'palaeontologists': 'paleontologists', 'palaeontology': 'paleontology', 'panelled': 'paneled', 'panelling': 'paneling', 'panellist': 'panelist', 'panellists': 'panelists', 'paralyse': 'paralyze', 'paralysed': 'paralyzed', 'paralyses': 'paralyzes', 'paralysing': 'paralyzing', 'parcelled': 'parceled', 'parcelling': 'parceling', 'parlour': 'parlor', 'parlours': 'parlors', 'particularise': 'particularize', 'particularised': 'particularized', 'particularises': 'particularizes', 'particularising': 'particularizing', 'passivisation': 'passivization', 'passivise': 'passivize', 'passivised': 'passivized', 'passivises': 'passivizes', 'passivising': 'passivizing', 'pasteurisation': 'pasteurization', 'pasteurise': 'pasteurize', 'pasteurised': 'pasteurized', 'pasteurises': 'pasteurizes', 'pasteurising': 'pasteurizing', 'patronise': 'patronize', 'patronised': 'patronized', 'patronises': 'patronizes', 'patronising': 'patronizing', 'patronisingly': 'patronizingly', 'pedalled': 'pedaled', 'pedalling': 'pedaling', 'pedestrianisation': 'pedestrianization', 'pedestrianise': 'pedestrianize', 'pedestrianised': 'pedestrianized', 'pedestrianises': 'pedestrianizes', 'pedestrianising': 'pedestrianizing', 'penalise': 'penalize', 'penalised': 'penalized', 'penalises': 'penalizes', 'penalising': 'penalizing', 'pencilled': 'penciled', 'pencilling': 'penciling', 'personalise': 'personalize', 'personalised': 'personalized', 'personalises': 'personalizes', 'personalising': 'personalizing', 'pharmacopoeia': 'pharmacopeia', 'pharmacopoeias': 'pharmacopeias', 'philosophise': 'philosophize', 'philosophised': 'philosophized', 'philosophises': 'philosophizes', 'philosophising': 'philosophizing', 'philtre': 'filter', 'philtres': 'filters', 'phoney': 'phony', 'plagiarise': 'plagiarize', 'plagiarised': 'plagiarized', 'plagiarises': 'plagiarizes', 'plagiarising': 'plagiarizing', 'plough': 'plow', 'ploughed': 'plowed', 'ploughing': 'plowing', 'ploughman': 'plowman', 'ploughmen': 'plowmen', 'ploughs': 'plows', 'ploughshare': 'plowshare', 'ploughshares': 'plowshares', 'polarisation': 'polarization', 'polarise': 'polarize', 'polarised': 'polarized', 'polarises': 'polarizes', 'polarising': 'polarizing', 'politicisation': 'politicization', 'politicise': 'politicize', 'politicised': 'politicized', 'politicises': 'politicizes', 'politicising': 'politicizing', 'popularisation': 'popularization', 'popularise': 'popularize', 'popularised': 'popularized', 'popularises': 'popularizes', 'popularising': 'popularizing', 'pouffe': 'pouf', 'pouffes': 'poufs', 'practise': 'practice', 'practised': 'practiced', 'practises': 'practices', 'practising': 'practicing', 'praesidium': 'presidium', 'praesidiums': 'presidiums', 'pressurisation': 'pressurization', 'pressurise': 'pressurize', 'pressurised': 'pressurized', 'pressurises': 'pressurizes', 'pressurising': 'pressurizing', 'pretence': 'pretense', 'pretences': 'pretenses', 'primaeval': 'primeval', 'prioritisation': 'prioritization', 'prioritise': 'prioritize', 'prioritised': 'prioritized', 'prioritises': 'prioritizes', 'prioritising': 'prioritizing', 'privatisation': 'privatization', 'privatisations': 'privatizations', 'privatise': 'privatize', 'privatised': 'privatized', 'privatises': 'privatizes', 'privatising': 'privatizing', 'professionalisation': 'professionalization', 'professionalise': 'professionalize', 'professionalised': 'professionalized', 'professionalises': 'professionalizes', 'professionalising': 'professionalizing', 'programme': 'program', 'programmes': 'programs', 'prologue': 'prolog', 'prologues': 'prologs', 'propagandise': 'propagandize', 'propagandised': 'propagandized', 'propagandises': 'propagandizes', 'propagandising': 'propagandizing', 'proselytise': 'proselytize', 'proselytised': 'proselytized', 'proselytiser': 'proselytizer', 'proselytisers': 'proselytizers', 'proselytises': 'proselytizes', 'proselytising': 'proselytizing', 'psychoanalyse': 'psychoanalyze', 'psychoanalysed': 'psychoanalyzed', 'psychoanalyses': 'psychoanalyzes', 'psychoanalysing': 'psychoanalyzing', 'publicise': 'publicize', 'publicised': 'publicized', 'publicises': 'publicizes', 'publicising': 'publicizing', 'pulverisation': 'pulverization', 'pulverise': 'pulverize', 'pulverised': 'pulverized', 'pulverises': 'pulverizes', 'pulverising': 'pulverizing', 'pummelled': 'pummel', 'pummelling': 'pummeled', 'pyjama': 'pajama', 'pyjamas': 'pajamas', 'pzazz': 'pizzazz', 'quarrelled': 'quarreled', 'quarrelling': 'quarreling', 'radicalise': 'radicalize', 'radicalised': 'radicalized', 'radicalises': 'radicalizes', 'radicalising': 'radicalizing', 'rancour': 'rancor', 'randomise': 'randomize', 'randomised': 'randomized', 'randomises': 'randomizes', 'randomising': 'randomizing', 'rationalisation': 'rationalization', 'rationalisations': 'rationalizations', 'rationalise': 'rationalize', 'rationalised': 'rationalized', 'rationalises': 'rationalizes', 'rationalising': 'rationalizing', 'ravelled': 'raveled', 'ravelling': 'raveling', 'realisable': 'realizable', 'realisation': 'realization', 'realisations': 'realizations', 'realise': 'realize', 'realised': 'realized', 'realises': 'realizes', 'realising': 'realizing', 'recognisable': 'recognizable', 'recognisably': 'recognizably', 'recognisance': 'recognizance', 'recognise': 'recognize', 'recognised': 'recognized', 'recognises': 'recognizes', 'recognising': 'recognizing', 'reconnoitre': 'reconnoiter', 'reconnoitred': 'reconnoitered', 'reconnoitres': 'reconnoiters', 'reconnoitring': 'reconnoitering', 'refuelled': 'refueled', 'refuelling': 'refueling', 'regularisation': 'regularization', 'regularise': 'regularize', 'regularised': 'regularized', 'regularises': 'regularizes', 'regularising': 'regularizing', 'remodelled': 'remodeled', 'remodelling': 'remodeling', 'remould': 'remold', 'remoulded': 'remolded', 'remoulding': 'remolding', 'remoulds': 'remolds', 'reorganisation': 'reorganization', 'reorganisations': 'reorganizations', 'reorganise': 'reorganize', 'reorganised': 'reorganized', 'reorganises': 'reorganizes', 'reorganising': 'reorganizing', 'revelled': 'reveled', 'reveller': 'reveler', 'revellers': 'revelers', 'revelling': 'reveling', 'revitalise': 'revitalize', 'revitalised': 'revitalized', 'revitalises': 'revitalizes', 'revitalising': 'revitalizing', 'revolutionise': 'revolutionize', 'revolutionised': 'revolutionized', 'revolutionises': 'revolutionizes', 'revolutionising': 'revolutionizing', 'rhapsodise': 'rhapsodize', 'rhapsodised': 'rhapsodized', 'rhapsodises': 'rhapsodizes', 'rhapsodising': 'rhapsodizing', 'rigour': 'rigor', 'rigours': 'rigors', 'ritualised': 'ritualized', 'rivalled': 'rivaled', 'rivalling': 'rivaling', 'romanticise': 'romanticize', 'romanticised': 'romanticized', 'romanticises': 'romanticizes', 'romanticising': 'romanticizing', 'rumour': 'rumor', 'rumoured': 'rumored', 'rumours': 'rumors', 'sabre': 'saber', 'sabres': 'sabers', 'saltpetre': 'saltpeter', 'sanitise': 'sanitize', 'sanitised': 'sanitized', 'sanitises': 'sanitizes', 'sanitising': 'sanitizing', 'satirise': 'satirize', 'satirised': 'satirized', 'satirises': 'satirizes', 'satirising': 'satirizing', 'saviour': 'savior', 'saviours': 'saviors', 'savour': 'savor', 'savoured': 'savored', 'savouries': 'savories', 'savouring': 'savoring', 'savours': 'savors', 'savoury': 'savory', 'scandalise': 'scandalize', 'scandalised': 'scandalized', 'scandalises': 'scandalizes', 'scandalising': 'scandalizing', 'sceptic': 'skeptic', 'sceptical': 'skeptical', 'sceptically': 'skeptically', 'scepticism': 'skepticism', 'sceptics': 'skeptics', 'sceptre': 'scepter', 'sceptres': 'scepters', 'scrutinise': 'scrutinize', 'scrutinised': 'scrutinized', 'scrutinises': 'scrutinizes', 'scrutinising': 'scrutinizing', 'secularisation': 'secularization', 'secularise': 'secularize', 'secularised': 'secularized', 'secularises': 'secularizes', 'secularising': 'secularizing', 'sensationalise': 'sensationalize', 'sensationalised': 'sensationalized', 'sensationalises': 'sensationalizes', 'sensationalising': 'sensationalizing', 'sensitise': 'sensitize', 'sensitised': 'sensitized', 'sensitises': 'sensitizes', 'sensitising': 'sensitizing', 'sentimentalise': 'sentimentalize', 'sentimentalised': 'sentimentalized', 'sentimentalises': 'sentimentalizes', 'sentimentalising': 'sentimentalizing', 'sepulchre': 'sepulcher', 'sepulchres': 'sepulchers', 'serialisation': 'serialization', 'serialisations': 'serializations', 'serialise': 'serialize', 'serialised': 'serialized', 'serialises': 'serializes', 'serialising': 'serializing', 'sermonise': 'sermonize', 'sermonised': 'sermonized', 'sermonises': 'sermonizes', 'sermonising': 'sermonizing', 'sheikh': 'sheik', 'shovelled': 'shoveled', 'shovelling': 'shoveling', 'shrivelled': 'shriveled', 'shrivelling': 'shriveling', 'signalise': 'signalize', 'signalised': 'signalized', 'signalises': 'signalizes', 'signalising': 'signalizing', 'signalled': 'signaled', 'signalling': 'signaling', 'smoulder': 'smolder', 'smouldered': 'smoldered', 'smouldering': 'smoldering', 'smoulders': 'smolders', 'snivelled': 'sniveled', 'snivelling': 'sniveling', 'snorkelled': 'snorkeled', 'snorkelling': 'snorkeling', 'snowplough': 'snowplow', 'snowploughs': 'snowplow', 'socialisation': 'socialization', 'socialise': 'socialize', 'socialised': 'socialized', 'socialises': 'socializes', 'socialising': 'socializing', 'sodomise': 'sodomize', 'sodomised': 'sodomized', 'sodomises': 'sodomizes', 'sodomising': 'sodomizing', 'solemnise': 'solemnize', 'solemnised': 'solemnized', 'solemnises': 'solemnizes', 'solemnising': 'solemnizing', 'sombre': 'somber', 'specialisation': 'specialization', 'specialisations': 'specializations', 'specialise': 'specialize', 'specialised': 'specialized', 'specialises': 'specializes', 'specialising': 'specializing', 'spectre': 'specter', 'spectres': 'specters', 'spiralled': 'spiraled', 'spiralling': 'spiraling', 'splendour': 'splendor', 'splendours': 'splendors', 'squirrelled': 'squirreled', 'squirrelling': 'squirreling', 'stabilisation': 'stabilization', 'stabilise': 'stabilize', 'stabilised': 'stabilized', 'stabiliser': 'stabilizer', 'stabilisers': 'stabilizers', 'stabilises': 'stabilizes', 'stabilising': 'stabilizing', 'standardisation': 'standardization', 'standardise': 'standardize', 'standardised': 'standardized', 'standardises': 'standardizes', 'standardising': 'standardizing', 'stencilled': 'stenciled', 'stencilling': 'stenciling', 'sterilisation': 'sterilization', 'sterilisations': 'sterilizations', 'sterilise': 'sterilize', 'sterilised': 'sterilized', 'steriliser': 'sterilizer', 'sterilisers': 'sterilizers', 'sterilises': 'sterilizes', 'sterilising': 'sterilizing', 'stigmatisation': 'stigmatization', 'stigmatise': 'stigmatize', 'stigmatised': 'stigmatized', 'stigmatises': 'stigmatizes', 'stigmatising': 'stigmatizing', 'storey': 'story', 'storeys': 'stories', 'subsidisation': 'subsidization', 'subsidise': 'subsidize', 'subsidised': 'subsidized', 'subsidiser': 'subsidizer', 'subsidisers': 'subsidizers', 'subsidises': 'subsidizes', 'subsidising': 'subsidizing', 'succour': 'succor', 'succoured': 'succored', 'succouring': 'succoring', 'succours': 'succors', 'sulphate': 'sulfate', 'sulphates': 'sulfates', 'sulphide': 'sulfide', 'sulphides': 'sulfides', 'sulphur': 'sulfur', 'sulphurous': 'sulfurous', 'summarise': 'summarize', 'summarised': 'summarized', 'summarises': 'summarizes', 'summarising': 'summarizing', 'swivelled': 'swiveled', 'swivelling': 'swiveling', 'symbolise': 'symbolize', 'symbolised': 'symbolized', 'symbolises': 'symbolizes', 'symbolising': 'symbolizing', 'sympathise': 'sympathize', 'sympathised': 'sympathized', 'sympathiser': 'sympathizer', 'sympathisers': 'sympathizers', 'sympathises': 'sympathizes', 'sympathising': 'sympathizing', 'synchronisation': 'synchronization', 'synchronise': 'synchronize', 'synchronised': 'synchronized', 'synchronises': 'synchronizes', 'synchronising': 'synchronizing', 'synthesise': 'synthesize', 'synthesised': 'synthesized', 'synthesiser': 'synthesizer', 'synthesisers': 'synthesizers', 'synthesises': 'synthesizes', 'synthesising': 'synthesizing', 'syphon': 'siphon', 'syphoned': 'siphoned', 'syphoning': 'siphoning', 'syphons': 'siphons', 'systematisation': 'systematization', 'systematise': 'systematize', 'systematised': 'systematized', 'systematises': 'systematizes', 'systematising': 'systematizing', 'tantalise': 'tantalize', 'tantalised': 'tantalized', 'tantalises': 'tantalizes', 'tantalising': 'tantalizing', 'tantalisingly': 'tantalizingly', 'tasselled': 'tasseled', 'technicolour': 'technicolor', 'temporise': 'temporize', 'temporised': 'temporized', 'temporises': 'temporizes', 'temporising': 'temporizing', 'tenderise': 'tenderize', 'tenderised': 'tenderized', 'tenderises': 'tenderizes', 'tenderising': 'tenderizing', 'terrorise': 'terrorize', 'terrorised': 'terrorized', 'terrorises': 'terrorizes', 'terrorising': 'terrorizing', 'theatre': 'theater', 'theatregoer': 'theatergoer', 'theatregoers': 'theatergoers', 'theatres': 'theaters', 'theorise': 'theorize', 'theorised': 'theorized', 'theorises': 'theorizes', 'theorising': 'theorizing', 'tonne': 'ton', 'tonnes': 'tons', 'towelled': 'toweled', 'towelling': 'toweling', 'toxaemia': 'toxemia', 'tranquillise': 'tranquilize', 'tranquillised': 'tranquilized', 'tranquilliser': 'tranquilizer', 'tranquillisers': 'tranquilizers', 'tranquillises': 'tranquilizes', 'tranquillising': 'tranquilizing', 'tranquillity': 'tranquility', 'tranquillize': 'tranquilize', 'tranquillized': 'tranquilized', 'tranquillizer': 'tranquilizer', 'tranquillizers': 'tranquilizers', 'tranquillizes': 'tranquilizes', 'tranquillizing': 'tranquilizing', 'tranquilly': 'tranquility', 'transistorised': 'transistorized', 'traumatise': 'traumatize', 'traumatised': 'traumatized', 'traumatises': 'traumatizes', 'traumatising': 'traumatizing', 'travelled': 'traveled', 'traveller': 'traveler', 'travellers': 'travelers', 'travelling': 'traveling', 'travelog': 'travelogue', 'travelogs': 'travelogues', 'trialled': 'trialed', 'trialling': 'trialing', 'tricolour': 'tricolor', 'tricolours': 'tricolors', 'trivialise': 'trivialize', 'trivialised': 'trivialized', 'trivialises': 'trivializes', 'trivialising': 'trivializing', 'tumour': 'tumor', 'tumours': 'tumors', 'tunnelled': 'tunneled', 'tunnelling': 'tunneling', 'tyrannise': 'tyrannize', 'tyrannised': 'tyrannized', 'tyrannises': 'tyrannizes', 'tyrannising': 'tyrannizing', 'tyre': 'tire', 'tyres': 'tires', 'unauthorised': 'unauthorized', 'uncivilised': 'uncivilized', 'underutilised': 'underutilized', 'unequalled': 'unequaled', 'unfavourable': 'unfavorable', 'unfavourably': 'unfavorably', 'unionisation': 'unionization', 'unionise': 'unionize', 'unionised': 'unionized', 'unionises': 'unionizes', 'unionising': 'unionizing', 'unorganised': 'unorganized', 'unravelled': 'unraveled', 'unravelling': 'unraveling', 'unrecognisable': 'unrecognizable', 'unrecognised': 'unrecognized', 'unrivalled': 'unrivaled', 'unsavoury': 'unsavory', 'untrammelled': 'untrammeled', 'urbanisation': 'urbanization', 'urbanise': 'urbanize', 'urbanised': 'urbanized', 'urbanises': 'urbanizes', 'urbanising': 'urbanizing', 'utilisable': 'utilizable', 'utilisation': 'utilization', 'utilise': 'utilize', 'utilised': 'utilized', 'utilises': 'utilizes', 'utilising': 'utilizing', 'valour': 'valor', 'vandalise': 'vandalize', 'vandalised': 'vandalized', 'vandalises': 'vandalizes', 'vandalising': 'vandalizing', 'vaporisation': 'vaporization', 'vaporise': 'vaporize', 'vaporised': 'vaporized', 'vaporises': 'vaporizes', 'vaporising': 'vaporizing', 'vapour': 'vapor', 'vapours': 'vapors', 'verbalise': 'verbalize', 'verbalised': 'verbalized', 'verbalises': 'verbalizes', 'verbalising': 'verbalizing', 'victimisation': 'victimization', 'victimise': 'victimize', 'victimised': 'victimized', 'victimises': 'victimizes', 'victimising': 'victimizing', 'videodisc': 'videodisk', 'videodiscs': 'videodisks', 'vigour': 'vigor', 'visualisation': 'visualization', 'visualisations': 'visualizations', 'visualise': 'visualize', 'visualised': 'visualized', 'visualises': 'visualizes', 'visualising': 'visualizing', 'vocalisation': 'vocalization', 'vocalisations': 'vocalizations', 'vocalise': 'vocalize', 'vocalised': 'vocalized', 'vocalises': 'vocalizes', 'vocalising': 'vocalizing', 'vulcanised': 'vulcanized', 'vulgarisation': 'vulgarization', 'vulgarise': 'vulgarize', 'vulgarised': 'vulgarized', 'vulgarises': 'vulgarizes', 'vulgarising': 'vulgarizing', 'waggon': 'wagon', 'waggons': 'wagons', 'watercolour': 'watercolor', 'watercolours': 'watercolors', 'weaselled': 'weaseled', 'weaselling': 'weaseling', 'westernisation': 'westernization', 'westernise': 'westernize', 'westernised': 'westernized', 'westernises': 'westernizes', 'westernising': 'westernizing', 'womanise': 'womanize', 'womanised': 'womanized', 'womaniser': 'womanizer', 'womanisers': 'womanizers', 'womanises': 'womanizes', 'womanising': 'womanizing', 'woollen': 'woolen', 'woollens': 'woolens', 'woollies': 'woolies', 'woolly': 'wooly', 'worshipped': 'worshiped', 'worshipper': 'worshiper', 'worshipping': 'worshiping', 'yodelled': 'yodeled', 'yodelling': 'yodeling', 'yoghourt': 'yogurt', 'yoghourts': 'yogurts', 'yoghurt': 'yogurt', 'yoghurts': 'yogurts'}

# File: open_asr_leaderboard-main/normalizer/eval_utils.py
import os
import glob
import json
import evaluate
from collections import defaultdict

def read_manifest(manifest_path: str):
    data = []
    with open(manifest_path, 'r', encoding='utf-8') as f:
        for line in f:
            if len(line) > 0:
                datum = json.loads(line)
                data.append(datum)
    return data

def write_manifest(references: list, transcriptions: list, model_id: str, dataset_path: str, dataset_name: str, split: str, audio_length: list=None, transcription_time: list=None):
    model_id = model_id.replace('/', '-')
    dataset_path = dataset_path.replace('/', '-')
    dataset_name = dataset_name.replace('/', '-')
    if len(references) != len(transcriptions):
        raise ValueError(f'The number of samples in `references` ({len(references)}) must match `transcriptions` ({len(transcriptions)}).')
    if audio_length is not None and len(audio_length) != len(references):
        raise ValueError(f'The number of samples in `audio_length` ({len(audio_length)}) must match `references` ({len(references)}).')
    if transcription_time is not None and len(transcription_time) != len(references):
        raise ValueError(f'The number of samples in `transcription_time` ({len(transcription_time)}) must match `references` ({len(references)}).')
    audio_length = audio_length if audio_length is not None else len(references) * [None]
    transcription_time = transcription_time if transcription_time is not None else len(references) * [None]
    basedir = './results/'
    if not os.path.exists(basedir):
        os.makedirs(basedir)
    manifest_path = os.path.join(basedir, f'MODEL_{model_id}_DATASET_{dataset_path}_{dataset_name}_{split}.jsonl')
    with open(manifest_path, 'w', encoding='utf-8') as f:
        for (idx, (text, transcript, audio_length, transcription_time)) in enumerate(zip(references, transcriptions, audio_length, transcription_time)):
            datum = {'audio_filepath': f'sample_{idx}', 'duration': audio_length, 'time': transcription_time, 'text': text, 'pred_text': transcript}
            f.write(f'{json.dumps(datum, ensure_ascii=False)}\n')
    return manifest_path

def score_results(directory: str, model_id: str=None):
    if directory.endswith(os.pathsep):
        directory = directory[:-1]
    result_files = list(glob.glob(f'{directory}/**/*.jsonl', recursive=True))
    result_files = list(sorted(result_files))
    if model_id is not None and model_id != '':
        print('Filtering models by id:', model_id)
        model_id = model_id.replace('/', '-')
        result_files = [fp for fp in result_files if model_id in fp]
    if len(result_files) == 0:
        raise ValueError(f'No result files found in {directory}')

    def parse_filepath(fp: str):
        model_index = fp.find('MODEL_')
        fp = fp[model_index:]
        ds_index = fp.find('DATASET_')
        model_id = fp[:ds_index].replace('MODEL_', '').rstrip('_')
        author_index = model_id.find('-')
        model_id = model_id[:author_index] + '/' + model_id[author_index + 1:]
        ds_fp = fp[ds_index:]
        dataset_id = ds_fp.replace('DATASET_', '').rstrip('.jsonl')
        return (model_id, dataset_id)
    results = {}
    wer_metric = evaluate.load('wer')
    for result_file in result_files:
        manifest = read_manifest(result_file)
        (model_id_of_file, dataset_id) = parse_filepath(result_file)
        references = [datum['text'] for datum in manifest]
        predictions = [datum['pred_text'] for datum in manifest]
        time = [datum['time'] for datum in manifest]
        duration = [datum['duration'] for datum in manifest]
        compute_rtfx = all(time) and all(duration)
        wer = wer_metric.compute(references=references, predictions=predictions)
        wer = round(100 * wer, 2)
        if compute_rtfx:
            audio_length = sum(duration)
            inference_time = sum(time)
            rtfx = round(sum(duration) / sum(time), 4)
        else:
            audio_length = inference_time = rtfx = None
        result_key = f'{model_id_of_file} | {dataset_id}'
        results[result_key] = {'wer': wer, 'audio_length': audio_length, 'inference_time': inference_time, 'rtfx': rtfx}
    print('*' * 80)
    print('Results per dataset:')
    print('*' * 80)
    for (k, v) in results.items():
        metrics = f"{k}: WER = {v['wer']:0.2f} %"
        if v['rtfx'] is not None:
            metrics += f", RTFx = {v['rtfx']:0.2f}"
        print(metrics)
    composite_wer = defaultdict(float)
    composite_audio_length = defaultdict(float)
    composite_inference_time = defaultdict(float)
    count_entries = defaultdict(int)
    for (k, v) in results.items():
        key = k.split('|')[0].strip()
        composite_wer[key] += v['wer']
        if v['rtfx'] is not None:
            composite_audio_length[key] += v['audio_length']
            composite_inference_time[key] += v['inference_time']
        else:
            composite_audio_length[key] = composite_inference_time[key] = None
        count_entries[key] += 1
    print()
    print('*' * 80)
    print('Composite Results:')
    print('*' * 80)
    for (k, v) in composite_wer.items():
        wer = v / count_entries[k]
        print(f'{k}: WER = {wer:0.2f} %')
    for k in composite_audio_length:
        if composite_audio_length[k] is not None:
            rtfx = composite_audio_length[k] / composite_inference_time[k]
            print(f'{k}: RTFx = {rtfx:0.2f}')
    print('*' * 80)
    return (composite_wer, results)

# File: open_asr_leaderboard-main/normalizer/normalizer.py
import re
import unicodedata
from fractions import Fraction
from typing import Iterator, List, Match, Optional, Union
from .english_abbreviations import english_spelling_normalizer
import regex
ADDITIONAL_DIACRITICS = {'œ': 'oe', 'Œ': 'OE', 'ø': 'o', 'Ø': 'O', 'æ': 'ae', 'Æ': 'AE', 'ß': 'ss', 'ẞ': 'SS', 'đ': 'd', 'Đ': 'D', 'ð': 'd', 'Ð': 'D', 'þ': 'th', 'Þ': 'th', 'ł': 'l', 'Ł': 'L'}

def remove_symbols_and_diacritics(s: str, keep=''):

    def replace_character(char):
        if char in keep:
            return char
        elif char in ADDITIONAL_DIACRITICS:
            return ADDITIONAL_DIACRITICS[char]
        elif unicodedata.category(char) == 'Mn':
            return ''
        elif unicodedata.category(char)[0] in 'MSP':
            return ' '
        return char
    return ''.join((replace_character(c) for c in unicodedata.normalize('NFKD', s)))

def remove_symbols(s: str):
    return ''.join((' ' if unicodedata.category(c)[0] in 'MSP' else c for c in unicodedata.normalize('NFKC', s)))

class BasicTextNormalizer:

    def __init__(self, remove_diacritics: bool=False, split_letters: bool=False):
        self.clean = remove_symbols_and_diacritics if remove_diacritics else remove_symbols
        self.split_letters = split_letters

    def __call__(self, s: str):
        s = s.lower()
        s = re.sub('[<\\[][^>\\]]*[>\\]]', '', s)
        s = re.sub('\\(([^)]+?)\\)', '', s)
        s = self.clean(s).lower()
        if self.split_letters:
            s = ' '.join(regex.findall('\\X', s, regex.U))
        s = re.sub('\\s+', ' ', s)
        return s

class EnglishNumberNormalizer:

    def __init__(self):
        super().__init__()
        self.zeros = {'o', 'oh', 'zero'}
        self.ones = {name: i for (i, name) in enumerate(['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen'], start=1)}
        self.ones_plural = {'sixes' if name == 'six' else name + 's': (value, 's') for (name, value) in self.ones.items()}
        self.ones_ordinal = {'zeroth': (0, 'th'), 'first': (1, 'st'), 'second': (2, 'nd'), 'third': (3, 'rd'), 'fifth': (5, 'th'), 'twelfth': (12, 'th'), **{name + ('h' if name.endswith('t') else 'th'): (value, 'th') for (name, value) in self.ones.items() if value > 3 and value != 5 and (value != 12)}}
        self.ones_suffixed = {**self.ones_plural, **self.ones_ordinal}
        self.tens = {'twenty': 20, 'thirty': 30, 'forty': 40, 'fifty': 50, 'sixty': 60, 'seventy': 70, 'eighty': 80, 'ninety': 90}
        self.tens_plural = {name.replace('y', 'ies'): (value, 's') for (name, value) in self.tens.items()}
        self.tens_ordinal = {name.replace('y', 'ieth'): (value, 'th') for (name, value) in self.tens.items()}
        self.tens_suffixed = {**self.tens_plural, **self.tens_ordinal}
        self.multipliers = {'hundred': 100, 'thousand': 1000, 'million': 1000000, 'billion': 1000000000, 'trillion': 1000000000000, 'quadrillion': 1000000000000000, 'quintillion': 1000000000000000000, 'sextillion': 1000000000000000000000, 'septillion': 1000000000000000000000000, 'octillion': 1000000000000000000000000000, 'nonillion': 1000000000000000000000000000000, 'decillion': 1000000000000000000000000000000000}
        self.multipliers_plural = {name + 's': (value, 's') for (name, value) in self.multipliers.items()}
        self.multipliers_ordinal = {name + 'th': (value, 'th') for (name, value) in self.multipliers.items()}
        self.multipliers_suffixed = {**self.multipliers_plural, **self.multipliers_ordinal}
        self.decimals = {*self.ones, *self.tens, *self.zeros}
        self.preceding_prefixers = {'minus': '-', 'negative': '-', 'plus': '+', 'positive': '+'}
        self.following_prefixers = {'pound': '£', 'pounds': '£', 'euro': '€', 'euros': '€', 'dollar': '$', 'dollars': '$', 'cent': '¢', 'cents': '¢'}
        self.prefixes = set(list(self.preceding_prefixers.values()) + list(self.following_prefixers.values()))
        self.suffixers = {'per': {'cent': '%'}, 'percent': '%'}
        self.specials = {'and', 'double', 'triple', 'point'}
        self.words = {key for mapping in [self.zeros, self.ones, self.ones_suffixed, self.tens, self.tens_suffixed, self.multipliers, self.multipliers_suffixed, self.preceding_prefixers, self.following_prefixers, self.suffixers, self.specials] for key in mapping}
        self.literal_words = {'one', 'ones'}

    def process_words(self, words: List[str]) -> Iterator[str]:
        prefix: Optional[str] = None
        value: Optional[Union[str, int]] = None
        skip = False

        def to_fraction(s: str):
            try:
                return Fraction(s)
            except ValueError:
                return None

        def output(result: Union[str, int]):
            nonlocal prefix, value
            result = str(result)
            if prefix is not None:
                result = prefix + result
            value = None
            prefix = None
            return result
        if len(words) == 0:
            return
        for (i, current) in enumerate(words):
            prev = words[i - 1] if i != 0 else None
            next = words[i + 1] if i != len(words) - 1 else None
            if skip:
                skip = False
                continue
            next_is_numeric = next is not None and re.match('^\\d+(\\.\\d+)?$', next)
            has_prefix = current[0] in self.prefixes
            current_without_prefix = current[1:] if has_prefix else current
            if re.match('^\\d+(\\.\\d+)?$', current_without_prefix):
                f = to_fraction(current_without_prefix)
                if f is None:
                    raise ValueError('Converting the fraction failed')
                if value is not None:
                    if isinstance(value, str) and value.endswith('.'):
                        value = str(value) + str(current)
                        continue
                    else:
                        yield output(value)
                prefix = current[0] if has_prefix else prefix
                if f.denominator == 1:
                    value = f.numerator
                else:
                    value = current_without_prefix
            elif current not in self.words:
                if value is not None:
                    yield output(value)
                yield output(current)
            elif current in self.zeros:
                value = str(value or '') + '0'
            elif current in self.ones:
                ones = self.ones[current]
                if value is None:
                    value = ones
                elif isinstance(value, str) or prev in self.ones:
                    if prev in self.tens and ones < 10:
                        value = value[:-1] + str(ones)
                    else:
                        value = str(value) + str(ones)
                elif ones < 10:
                    if value % 10 == 0:
                        value += ones
                    else:
                        value = str(value) + str(ones)
                elif value % 100 == 0:
                    value += ones
                else:
                    value = str(value) + str(ones)
            elif current in self.ones_suffixed:
                (ones, suffix) = self.ones_suffixed[current]
                if value is None:
                    yield output(str(ones) + suffix)
                elif isinstance(value, str) or prev in self.ones:
                    if prev in self.tens and ones < 10:
                        yield output(value[:-1] + str(ones) + suffix)
                    else:
                        yield output(str(value) + str(ones) + suffix)
                elif ones < 10:
                    if value % 10 == 0:
                        yield output(str(value + ones) + suffix)
                    else:
                        yield output(str(value) + str(ones) + suffix)
                elif value % 100 == 0:
                    yield output(str(value + ones) + suffix)
                else:
                    yield output(str(value) + str(ones) + suffix)
                value = None
            elif current in self.tens:
                tens = self.tens[current]
                if value is None:
                    value = tens
                elif isinstance(value, str):
                    value = str(value) + str(tens)
                elif value % 100 == 0:
                    value += tens
                else:
                    value = str(value) + str(tens)
            elif current in self.tens_suffixed:
                (tens, suffix) = self.tens_suffixed[current]
                if value is None:
                    yield output(str(tens) + suffix)
                elif isinstance(value, str):
                    yield output(str(value) + str(tens) + suffix)
                elif value % 100 == 0:
                    yield output(str(value + tens) + suffix)
                else:
                    yield output(str(value) + str(tens) + suffix)
            elif current in self.multipliers:
                multiplier = self.multipliers[current]
                if value is None:
                    value = multiplier
                elif isinstance(value, str) or value == 0:
                    f = to_fraction(value)
                    p = f * multiplier if f is not None else None
                    if f is not None and p.denominator == 1:
                        value = p.numerator
                    else:
                        yield output(value)
                        value = multiplier
                else:
                    before = value // 1000 * 1000
                    residual = value % 1000
                    value = before + residual * multiplier
            elif current in self.multipliers_suffixed:
                (multiplier, suffix) = self.multipliers_suffixed[current]
                if value is None:
                    yield output(str(multiplier) + suffix)
                elif isinstance(value, str):
                    f = to_fraction(value)
                    p = f * multiplier if f is not None else None
                    if f is not None and p.denominator == 1:
                        yield output(str(p.numerator) + suffix)
                    else:
                        yield output(value)
                        yield output(str(multiplier) + suffix)
                else:
                    before = value // 1000 * 1000
                    residual = value % 1000
                    value = before + residual * multiplier
                    yield output(str(value) + suffix)
                value = None
            elif current in self.preceding_prefixers:
                if value is not None:
                    yield output(value)
                if next in self.words or next_is_numeric:
                    prefix = self.preceding_prefixers[current]
                else:
                    yield output(current)
            elif current in self.following_prefixers:
                if value is not None:
                    prefix = self.following_prefixers[current]
                    yield output(value)
                else:
                    yield output(current)
            elif current in self.suffixers:
                if value is not None:
                    suffix = self.suffixers[current]
                    if isinstance(suffix, dict):
                        if next in suffix:
                            yield output(str(value) + suffix[next])
                            skip = True
                        else:
                            yield output(value)
                            yield output(current)
                    else:
                        yield output(str(value) + suffix)
                else:
                    yield output(current)
            elif current in self.specials:
                if next not in self.words and (not next_is_numeric):
                    if value is not None:
                        yield output(value)
                    yield output(current)
                elif current == 'and':
                    if prev not in self.multipliers:
                        if value is not None:
                            yield output(value)
                        yield output(current)
                elif current == 'double' or current == 'triple':
                    if next in self.ones or next in self.zeros:
                        repeats = 2 if current == 'double' else 3
                        ones = self.ones.get(next, 0)
                        value = str(value or '') + str(ones) * repeats
                        skip = True
                    else:
                        if value is not None:
                            yield output(value)
                        yield output(current)
                elif current == 'point':
                    if next in self.decimals or next_is_numeric:
                        value = str(value or '') + '.'
                else:
                    raise ValueError(f'Unexpected token: {current}')
            else:
                raise ValueError(f'Unexpected token: {current}')
        if value is not None:
            yield output(value)

    def preprocess(self, s: str):
        results = []
        segments = re.split('\\band\\s+a\\s+half\\b', s)
        for (i, segment) in enumerate(segments):
            if len(segment.strip()) == 0:
                continue
            if i == len(segments) - 1:
                results.append(segment)
            else:
                results.append(segment)
                last_word = segment.rsplit(maxsplit=2)[-1]
                if last_word in self.decimals or last_word in self.multipliers:
                    results.append('point five')
                else:
                    results.append('and a half')
        s = ' '.join(results)
        s = re.sub('([a-z])([0-9])', '\\1 \\2', s)
        s = re.sub('([0-9])([a-z])', '\\1 \\2', s)
        s = re.sub('([0-9])\\s+(st|nd|rd|th|s)\\b', '\\1\\2', s)
        return s

    def postprocess(self, s: str):

        def combine_cents(m: Match):
            try:
                currency = m.group(1)
                integer = m.group(2)
                cents = int(m.group(3))
                return f'{currency}{integer}.{cents:02d}'
            except ValueError:
                return m.string

        def extract_cents(m: Match):
            try:
                return f'¢{int(m.group(1))}'
            except ValueError:
                return m.string
        s = re.sub('([€£$])([0-9]+) (?:and )?¢([0-9]{1,2})\\b', combine_cents, s)
        s = re.sub('[€£$]0.([0-9]{1,2})\\b', extract_cents, s)
        s = re.sub('\\b1(s?)\\b', 'one\\1', s)
        return s

    def __call__(self, s: str):
        s = self.preprocess(s)
        s = ' '.join((word for word in self.process_words(s.split()) if word is not None))
        s = self.postprocess(s)
        return s

class EnglishSpellingNormalizer:

    def __init__(self, english_spelling_mapping):
        self.mapping = english_spelling_mapping

    def __call__(self, s: str):
        return ' '.join((self.mapping.get(word, word) for word in s.split()))

class EnglishTextNormalizer:

    def __init__(self, english_spelling_mapping=english_spelling_normalizer):
        self.ignore_patterns = '\\b(hmm|mm|mhm|mmm|uh|um)\\b'
        self.replacers = {"\\bwon't\\b": 'will not', "\\bcan't\\b": 'can not', "\\blet's\\b": 'let us', "\\bain't\\b": 'aint', "\\by'all\\b": 'you all', '\\bwanna\\b': 'want to', '\\bgotta\\b': 'got to', '\\bgonna\\b': 'going to', "\\bi'ma\\b": 'i am going to', '\\bimma\\b': 'i am going to', '\\bwoulda\\b': 'would have', '\\bcoulda\\b': 'could have', '\\bshoulda\\b': 'should have', "\\bma'am\\b": 'madam', '\\bmr\\b': 'mister ', '\\bmrs\\b': 'missus ', '\\bst\\b': 'saint ', '\\bdr\\b': 'doctor ', '\\bprof\\b': 'professor ', '\\bcapt\\b': 'captain ', '\\bgov\\b': 'governor ', '\\bald\\b': 'alderman ', '\\bgen\\b': 'general ', '\\bsen\\b': 'senator ', '\\brep\\b': 'representative ', '\\bpres\\b': 'president ', '\\brev\\b': 'reverend ', '\\bhon\\b': 'honorable ', '\\basst\\b': 'assistant ', '\\bassoc\\b': 'associate ', '\\blt\\b': 'lieutenant ', '\\bcol\\b': 'colonel ', '\\bjr\\b': 'junior ', '\\bsr\\b': 'senior ', '\\besq\\b': 'esquire ', "'d been\\b": ' had been', "'s been\\b": ' has been', "'d gone\\b": ' had gone', "'s gone\\b": ' has gone', "'d done\\b": ' had done', "'s got\\b": ' has got', "n't\\b": ' not', "'re\\b": ' are', "'s\\b": ' is', "'d\\b": ' would', "'ll\\b": ' will', "'t\\b": ' not', "'ve\\b": ' have', "'m\\b": ' am'}
        self.standardize_numbers = EnglishNumberNormalizer()
        self.standardize_spellings = EnglishSpellingNormalizer(english_spelling_mapping)

    def __call__(self, s: str):
        s = s.lower()
        s = re.sub('[<\\[][^>\\]]*[>\\]]', '', s)
        s = re.sub('\\(([^)]+?)\\)', '', s)
        s = re.sub(self.ignore_patterns, '', s)
        s = re.sub("\\s+'", "'", s)
        for (pattern, replacement) in self.replacers.items():
            s = re.sub(pattern, replacement, s)
        s = re.sub('(\\d),(\\d)', '\\1\\2', s)
        s = re.sub('\\.([^0-9]|$)', ' \\1', s)
        s = remove_symbols_and_diacritics(s, keep='.%$¢€£')
        s = self.standardize_numbers(s)
        s = self.standardize_spellings(s)
        s = re.sub('[.$¢€£]([^0-9])', ' \\1', s)
        s = re.sub('([^0-9])%', '\\1 ', s)
        s = re.sub('\\s+', ' ', s)
        return s

# File: open_asr_leaderboard-main/speechbrain/run_eval.py
""""""
import argparse
import time
import evaluate
from normalizer import data_utils
from tqdm import tqdm
import torch
import speechbrain.inference.ASR as ASR
from speechbrain.utils.data_utils import batch_pad_right
import os

def get_model(speechbrain_repository: str, speechbrain_pretrained_class_name: str, **kwargs):
    run_opt_defaults = {'device': 'cpu', 'data_parallel_count': -1, 'data_parallel_backend': False, 'distributed_launch': False, 'distributed_backend': 'nccl', 'jit_module_keys': None}
    run_opts = {**run_opt_defaults, **kwargs}
    kwargs = {'source': f'{speechbrain_repository}', 'savedir': f'pretrained_models/{speechbrain_repository}', 'run_opts': run_opts}
    try:
        model_class = getattr(ASR, speechbrain_pretrained_class_name)
    except AttributeError:
        raise AttributeError(f'SpeechBrain Pretrained class: {speechbrain_pretrained_class_name} not found in pretrained.py')
    return model_class.from_hparams(**kwargs)

def main(args):
    if args.device == -1:
        device = 'cpu'
    else:
        device = f'cuda:{args.device}'
    model = get_model(args.source, args.speechbrain_pretrained_class_name, device=device)

    def benchmark(batch):
        audios = [torch.from_numpy(sample['array']) for sample in batch['audio']]
        minibatch_size = len(audios)
        start_time = time.time()
        (audios, audio_lens) = batch_pad_right(audios)
        audios = audios.to(device)
        audio_lens = audio_lens.to(device)
        (predictions, _) = model.transcribe_batch(audios, audio_lens)
        runtime = time.time() - start_time
        batch['transcription_time_s'] = minibatch_size * [runtime / minibatch_size]
        batch['predictions'] = [data_utils.normalizer(pred) for pred in predictions]
        batch['references'] = batch['norm_text']
        return batch
    if args.warmup_steps is not None:
        dataset = data_utils.load_data(args)
        dataset = data_utils.prepare_data(dataset)
        num_warmup_samples = args.warmup_steps * args.batch_size
        if args.streaming:
            warmup_dataset = dataset.take(num_warmup_samples)
        else:
            warmup_dataset = dataset.select(range(min(num_warmup_samples, len(dataset))))
        warmup_dataset = iter(warmup_dataset.map(benchmark, batch_size=args.batch_size, batched=True))
        for _ in tqdm(warmup_dataset, desc='Warming up...'):
            continue
    dataset = data_utils.load_data(args)
    if args.max_eval_samples is not None and args.max_eval_samples > 0:
        print(f'Subsampling dataset to first {args.max_eval_samples} samples!')
        if args.streaming:
            dataset = dataset.take(args.max_eval_samples)
        else:
            dataset = dataset.select(range(min(args.max_eval_samples, len(dataset))))
    dataset = data_utils.prepare_data(dataset)
    dataset = dataset.map(benchmark, batch_size=args.batch_size, batched=True, remove_columns=['audio'])
    all_results = {'audio_length_s': [], 'transcription_time_s': [], 'predictions': [], 'references': []}
    result_iter = iter(dataset)
    for result in tqdm(result_iter, desc='Samples...'):
        for key in all_results:
            all_results[key].append(result[key])
    manifest_path = data_utils.write_manifest(all_results['references'], all_results['predictions'], args.source, args.dataset_path, args.dataset, args.split, audio_length=all_results['audio_length_s'], transcription_time=all_results['transcription_time_s'])
    print('Results saved at path:', os.path.abspath(manifest_path))
    wer_metric = evaluate.load('wer')
    wer = wer_metric.compute(references=all_results['references'], predictions=all_results['predictions'])
    wer = round(100 * wer, 2)
    rtfx = round(sum(all_results['audio_length_s']) / sum(all_results['transcription_time_s']), 2)
    print('WER:', wer, '%', 'RTFx:', rtfx)
if __name__ == '__main__':
    parser = argparse.ArgumentParser()
    parser.add_argument('--source', type=str, required=True, help='SpeechBrain model repository. E.g. `asr-crdnn-rnnlm-librispeech`')
    parser.add_argument('--speechbrain_pretrained_class_name', type=str, required=True, help='SpeechBrain pretrained class name. E.g. `EncoderASR`')
    parser.add_argument('--dataset_path', type=str, default='hf-audio/esb-datasets-test-only-sorted', help='Dataset path. By default, it is `esb/datasets`')
    parser.add_argument('--dataset', type=str, required=True, help="Dataset name. *E.g.* `'librispeech_asr` for the LibriSpeech ASR dataset, or `'common_voice'` for Common Voice. The full list of dataset names can be found at `https://huggingface.co/datasets/esb/datasets`")
    parser.add_argument('--split', type=str, default='test', help="Split of the dataset. *E.g.* `'validation`' for the dev split, or `'test'` for the test split.")
    parser.add_argument('--device', type=int, default=-1, help='The device to run the pipeline on. -1 for CPU (default), 0 for the first GPU and so on.')
    parser.add_argument('--batch_size', type=int, default=16, help='Number of samples to go through each streamed batch.')
    parser.add_argument('--max_eval_samples', type=int, default=None, help='Number of samples to be evaluated. Put a lower number e.g. 64 for testing this script.')
    parser.add_argument('--no-streaming', dest='streaming', action='store_false', help="Choose whether you'd like to download the entire dataset or stream it during the evaluation.")
    parser.add_argument('--warmup_steps', type=int, default=5, help='Number of warm-up steps to run before launching the timed runs.')
    args = parser.parse_args()
    parser.set_defaults(streaming=True)
    main(args)

# File: open_asr_leaderboard-main/transformers/run_eval.py
import argparse
import os
import torch
from torch.nn.attention import sdpa_kernel, SDPBackend
from transformers import AutoConfig, AutoModelForSpeechSeq2Seq, AutoModelForCTC, AutoProcessor, MODEL_FOR_SPEECH_SEQ_2_SEQ_MAPPING
import evaluate
from normalizer import data_utils
import time
from tqdm import tqdm
wer_metric = evaluate.load('wer')
torch.set_float32_matmul_precision('high')

def main(args):
    config = AutoConfig.from_pretrained(args.model_id)
    cls_model = AutoModelForSpeechSeq2Seq if type(config) in MODEL_FOR_SPEECH_SEQ_2_SEQ_MAPPING else AutoModelForCTC
    model = cls_model.from_pretrained(args.model_id, torch_dtype=torch.bfloat16, attn_implementation='sdpa').to(args.device)
    processor = AutoProcessor.from_pretrained(args.model_id)
    model_input_name = processor.model_input_names[0]
    if model.can_generate():
        gen_kwargs = {'max_new_tokens': args.max_new_tokens}
        if getattr(model.generation_config, 'is_multilingual'):
            gen_kwargs['language'] = 'en'
            gen_kwargs['task'] = 'transcribe'
    elif args.max_new_tokens:
        raise ValueError('`max_new_tokens` should only be set for auto-regressive models, but got a CTC model.')
    if args.torch_compile:
        model.forward = torch.compile(model.forward, mode=args.compile_mode, fullgraph=True)
        if model.can_generate():
            model.generation_config.cache_implementation = 'static'

    def benchmark(batch, min_new_tokens=None):
        audios = [audio['array'] for audio in batch['audio']]
        minibatch_size = len(audios)
        start_time = time.time()
        padding_size = None
        if minibatch_size != args.batch_size and args.torch_compile:
            padding_size = args.batch_size - minibatch_size
            padding_audios = [audios[-1] for _ in range(padding_size)]
            audios.extend(padding_audios)
        if not model.can_generate():
            inputs = processor(audios, sampling_rate=16000, truncation=False, padding='longest', return_tensors='pt', return_attention_mask=True)
        else:
            inputs = processor(audios, sampling_rate=16000, return_tensors='pt', device=args.device)
        inputs = inputs.to(args.device)
        inputs[model_input_name] = inputs[model_input_name].to(torch.bfloat16)
        with sdpa_kernel(SDPBackend.MATH if args.torch_compile else SDPBackend.FLASH_ATTENTION):
            if model.can_generate():
                pred_ids = model.generate(**inputs, **gen_kwargs, min_new_tokens=min_new_tokens)
            else:
                with torch.no_grad():
                    logits = model(**inputs).logits
                    pred_ids = logits.argmax(-1)
        if padding_size is not None:
            pred_ids = pred_ids[:-padding_size, ...]
        pred_text = processor.batch_decode(pred_ids, skip_special_tokens=True)
        runtime = time.time() - start_time
        batch['transcription_time_s'] = minibatch_size * [runtime / minibatch_size]
        batch['predictions'] = [data_utils.normalizer(pred) for pred in pred_text]
        batch['references'] = batch['norm_text']
        return batch
    if args.warmup_steps is not None:
        dataset = data_utils.load_data(args)
        dataset = data_utils.prepare_data(dataset)
        num_warmup_samples = args.warmup_steps * args.batch_size
        if args.streaming:
            warmup_dataset = dataset.take(num_warmup_samples)
        else:
            warmup_dataset = dataset.select(range(min(num_warmup_samples, len(dataset))))
        warmup_dataset = iter(warmup_dataset.map(benchmark, batch_size=args.batch_size, batched=True, fn_kwargs={'min_new_tokens': args.max_new_tokens}))
        for _ in tqdm(warmup_dataset, desc='Warming up...'):
            continue
    dataset = data_utils.load_data(args)
    if args.max_eval_samples is not None and args.max_eval_samples > 0:
        print(f'Subsampling dataset to first {args.max_eval_samples} samples!')
        if args.streaming:
            dataset = dataset.take(args.max_eval_samples)
        else:
            dataset = dataset.select(range(min(args.max_eval_samples, len(dataset))))
    dataset = data_utils.prepare_data(dataset)
    dataset = dataset.map(benchmark, batch_size=args.batch_size, batched=True, remove_columns=['audio'])
    all_results = {'audio_length_s': [], 'transcription_time_s': [], 'predictions': [], 'references': []}
    result_iter = iter(dataset)
    for result in tqdm(result_iter, desc='Samples...'):
        for key in all_results:
            all_results[key].append(result[key])
    manifest_path = data_utils.write_manifest(all_results['references'], all_results['predictions'], args.model_id, args.dataset_path, args.dataset, args.split, audio_length=all_results['audio_length_s'], transcription_time=all_results['transcription_time_s'])
    print('Results saved at path:', os.path.abspath(manifest_path))
    wer = wer_metric.compute(references=all_results['references'], predictions=all_results['predictions'])
    wer = round(100 * wer, 2)
    rtfx = round(sum(all_results['audio_length_s']) / sum(all_results['transcription_time_s']), 2)
    print('WER:', wer, '%', 'RTFx:', rtfx)
if __name__ == '__main__':
    parser = argparse.ArgumentParser()
    parser.add_argument('--model_id', type=str, required=True, help='Model identifier. Should be loadable with 🤗 Transformers')
    parser.add_argument('--dataset_path', type=str, default='esb/datasets', help='Dataset path. By default, it is `esb/datasets`')
    parser.add_argument('--dataset', type=str, required=True, help="Dataset name. *E.g.* `'librispeech_asr` for the LibriSpeech ASR dataset, or `'common_voice'` for Common Voice. The full list of dataset names can be found at `https://huggingface.co/datasets/esb/datasets`")
    parser.add_argument('--split', type=str, default='test', help="Split of the dataset. *E.g.* `'validation`' for the dev split, or `'test'` for the test split.")
    parser.add_argument('--device', type=int, default=-1, help='The device to run the pipeline on. -1 for CPU (default), 0 for the first GPU and so on.')
    parser.add_argument('--batch_size', type=int, default=16, help='Number of samples to go through each streamed batch.')
    parser.add_argument('--max_eval_samples', type=int, default=None, help='Number of samples to be evaluated. Put a lower number e.g. 64 for testing this script.')
    parser.add_argument('--no-streaming', dest='streaming', action='store_false', help="Choose whether you'd like to download the entire dataset or stream it during the evaluation.")
    parser.add_argument('--max_new_tokens', type=int, default=None, help='Maximum number of tokens to generate (for auto-regressive models).')
    parser.add_argument('--torch_compile', action='store_true', help='Whether to JIT compile the forward pass of the model.')
    parser.add_argument('--compile_mode', type=str, default='max-autotune', help="Mode for torch compiling model forward pass. Can be either 'default', 'reduce-overhead', 'max-autotune' or 'max-autotune-no-cudagraphs'.")
    parser.add_argument('--warmup_steps', type=int, default=10, help='Number of warm-up steps to run before launching the timed runs.')
    args = parser.parse_args()
    parser.set_defaults(streaming=False)
    main(args)