interscript 0.1.7 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/README.adoc +1 -3
  3. data/aliases.json +1 -0
  4. data/lib/interscript.rb +8 -3
  5. data/lib/interscript/fs.rb +27 -0
  6. data/lib/interscript/mapping.rb +3 -1
  7. data/lib/interscript/opal.rb +142 -3
  8. data/lib/interscript/opal/entrypoint.rb +8 -0
  9. data/lib/interscript/opal/exports.rb +11 -0
  10. data/lib/interscript/opal/maps.js.erb +2 -4
  11. data/lib/interscript/version.rb +1 -1
  12. data/maps/alalc-ara-Arab-Latn-1997.yaml +5 -5
  13. data/maps/alalc-asm-Deva-Latn-1997.yaml +104 -10
  14. data/maps/alalc-asm-Deva-Latn-2012.yaml +18 -3
  15. data/maps/alalc-aze-Arab-Latn-1997.yaml +376 -0
  16. data/maps/alalc-ben-Beng-Latn-1997.yaml +291 -0
  17. data/maps/alalc-div-Thaa-Latn-1997.yaml +211 -0
  18. data/maps/alalc-hin-Deva-Latn-1997.yaml +102 -10
  19. data/maps/alalc-hin-Deva-Latn-2011.yaml +19 -1
  20. data/maps/alalc-kan-Kana-Latn-1997.yaml +274 -0
  21. data/maps/alalc-kan-Kana-Latn-2011.yaml +63 -0
  22. data/maps/alalc-ori-Orya-Latn-1997.yaml +284 -0
  23. data/maps/alalc-ori-Orya-Latn-2011.yaml +67 -0
  24. data/maps/alalc-pra-Deva-Latn-2012.yaml +2 -2
  25. data/maps/alalc-san-Deva-Latn-2012.yaml +78 -9
  26. data/maps/alalc-tel-Telu-Latn-1997.yaml +284 -0
  27. data/maps/alalc-tel-Telu-Latn-2011.yaml +64 -0
  28. data/maps/az-aze-Cyrl-Latn-1939.yaml +105 -0
  29. data/maps/az-aze-Cyrl-Latn-1958.yaml +45 -0
  30. data/maps/bgnpcgn-ara-Arab-Latn-1956.yaml +3 -1
  31. data/maps/bgnpcgn-aze-Cyrl-Latn-1993.yaml +111 -104
  32. data/maps/bgnpcgn-bal-Arab-Latn-2008.yaml +329 -0
  33. data/maps/bgnpcgn-bul-Cyrl-Latn-1952.yaml +1 -1
  34. data/maps/bgnpcgn-div-Thaa-Latn-1988.yaml +75 -0
  35. data/maps/bgnpcgn-far-Latn-Latn-1964.yaml +28 -0
  36. data/maps/bgnpcgn-isl-Latn-Latn-1964.yaml +37 -0
  37. data/maps/bgnpcgn-kaz-Cyrl-Latn-1979.yaml +247 -0
  38. data/maps/bgnpcgn-kir-Cyrl-Latn-1979.yaml +218 -0
  39. data/maps/bgnpcgn-kur-Arab-Latn-2007.yaml +249 -0
  40. data/maps/bgnpcgn-per-Arab-Latn-1958.yaml +2 -0
  41. data/maps/bgnpcgn-prs-Arab-Latn-2007.yaml +87 -53
  42. data/maps/bgnpcgn-pus-Arab-Latn-1968.yaml +377 -0
  43. data/maps/bgnpcgn-srp-Cyrl-Latn-1962.yaml +73 -0
  44. data/maps/bgnpcgn-urd-Arab-Latn-2007.yaml +459 -0
  45. data/maps/{bis-knd-Knda-Latn-13194-1991.yaml → bis-kan-Kana-Latn-13194-1991.yaml} +2 -2
  46. data/maps/bis-ori-Orya-Latn-13194-1991.yaml +17 -2
  47. data/maps/iso-ara-Arab-Latn-233-1984.yaml +1 -1
  48. data/maps/{iso-kan-Knda-Latn-15919-2001.yaml → iso-kan-Kana-Latn-15919-2001.yaml} +1 -1
  49. data/maps/{mns-mon-Cyrl-Latn-5217-2012.yaml → masm-mon-Cyrl-Latn-5217-2012.yaml} +2 -2
  50. data/maps/{mns-mon-Latn-Cyrl-5217-2012.yaml → masm-mon-Latn-Cyrl-5217-2012.yaml} +1 -1
  51. data/maps/mv-div-Thaa-Latn-1987.yaml +200 -0
  52. data/maps/odni-ara-Arab-Latn-2004.yaml +137 -0
  53. data/maps/odni-ara-Arab-Latn-2015.yaml +20 -130
  54. data/maps/odni-bul-Cyrl-Latn-2005.yaml +90 -0
  55. data/maps/odni-fas-Arab-Latn-2004.yaml +276 -0
  56. data/maps/odni-hin-Deva-Latn-2004.yaml +182 -0
  57. data/maps/odni-mkd-Cyrl-Latn-2005.yaml +21 -0
  58. data/maps/odni-prs-Arab-Latn-2004.yaml +123 -0
  59. data/maps/{odni-per-Arab-Latn-2015.yaml → odni-prs-Arab-Latn-2015.yaml} +0 -0
  60. data/maps/odni-srp-Cyrl-Latn-2005.yaml +36 -0
  61. data/maps/odni-tuk-Cyrl-Latn-2015.yaml +170 -0
  62. data/maps/odni-ukr-Cyrl-Latn-2015.yaml +4 -0
  63. data/maps/un-ara-Arab-Latn-2017.yaml +1 -1
  64. data/maps/un-asm-Beng-Latn-1972.yaml +223 -0
  65. data/maps/un-guj-Gujr-Latn-1972.yaml +229 -0
  66. data/maps/un-hin-Deva-Latn-2016.yaml +104 -10
  67. data/maps/un-kan-Kana-Latn-2016.yaml +254 -0
  68. data/maps/un-mal-Mlym-Latn-1972.yaml +251 -0
  69. data/maps/un-mar-Deva-Latn-2016.yaml +24 -13
  70. data/maps/un-nep-Deva-Latn-1972.yaml +40 -121
  71. data/maps/un-ori-Orya-Latn-1972.yaml +247 -0
  72. data/maps/un-pan-Guru-Latn-1972.yaml +402 -0
  73. data/maps/un-prs-Arab-Latn-1967.yaml +236 -0
  74. data/maps/un-tam-Taml-Latn-1972.yaml +194 -0
  75. data/maps/un-tel-Telu-Latn-1972.yaml +270 -0
  76. data/maps/un-urd-Arab-Latn-1972.yaml +405 -0
  77. data/maps/var-amh-Ethi-Latn-eae-2003.yaml +466 -0
  78. data/maps/var-gez-Ethi-Latn-eae-2003.yaml +76 -0
  79. data/spec/interscript/filenames_spec.rb +6 -369
  80. data/spec/interscript_spec.rb +10 -2
  81. metadata +50 -7
  82. data/lib/interscript/opal/map_translate.rb +0 -7
