interscript 0.1.6 → 2.1.0a9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/Gemfile +29 -0
- data/LICENSE.adoc +31 -0
- data/README.md +3 -0
- data/Rakefile +53 -0
- data/bin/console +14 -0
- data/bin/interscript +3 -39
- data/bin/maps_analyze_staging +168 -0
- data/bin/maps_debug_compilers +58 -0
- data/bin/maps_debug_ordering +88 -0
- data/bin/maps_debug_ruby_compile +24 -0
- data/bin/maps_debug_step_by_step +44 -0
- data/bin/maps_optimize_order +112 -0
- data/bin/maps_v1_analyze_regexps +45 -0
- data/bin/maps_v1_to_v2 +426 -0
- data/exe/interscript +6 -0
- data/interscript.gemspec +31 -0
- data/lib/interscript.rb +81 -127
- data/lib/interscript/command.rb +5 -5
- data/lib/interscript/compiler.rb +22 -0
- data/lib/interscript/compiler/javascript.rb +292 -0
- data/lib/interscript/compiler/ruby.rb +262 -0
- data/lib/interscript/dsl.rb +67 -0
- data/lib/interscript/dsl/aliases.rb +23 -0
- data/lib/interscript/dsl/document.rb +46 -0
- data/lib/interscript/dsl/group.rb +45 -0
- data/lib/interscript/dsl/group/parallel.rb +6 -0
- data/lib/interscript/dsl/items.rb +89 -0
- data/lib/interscript/dsl/metadata.rb +26 -0
- data/lib/interscript/dsl/stage.rb +6 -0
- data/lib/interscript/dsl/symbol_mm.rb +11 -0
- data/lib/interscript/dsl/tests.rb +12 -0
- data/lib/interscript/interpreter.rb +251 -0
- data/lib/interscript/node.rb +25 -0
- data/lib/interscript/node/alias_def.rb +15 -0
- data/lib/interscript/node/dependency.rb +13 -0
- data/lib/interscript/node/document.rb +45 -0
- data/lib/interscript/node/group.rb +34 -0
- data/lib/interscript/node/group/parallel.rb +9 -0
- data/lib/interscript/node/group/sequential.rb +2 -0
- data/lib/interscript/node/item.rb +52 -0
- data/lib/interscript/node/item/alias.rb +42 -0
- data/lib/interscript/node/item/any.rb +61 -0
- data/lib/interscript/node/item/capture.rb +50 -0
- data/lib/interscript/node/item/group.rb +51 -0
- data/lib/interscript/node/item/repeat.rb +40 -0
- data/lib/interscript/node/item/stage.rb +23 -0
- data/lib/interscript/node/item/string.rb +51 -0
- data/lib/interscript/node/metadata.rb +18 -0
- data/lib/interscript/node/rule.rb +6 -0
- data/lib/interscript/node/rule/funcall.rb +18 -0
- data/lib/interscript/node/rule/run.rb +15 -0
- data/lib/interscript/node/rule/sub.rb +65 -0
- data/lib/interscript/node/stage.rb +19 -0
- data/lib/interscript/node/tests.rb +15 -0
- data/lib/interscript/stdlib.rb +211 -0
- data/lib/interscript/utils/regexp_converter.rb +283 -0
- data/lib/interscript/version.rb +1 -1
- data/requirements.txt +1 -0
- metadata +75 -339
- data/README.adoc +0 -298
- data/bin/rspec +0 -29
- data/lib/__pycache__/g2pwrapper.cpython-38.pyc +0 -0
- data/lib/g2pwrapper.py +0 -34
- data/lib/interscript-opal.rb +0 -2
- data/lib/interscript/fs.rb +0 -71
- data/lib/interscript/mapping.rb +0 -142
- data/lib/interscript/opal.rb +0 -27
- data/lib/interscript/opal/maps.js.erb +0 -10
- data/lib/interscript/opal_map_translate.rb +0 -12
- data/lib/model-7 +0 -0
- data/lib/tha-pt-b-7 +0 -0
- data/maps/acadsin-zho-Hani-Latn-2002.yaml +0 -38912
- data/maps/alalc-amh-Ethi-Latn-1997.yaml +0 -509
- data/maps/alalc-amh-Ethi-Latn-2011.yaml +0 -138
- data/maps/alalc-ara-Arab-Latn-1997.yaml +0 -1283
- data/maps/alalc-asm-Deva-Latn-1997.yaml +0 -159
- data/maps/alalc-aze-Cyrl-Latn-1997.yaml +0 -141
- data/maps/alalc-bel-Cyrl-Latn-1997.yaml +0 -125
- data/maps/alalc-ben-Beng-Latn-2017.yaml +0 -130
- data/maps/alalc-bul-Cyrl-Latn-1997.yaml +0 -94
- data/maps/alalc-ell-Grek-Latn-1997.yaml +0 -624
- data/maps/alalc-ell-Grek-Latn-2010.yaml +0 -627
- data/maps/alalc-hin-Deva-Latn-2020.yaml +0 -159
- data/maps/alalc-kat-Geok-Latn-1997.yaml +0 -111
- data/maps/alalc-kat-Geor-Latn-1997.yaml +0 -146
- data/maps/alalc-kor-Hang-Latn-1997.yaml +0 -94
- data/maps/alalc-mar-Deva-Latn-1997.yaml +0 -170
- data/maps/alalc-mkd-Cyrl-Latn-1997.yaml +0 -114
- data/maps/alalc-mkd-Cyrl-Latn-2013.yaml +0 -103
- data/maps/alalc-pan-Deva-Latn-1997.yaml +0 -237
- data/maps/alalc-rus-Cyrl-Latn-1997.yaml +0 -221
- data/maps/alalc-rus-Cyrl-Latn-2012.yaml +0 -162
- data/maps/alalc-srp-Cyrl-Latn-1997.yaml +0 -114
- data/maps/alalc-srp-Cyrl-Latn-2013.yaml +0 -135
- data/maps/alalc-ukr-Cyrl-Latn-1997.yaml +0 -141
- data/maps/alalc-ukr-Cyrl-Latn-2011.yaml +0 -16
- data/maps/apcbg-bul-Cyrl-Latn-1995.yaml +0 -283
- data/maps/bas-rus-Cyrl-Latn-2017-bss.yaml +0 -174
- data/maps/bas-rus-Cyrl-Latn-2017-oss.yaml +0 -169
- data/maps/bgn-jpn-Hrkt-Latn-1962.yaml +0 -292
- data/maps/bgn-kor-Hang-Latn-1943.yaml +0 -31
- data/maps/bgn-kor-Kore-Latn-1943.yaml +0 -31
- data/maps/bgna-bul-Cyrl-Latn-2006.yaml +0 -208
- data/maps/bgna-bul-Cyrl-Latn-2009.yaml +0 -208
- data/maps/bgnpcgn-amh-Ethi-Latn-1967.yaml +0 -528
- data/maps/bgnpcgn-ara-Arab-Latn-1956.yaml +0 -592
- data/maps/bgnpcgn-arm-Armn-Latn-1981.yaml +0 -108
- data/maps/bgnpcgn-aze-Cyrl-Latn-1993.yaml +0 -104
- data/maps/bgnpcgn-bak-Cyrl-Latn-2007.yaml +0 -184
- data/maps/bgnpcgn-bel-Cyrl-Latn-1979.yaml +0 -285
- data/maps/bgnpcgn-bul-Cyrl-Latn-1952.yaml +0 -115
- data/maps/bgnpcgn-bul-Cyrl-Latn-2013.yaml +0 -38
- data/maps/bgnpcgn-ell-Grek-Latn-1962.yaml +0 -701
- data/maps/bgnpcgn-ell-Grek-Latn-1996.yaml +0 -19
- data/maps/bgnpcgn-jpn-Hrkt-Latn-1976.yaml +0 -257
- data/maps/bgnpcgn-kat-Geor-Latn-1981.yaml +0 -127
- data/maps/bgnpcgn-kat-Geor-Latn-2009.yaml +0 -42
- data/maps/bgnpcgn-kor-Hang-Latn-kn-1945.yaml +0 -253
- data/maps/bgnpcgn-kor-Hang-Latn-rok-2011.yaml +0 -48
- data/maps/bgnpcgn-kor-Kore-Latn-rok-2011.yaml +0 -48
- data/maps/bgnpcgn-mkd-Cyrl-Latn-1981.yaml +0 -159
- data/maps/bgnpcgn-mkd-Cyrl-Latn-2013.yaml +0 -190
- data/maps/bgnpcgn-nep-Deva-Latn-2011.yaml +0 -200
- data/maps/bgnpcgn-per-Arab-Latn-1956.yaml +0 -92
- data/maps/bgnpcgn-rus-Cyrl-Latn-1947.yaml +0 -314
- data/maps/bgnpcgn-srp-Cyrl-Latn-2005.yaml +0 -166
- data/maps/bgnpcgn-ukr-Cyrl-Latn-1965.yaml +0 -162
- data/maps/bgnpcgn-ukr-Cyrl-Latn-2019.yaml +0 -208
- data/maps/bgnpcgn-zho-Hans-Latn-1979.yaml +0 -7456
- data/maps/bis-asm-Beng-Latn-13194-1991.yaml +0 -159
- data/maps/bis-ben-Beng-Latn-13194-1991.yaml +0 -156
- data/maps/bis-dev-Deva-Latn-13194-1991.yaml +0 -184
- data/maps/bis-gjr-Gujr-Latn-13194-1991.yaml +0 -166
- data/maps/bis-knd-Knda-Latn-13194-1991.yaml +0 -173
- data/maps/bis-mlm-Mlym-Latn-13194-1991.yaml +0 -176
- data/maps/bis-ori-Orya-Latn-13194-1991.yaml +0 -160
- data/maps/bis-pnj-Guru-Latn-13194-1991.yaml +0 -175
- data/maps/bis-tel-Telu-Latn-13194-1991.yaml +0 -170
- data/maps/bis-tml-Taml-Latn-13194-1991.yaml +0 -155
- data/maps/by-bel-Cyrl-Latn-1998.yaml +0 -168
- data/maps/by-bel-Cyrl-Latn-2007.yaml +0 -115
- data/maps/dos-nep-Deva-Latn-1997.yaml +0 -33
- data/maps/elot-ell-Grek-Latn-743-1982-tl.yaml +0 -684
- data/maps/elot-ell-Grek-Latn-743-1982-ts.yaml +0 -680
- data/maps/elot-ell-Grek-Latn-743-2001-tl.yaml +0 -19
- data/maps/elot-ell-Grek-Latn-743-2001-ts.yaml +0 -31
- data/maps/ggg-kat-Geor-Latn-2002.yaml +0 -88
- data/maps/gki-bel-Cyrl-Latn-1992.yaml +0 -33
- data/maps/gki-bel-Cyrl-Latn-2000.yaml +0 -201
- data/maps/gost-rus-Cyrl-Latn-16876-71-1983.yaml +0 -186
- data/maps/hk-yue-Hani-Latn-1888.yaml +0 -38497
- data/maps/icao-bel-Cyrl-Latn-9303.yaml +0 -136
- data/maps/icao-bul-Cyrl-Latn-9303.yaml +0 -118
- data/maps/icao-heb-Hebr-Latn-9303.yaml +0 -151
- data/maps/icao-mkd-Cyrl-Latn-9303.yaml +0 -117
- data/maps/icao-per-Arab-Latn-9303.yaml +0 -103
- data/maps/icao-rus-Cyrl-Latn-9303.yaml +0 -117
- data/maps/icao-srp-Cyrl-Latn-9303.yaml +0 -117
- data/maps/icao-ukr-Cyrl-Latn-9303.yaml +0 -119
- data/maps/iso-ara-Arab-Latn-233-1984.yaml +0 -323
- data/maps/iso-ell-Grek-Latn-843-1997-t1.yaml +0 -609
- data/maps/iso-ell-Grek-Latn-843-1997-t2.yaml +0 -40
- data/maps/iso-jpn-Hrkt-Latn-3602-1989.yaml +0 -62
- data/maps/iso-rus-Cyrl-Latn-9-1995.yaml +0 -271
- data/maps/iso-tha-Thai-Latn-11940-1998.yaml +0 -109
- data/maps/kp-kor-Hang-Latn-2002.yaml +0 -901
- data/maps/lshk-yue-Hani-Latn-jyutping-1993.yaml +0 -44820
- data/maps/mext-jpn-Hrkt-Latn-1954.yaml +0 -411
- data/maps/moct-kor-Hang-Latn-2000.yaml +0 -803
- data/maps/mofa-jpn-Hrkt-Latn-1989.yaml +0 -541
- data/maps/mvd-bel-Cyrl-Latn-2008.yaml +0 -225
- data/maps/mvd-bel-Cyrl-Latn-2010.yaml +0 -63
- data/maps/mvd-rus-Cyrl-Latn-2008.yaml +0 -109
- data/maps/mvd-rus-Cyrl-Latn-2010.yaml +0 -37
- data/maps/nil-kor-Hang-Hang-jamo.yaml +0 -11193
- data/maps/odni-aze-Cyrl-Latn-2015.yaml +0 -144
- data/maps/odni-bel-Cyrl-Latn-2015.yaml +0 -148
- data/maps/odni-bul-Cyrl-Latn-2015.yaml +0 -96
- data/maps/odni-hin-Deva-Latn-2015.yaml +0 -258
- data/maps/odni-kat-Geor-Latn-2015.yaml +0 -87
- data/maps/odni-kaz-Cyrl-Latn-2015.yaml +0 -148
- data/maps/odni-kir-Cyrl-Latn-2015.yaml +0 -136
- data/maps/odni-mkd-Cyrl-Latn-2015.yaml +0 -122
- data/maps/odni-rus-Cyrl-Latn-2015.yaml +0 -77
- data/maps/odni-srp-Cyrl-Latn-2015.yaml +0 -129
- data/maps/odni-tat-Cyrl-Latn-2015.yaml +0 -142
- data/maps/odni-tgk-Cyrl-Latn-2015.yaml +0 -148
- data/maps/odni-uig-Cyrl-Latn-2015.yaml +0 -138
- data/maps/odni-ukr-Cyrl-Latn-2015.yaml +0 -157
- data/maps/odni-urd-Arab-Latn-2015.yaml +0 -221
- data/maps/odni-uzb-Cyrl-Latn-2015.yaml +0 -166
- data/maps/royin-tha-Thai-Latn-1939-generic.yaml +0 -90
- data/maps/royin-tha-Thai-Latn-1968.yaml +0 -179
- data/maps/royin-tha-Thai-Latn-1999-chained.yaml +0 -180
- data/maps/royin-tha-Thai-Latn-1999.yaml +0 -76
- data/maps/sac-zho-Hans-Latn-1979.yaml +0 -24759
- data/maps/ses-ara-Arab-Latn-1930.yaml +0 -279
- data/maps/stategeocadastre-ukr-Cyrl-Latn-1993.yaml +0 -222
- data/maps/ua-ukr-Cyrl-Latn-1996.yaml +0 -193
- data/maps/un-ara-Arab-Latn-1971.yaml +0 -139
- data/maps/un-ara-Arab-Latn-1972.yaml +0 -159
- data/maps/un-ara-Arab-Latn-2017.yaml +0 -420
- data/maps/un-bel-Cyrl-Latn-2007.yaml +0 -114
- data/maps/un-ben-Beng-Latn-2016.yaml +0 -534
- data/maps/un-ell-Grek-Latn-1987-tl.yaml +0 -31
- data/maps/un-ell-Grek-Latn-1987-ts.yaml +0 -19
- data/maps/un-ell-Grek-Latn-phonetic-1987.yaml +0 -780
- data/maps/un-mon-Mong-Latn-2013.yaml +0 -99
- data/maps/un-nep-Deva-Latn-1972.yaml +0 -163
- data/maps/un-rus-Cyrl-Latn-1987.yaml +0 -166
- data/maps/un-ukr-Cyrl-Latn-1998.yaml +0 -30
- data/maps/ungegn-amh-Ethi-Latn-2016.yaml +0 -575
- data/maps/var-jpn-Hrkt-Latn-hepburn-1886.yaml +0 -406
- data/maps/var-jpn-Hrkt-Latn-hepburn-1954.yaml +0 -386
- data/maps/var-kor-Hang-Latn-mr-1939.yaml +0 -1054
- data/maps/var-kor-Kore-Hang-2013.yaml +0 -59754
- data/maps/var-kor-Kore-Latn-mr-1939.yaml +0 -36
- data/maps/var-tha-Thai-Thai-phonemic.yaml +0 -59
- data/maps/var-tha-Thai-Zsym-ipa.yaml +0 -301
- data/maps/var-zho-Hani-Latn-1979.yaml +0 -38908
- data/spec/interscript/mapping_spec.rb +0 -42
- data/spec/interscript_spec.rb +0 -26
- data/spec/spec_helper.rb +0 -3
@@ -1,42 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
require "interscript/mapping"
|
3
|
-
|
4
|
-
RSpec.describe Interscript::Mapping do
|
5
|
-
describe ".for" do
|
6
|
-
context "with a valid system code" do
|
7
|
-
it "returns a serialize system mappings" do
|
8
|
-
system_code = "un-ben-Beng-Latn-2016"
|
9
|
-
mapping = Interscript::Mapping.for(system_code)
|
10
|
-
|
11
|
-
expect(mapping.rules).to be_empty
|
12
|
-
expect(mapping.characters["অ"]).to eq("a")
|
13
|
-
expect(mapping.name).to eq("Bengali Romanization, Version 4.0")
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
context "with valid and inherited system" do
|
18
|
-
it "returns system mappings with inherited rules" do
|
19
|
-
system_code = "alalc-ben-Beng-Latn-2017"
|
20
|
-
|
21
|
-
mapping = Interscript::Mapping.for(system_code)
|
22
|
-
extended = Interscript::Mapping.for("un-ben-Beng-Latn-2016")
|
23
|
-
|
24
|
-
expect(mapping.rules).to be_empty
|
25
|
-
expect(mapping.characters["অ"]).to eq("a")
|
26
|
-
expect(mapping.characters["য"]).to eq("ya")
|
27
|
-
expect(mapping.name).to eq("Bengali Romanization, 2017")
|
28
|
-
expect(mapping.characters.count).to be >= extended.characters.count
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
context "with a invalid system code" do
|
33
|
-
it "raise an ruby exception without any mappings" do
|
34
|
-
invalid_system_code = "lets-make-up-a-system-code"
|
35
|
-
|
36
|
-
expect do
|
37
|
-
Interscript::Mapping.for(invalid_system_code)
|
38
|
-
end.to raise_error(Interscript::InvalidSystemError)
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
data/spec/interscript_spec.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "timeout"
|
4
|
-
require "pycall/import"
|
5
|
-
include PyCall::Import
|
6
|
-
|
7
|
-
RSpec.describe Interscript do
|
8
|
-
mask = ENV["TRANSLIT_SYSTEM"] || "*"
|
9
|
-
maps = {}
|
10
|
-
Dir["maps/#{mask}.yaml"].each do |system_file|
|
11
|
-
context "#{system_file} system" do
|
12
|
-
system = YAML.load_file(system_file)
|
13
|
-
system_name = File.basename(system_file, ".yaml")
|
14
|
-
|
15
|
-
system["tests"]&.reduce([]) do |_, test|
|
16
|
-
it "test for #{test}" do
|
17
|
-
Timeout::timeout(5) do
|
18
|
-
result = Interscript.transliterate(system_name, test["source"], maps) || ""
|
19
|
-
expected = (test["expected"] || "").unicode_normalize
|
20
|
-
expect(result).to eq(expected)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
data/spec/spec_helper.rb
DELETED