@@ -4,6 +4,9 @@ require "timeout"
4
4
  require "pycall/import"
5
5
  include PyCall::Import
6
6
 
7
+ # Cache the map aliases early so they don't timeout the tests
8
+ Interscript.aliases
9
+
7
10
  RSpec.describe Interscript do
8
11
  mask = ENV["TRANSLIT_SYSTEM"] || "*"
9
12
  maps = Dir["maps/#{mask}.yaml"]
@@ -15,10 +18,15 @@ RSpec.describe Interscript do
15
18
  system = YAML.load_file(system_file)
16
19
  system_name = File.basename(system_file, ".yaml")
17
20
 
18
- system["tests"]&.reduce([]) do |_, test|
21
+ cache = {}
22
+ # Let's preload the cache but silence the exception if not possible
23
+ # (it will be reraised during the test)
24
+ Interscript.transliterate(system_name, "", cache) rescue nil
25
+
26
+ system["tests"]&.uniq&.reduce([]) do |_, test|
19
27
  it "test for #{test}" do
20
28
  Timeout::timeout(5) do
21
- result = Interscript.transliterate(system_name, test["source"])
29
+ result = Interscript.transliterate(system_name, test["source"], cache)
22
30
  expected = test["expected"]&.unicode_normalize
23
31
  expect(result).to eq(expected)
24
32
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: interscript
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
@@ -200,6 +200,7 @@ extensions: []
200
200
  extra_rdoc_files: []
201
201
  files:
202
202
  - README.adoc
203
+ - aliases.json
203
204
  - lib/g2pwrapper.py
204
205
  - lib/interscript.rb
205
206
  - lib/interscript/command.rb
@@ -207,7 +208,7 @@ files:
207
208
  - lib/interscript/mapping.rb
208
209
  - lib/interscript/opal.rb
209
210
  - lib/interscript/opal/entrypoint.rb
210
- - lib/interscript/opal/map_translate.rb
211
+ - lib/interscript/opal/exports.rb
211
212
  - lib/interscript/opal/maps.js.erb
212
213
  - lib/interscript/version.rb
213
214
  - lib/model-7
@@ -218,16 +219,21 @@ files:
218
219
  - maps/alalc-ara-Arab-Latn-1997.yaml
219
220
  - maps/alalc-asm-Deva-Latn-1997.yaml
220
221
  - maps/alalc-asm-Deva-Latn-2012.yaml
222
+ - maps/alalc-aze-Arab-Latn-1997.yaml
221
223
  - maps/alalc-aze-Cyrl-Latn-1997.yaml
222
224
  - maps/alalc-bel-Cyrl-Latn-1997.yaml
225
+ - maps/alalc-ben-Beng-Latn-1997.yaml
223
226
  - maps/alalc-ben-Beng-Latn-2017.yaml
224
227
  - maps/alalc-bul-Cyrl-Latn-1997.yaml
228
+ - maps/alalc-div-Thaa-Latn-1997.yaml
225
229
  - maps/alalc-ell-Grek-Latn-1997.yaml
226
230
  - maps/alalc-ell-Grek-Latn-2010.yaml
227
231
  - maps/alalc-guj-Gujr-Latn-1997.yaml
228
232
  - maps/alalc-guj-Gujr-Latn-2011.yaml
229
233
  - maps/alalc-hin-Deva-Latn-1997.yaml
230
234
  - maps/alalc-hin-Deva-Latn-2011.yaml
235
+ - maps/alalc-kan-Kana-Latn-1997.yaml
236
+ - maps/alalc-kan-Kana-Latn-2011.yaml
231
237
  - maps/alalc-kat-Geok-Latn-1997.yaml
232
238
  - maps/alalc-kat-Geor-Latn-1997.yaml
233
239
  - maps/alalc-kor-Hang-Latn-1997.yaml
@@ -238,6 +244,8 @@ files:
238
244
  - maps/alalc-mkd-Cyrl-Latn-1997.yaml
239
245
  - maps/alalc-mkd-Cyrl-Latn-2013.yaml
240
246
  - maps/alalc-mon-Cyrl-Latn-1997.yaml
247
+ - maps/alalc-ori-Orya-Latn-1997.yaml
248
+ - maps/alalc-ori-Orya-Latn-2011.yaml
241
249
  - maps/alalc-pan-Guru-Latn-1997.yaml
242
250
  - maps/alalc-pan-Guru-Latn-2011.yaml
243
251
  - maps/alalc-per-Arab-Latn-1997.yaml
@@ -252,9 +260,13 @@ files:
252
260
  - maps/alalc-srp-Cyrl-Latn-2013.yaml
253
261
  - maps/alalc-tam-Taml-Latn-1997.yaml
254
262
  - maps/alalc-tam-Taml-Latn-2011.yaml
263
+ - maps/alalc-tel-Telu-Latn-1997.yaml
264
+ - maps/alalc-tel-Telu-Latn-2011.yaml
255
265
  - maps/alalc-ukr-Cyrl-Latn-1997.yaml
256
266
  - maps/alalc-ukr-Cyrl-Latn-2011.yaml
257
267
  - maps/apcbg-bul-Cyrl-Latn-1995.yaml
268
+ - maps/az-aze-Cyrl-Latn-1939.yaml
269
+ - maps/az-aze-Cyrl-Latn-1958.yaml
258
270
  - maps/bas-rus-Cyrl-Latn-2017-bss.yaml
259
271
  - maps/bas-rus-Cyrl-Latn-2017-oss.yaml
260
272
  - maps/bgn-jpn-Hrkt-Latn-1962.yaml
@@ -267,19 +279,26 @@ files:
267
279
  - maps/bgnpcgn-arm-Armn-Latn-1981.yaml
268
280
  - maps/bgnpcgn-aze-Cyrl-Latn-1993.yaml
269
281
  - maps/bgnpcgn-bak-Cyrl-Latn-2007.yaml
282
+ - maps/bgnpcgn-bal-Arab-Latn-2008.yaml
270
283
  - maps/bgnpcgn-bel-Cyrl-Latn-1979.yaml
271
284
  - maps/bgnpcgn-bul-Cyrl-Latn-1952.yaml
272
285
  - maps/bgnpcgn-bul-Cyrl-Latn-2013.yaml
273
286
  - maps/bgnpcgn-che-Cyrl-Latn-2008.yaml
287
+ - maps/bgnpcgn-div-Thaa-Latn-1988.yaml
274
288
  - maps/bgnpcgn-ell-Grek-Latn-1962.yaml
275
289
  - maps/bgnpcgn-ell-Grek-Latn-1996.yaml
290
+ - maps/bgnpcgn-far-Latn-Latn-1964.yaml
276
291
  - maps/bgnpcgn-fas-Arab-Latn-1956.yaml
292
+ - maps/bgnpcgn-isl-Latn-Latn-1964.yaml
277
293
  - maps/bgnpcgn-jpn-Hrkt-Latn-1976.yaml
278
294
  - maps/bgnpcgn-kat-Geor-Latn-1981.yaml
279
295
  - maps/bgnpcgn-kat-Geor-Latn-2009.yaml
296
+ - maps/bgnpcgn-kaz-Cyrl-Latn-1979.yaml
297
+ - maps/bgnpcgn-kir-Cyrl-Latn-1979.yaml
280
298
  - maps/bgnpcgn-kor-Hang-Latn-kn-1945.yaml
281
299
  - maps/bgnpcgn-kor-Hang-Latn-rok-2011.yaml
282
300
  - maps/bgnpcgn-kor-Kore-Latn-rok-2011.yaml
301
+ - maps/bgnpcgn-kur-Arab-Latn-2007.yaml
283
302
  - maps/bgnpcgn-mkd-Cyrl-Latn-1981.yaml
284
303
  - maps/bgnpcgn-mkd-Cyrl-Latn-2013.yaml
285
304
  - maps/bgnpcgn-mon-Cyrl-Latn-1964.yaml
@@ -287,13 +306,16 @@ files:
287
306
  - maps/bgnpcgn-per-Arab-Latn-1958.yaml
288
307
  - maps/bgnpcgn-prs-Arab-Latn-2007.yaml
289
308
  - maps/bgnpcgn-prs-Arab-Latn-yaghoubi.yaml
309
+ - maps/bgnpcgn-pus-Arab-Latn-1968.yaml
290
310
  - maps/bgnpcgn-rue-Cyrl-Latn-2016.yaml
291
311
  - maps/bgnpcgn-rus-Cyrl-Latn-1947.yaml
312
+ - maps/bgnpcgn-srp-Cyrl-Latn-1962.yaml
292
313
  - maps/bgnpcgn-srp-Cyrl-Latn-2005.yaml
293
314
  - maps/bgnpcgn-tat-Cyrl-Latn-2007.yaml
294
315
  - maps/bgnpcgn-tgk-Cyrl-Latn-1994.yaml
295
316
  - maps/bgnpcgn-ukr-Cyrl-Latn-1965.yaml
296
317
  - maps/bgnpcgn-ukr-Cyrl-Latn-2019.yaml
318
+ - maps/bgnpcgn-urd-Arab-Latn-2007.yaml
297
319
  - maps/bgnpcgn-uzb-Cyrl-Latn-1979.yaml
298
320
  - maps/bgnpcgn-uzb-Cyrl-Latn-2000.yaml
299
321
  - maps/bgnpcgn-zho-Hans-Latn-1979.yaml
@@ -301,7 +323,7 @@ files:
301
323
  - maps/bis-ben-Beng-Latn-13194-1991.yaml
302
324
  - maps/bis-dev-Deva-Latn-13194-1991.yaml
303
325
  - maps/bis-guj-Gujr-Latn-13194-1991.yaml
304
- - maps/bis-knd-Knda-Latn-13194-1991.yaml
326
+ - maps/bis-kan-Kana-Latn-13194-1991.yaml
305
327
  - maps/bis-mlm-Mlym-Latn-13194-1991.yaml
306
328
  - maps/bis-ori-Orya-Latn-13194-1991.yaml
307
329
  - maps/bis-pnj-Guru-Latn-13194-1991.yaml
@@ -346,7 +368,7 @@ files:
346
368
  - maps/iso-hin-Deva-Latn-15919-2001.yaml
347
369
  - maps/iso-inc-Deva-Latn-15919-2001.yaml
348
370
  - maps/iso-jpn-Hrkt-Latn-3602-1989.yaml
349
- - maps/iso-kan-Knda-Latn-15919-2001.yaml
371
+ - maps/iso-kan-Kana-Latn-15919-2001.yaml
350
372
  - maps/iso-kat-Geor-Latn-9984-1996.yaml
351
373
  - maps/iso-kor-Hang-Latn-1996-method1.yaml
352
374
  - maps/iso-kor-Hang-Latn-1996-method2.yaml
@@ -368,32 +390,41 @@ files:
368
390
  - maps/iso-tha-Thai-Latn-11940-1998.yaml
369
391
  - maps/kp-kor-Hang-Latn-2002.yaml
370
392
  - maps/lshk-yue-Hani-Latn-jyutping-1993.yaml
393
+ - maps/masm-mon-Cyrl-Latn-5217-2012.yaml
394
+ - maps/masm-mon-Latn-Cyrl-5217-2012.yaml
371
395
  - maps/mext-jpn-Hrkt-Latn-1954.yaml
372
- - maps/mns-mon-Cyrl-Latn-5217-2012.yaml
373
- - maps/mns-mon-Latn-Cyrl-5217-2012.yaml
374
396
  - maps/moct-kor-Hang-Latn-2000.yaml
375
397
  - maps/mofa-jpn-Hrkt-Latn-1989.yaml
398
+ - maps/mv-div-Thaa-Latn-1987.yaml
376
399
  - maps/mvd-bel-Cyrl-Latn-2008.yaml
377
400
  - maps/mvd-bel-Cyrl-Latn-2010.yaml
378
401
  - maps/mvd-rus-Cyrl-Latn-2008.yaml
379
402
  - maps/mvd-rus-Cyrl-Latn-2010.yaml
403
+ - maps/odni-ara-Arab-Latn-2004.yaml
380
404
  - maps/odni-ara-Arab-Latn-2015.yaml
381
405
  - maps/odni-aze-Cyrl-Latn-2015.yaml
382
406
  - maps/odni-bel-Cyrl-Latn-2015.yaml
407
+ - maps/odni-bul-Cyrl-Latn-2005.yaml
383
408
  - maps/odni-bul-Cyrl-Latn-2015.yaml
384
409
  - maps/odni-che-Cyrl-Latn-2015.yaml
410
+ - maps/odni-fas-Arab-Latn-2004.yaml
385
411
  - maps/odni-fas-Arab-Latn-2015.yaml
412
+ - maps/odni-hin-Deva-Latn-2004.yaml
386
413
  - maps/odni-hin-Deva-Latn-2015.yaml
387
414
  - maps/odni-kat-Geor-Latn-2015.yaml
388
415
  - maps/odni-kaz-Cyrl-Latn-2015.yaml
389
416
  - maps/odni-kir-Cyrl-Latn-2015.yaml
390
417
  - maps/odni-kor-Hang-Latn-2015.yaml
418
+ - maps/odni-mkd-Cyrl-Latn-2005.yaml
391
419
  - maps/odni-mkd-Cyrl-Latn-2015.yaml
392
- - maps/odni-per-Arab-Latn-2015.yaml
420
+ - maps/odni-prs-Arab-Latn-2004.yaml
421
+ - maps/odni-prs-Arab-Latn-2015.yaml
393
422
  - maps/odni-rus-Cyrl-Latn-2015.yaml
423
+ - maps/odni-srp-Cyrl-Latn-2005.yaml
394
424
  - maps/odni-srp-Cyrl-Latn-2015.yaml
395
425
  - maps/odni-tat-Cyrl-Latn-2015.yaml
396
426
  - maps/odni-tgk-Cyrl-Latn-2015.yaml
427
+ - maps/odni-tuk-Cyrl-Latn-2015.yaml
397
428
  - maps/odni-uig-Cyrl-Latn-2015.yaml
398
429
  - maps/odni-ukr-Cyrl-Latn-2015.yaml
399
430
  - maps/odni-urd-Arab-Latn-2015.yaml
@@ -414,20 +445,32 @@ files:
414
445
  - maps/un-ara-Arab-Latn-1971.yaml
415
446
  - maps/un-ara-Arab-Latn-1972.yaml
416
447
  - maps/un-ara-Arab-Latn-2017.yaml
448
+ - maps/un-asm-Beng-Latn-1972.yaml
417
449
  - maps/un-bel-Cyrl-Latn-2007.yaml
418
450
  - maps/un-ben-Beng-Latn-2016.yaml
419
451
  - maps/un-ell-Grek-Latn-1987-phonetic.yaml
420
452
  - maps/un-ell-Grek-Latn-1987-tl.yaml
421
453
  - maps/un-ell-Grek-Latn-1987-ts.yaml
454
+ - maps/un-guj-Gujr-Latn-1972.yaml
422
455
  - maps/un-hin-Deva-Latn-2016.yaml
456
+ - maps/un-kan-Kana-Latn-2016.yaml
457
+ - maps/un-mal-Mlym-Latn-1972.yaml
423
458
  - maps/un-mar-Deva-Latn-2016.yaml
424
459
  - maps/un-mon-Mong-Latn-general-2013.yaml
425
460
  - maps/un-mon-Mong-Latn-phonetic-2013.yaml
426
461
  - maps/un-nep-Deva-Latn-1972.yaml
427
462
  - maps/un-nep-Deva-Latn-2013.yaml
463
+ - maps/un-ori-Orya-Latn-1972.yaml
464
+ - maps/un-pan-Guru-Latn-1972.yaml
465
+ - maps/un-prs-Arab-Latn-1967.yaml
428
466
  - maps/un-rus-Cyrl-Latn-1987.yaml
467
+ - maps/un-tam-Taml-Latn-1972.yaml
468
+ - maps/un-tel-Telu-Latn-1972.yaml
429
469
  - maps/un-ukr-Cyrl-Latn-1998.yaml
430
470
  - maps/un-ukr-Cyrl-Latn-2012.yaml
471
+ - maps/un-urd-Arab-Latn-1972.yaml
472
+ - maps/var-amh-Ethi-Latn-eae-2003.yaml
473
+ - maps/var-gez-Ethi-Latn-eae-2003.yaml
431
474
  - maps/var-hin-Deva-Latn-hunterian-1872.yaml
432
475
  - maps/var-jpn-Hrkt-Latn-hepburn-1886.yaml
433
476
  - maps/var-jpn-Hrkt-Latn-hepburn-1954.yaml
@@ -1,7 +0,0 @@
1
- module Interscript
2
- module OpalMapTranslate
3
- def self.translate_regexp(src)
4
- src
5
- end
6
- end
7
- end