diff --git a/.github/workflows/rake.yml b/.github/workflows/rake.yml new file mode 100644 index 00000000..6befce4e --- /dev/null +++ b/.github/workflows/rake.yml @@ -0,0 +1,57 @@ +name: rake + +on: + push: + branches: [ master, main ] + tags: [ v* ] + pull_request: + +# https://github.community/t/use-working-directory-for-entire-job/16747/12 +defaults: + run: + working-directory: ./ruby + +jobs: + rake: + name: Test on Ruby ${{ matrix.ruby }} ${{ matrix.os }} + runs-on: ${{ matrix.os }} + continue-on-error: ${{ matrix.experimental }} + strategy: + fail-fast: false + matrix: + ruby: [ 2.7, 2.6, 2.5, 2.4 ] + os: [ ubuntu-latest, windows-latest, macos-latest ] + experimental: [ false ] + include: + - ruby: 3.0 + os: 'ubuntu-latest' + experimental: true + - ruby: 3.0 + os: 'windows-latest' + experimental: true + - ruby: 3.0 + os: 'macos-latest' + experimental: true + + env: + BUNDLE_WITHOUT: "secryst" + + steps: + - uses: actions/checkout@v2 + with: + submodules: true + + - uses: actions/setup-node@v2 + with: + node-version: '15' + + - if: matrix.os == 'macos-latest' + run: brew install automake autoconf + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + working-directory: ./ruby + + - run: bundle exec rspec -f f diff --git a/maps/maps/bgnpcgn-ron-cyrl-latn-2002.imp b/maps/maps/bgnpcgn-ron-cyrl-latn-2002.imp new file mode 100644 index 00000000..43eaeff1 --- /dev/null +++ b/maps/maps/bgnpcgn-ron-cyrl-latn-2002.imp @@ -0,0 +1,165 @@ +metadata { + authority_id: bgnpcgn + id: 2002 + language: iso-639-2:ron + source_script: Cyrl + destination_script: Latn + name: CYRILLIC - ROMAN BGN/PCGN 2002 Agreement + url: https://assets.publishing.service.gov.uk/government/uploads/system/uploads/attachment_data/file/816780/TABLE_OF_CORRESPONDENCES_FOR_MOLDOVAN.pdf + creation_date: 2002 + confirmation_date: 2019 + description: | + In 1990, the Moldovan authorities adopted the Roman alphabet to replace the existing Cyrillic + alphabet. The presentation below provides a table of correspondences between the former Cyrillic alphabet + and the current Roman alphabet. When Moldovan Roman-alphabet spellings are not available, this table + can be used to convert Moldovan Cyrillic spellings. It should be noted that Moldovan is little used as a + language label now, and is usually considered as Romanian. + + notes: + - | # 1 + This Roman-script form is used before e, i and iu. + + - | # 2 + This Roman-script form is used before a. + + - | # 3 + The letter ‘i’ is used to represent Ь at the end of a word. + + - | # 4 + An inventory of letter-diacritic combinations, with their Unicode encoding, in addition to the + unmodified letters of the basic Roman script is: + Ț (U+021A) ț (U+021B) + Ș (U+0218) ș (U+0219) + Î (U+00CE) î (U+00EE) + Ă (U+0102) ă (U+0103) + + - | # 5 + The Roman-script columns show only lowercase forms but, when applying the table, uppercase and + lowercase Roman letters as appropriate should be used. +} + +tests { + # https://www.tourister.ru/world/europe/moldova-republic-of/publications/507 + test "Бунэ диминеа'ца!", "Bună diminea'ţa!" + test "Ну неам вэзут де ун кар де ань!", "Nu neam văzut de un car de ani!" # note[3] + test "Перми'тецимь сэ вэ салут ын нумеле...", "Permi'teţimi să vă salut în numele..." # note[3] + test "Сэ фий сэнэтос!", "Să fii sănătos!" + test "Ку ун груп де туришть", "Cu un grup de turişti" # note[3] + test "Пе соци'я меа", "Pe soţi'ea mea" + test "хотелул", "hotelul" + test "Че са ынтымплат?", "Ce sa întîmplat?" + test "Драджь", "Dradzhi" # note[3] + test "Че есте ачаста?", "Ce este aceasta?" # note[1] note[2] + test "черюрй", "ceriuri" # note[1] + test "феричире!", "fericire!" + test "ӂэужык", "giăuzhîc" + + test "БУНЭ ДИМИНЕА'ЦА!", "BUNĂ DIMINEA'ŢA!" + test "НУ НЕАМ ВЭЗУТ ДЕ УН КАР ДЕ АНЬ!", "NU NEAM VĂZUT DE UN CAR DE ANI!" # note[3] + test "ПЕРМИ'ТЕЦИМЬ СЭ ВЭ САЛУТ ЫН НУМЕЛЕ...", "PERMI'TEŢIMI SĂ VĂ SALUT ÎN NUMELE..." # note[3] + test "СЭ ФИЙ СЭНЭТОС!", "SĂ FII SĂNĂTOS!" + test "КУ УН ГРУП ДЕ ТУРИШТЬ", "CU UN GRUP DE TURIŞTI" # note[3] + test "ПЕ СОЦИ'Я МЕА", "PE SOŢI'EA MEA" + test "ХОТЕЛУЛ", "HOTELUL" + test "ЧЕ СА ЫНТЫМПЛАТ?", "CE SA ÎNTÎMPLAT?" + test "ДРАДЖЬ", "DRADZHI" # note[3] + test "ЧЕ ЕСТЕ АЧАСТА?", "CE ESTE ACEASTA?" # note[1] note[2] + test "ЧЕРЮРЙ", "CERIURI" # note[1] + test "ФЕРИЧИРЕ!", "FERICIRE!" + test "Ӂэужык", "GIăuzhîc" +} + +stage { + + # RULES + # note[1] + sub "\u0413", "Gh", after: any("ЕеИиЙйЮю") # Г[ЕеИиЙйЮю] + sub "\u0433", "gh", after: any("ЕеИиЙйЮю") # г[ЕеИиЙйЮю] + sub "\u04C1", "Gh", after: any("ЕеИиЙйЮю") # Ӂ[ЕеИиЙйЮю] + sub "\u04C1", "gh", after: any("ЕеИиЙйЮю") # ӂ[ЕеИиЙйЮю] + sub "\u041A", "Ch", after: any("ЕеИиЙйЮю") # К[ЕеИиЙйЮю] + sub "\u043A", "ch", after: any("ЕеИиЙйЮю") # к[ЕеИиЙйЮю] + sub "\u0427", "C", after: any("ЕеИиЙйЮю") # Ч[ЕеИиЙйЮю] + sub "\u0447", "c", after: any("ЕеИиЙйЮю") # ч[ЕеИиЙйЮю] + + # note[2] + sub "\u04C1", "Ge", after: any("Аа") # Ӂ[Aa] + sub "\u04C1", "ge", after: any("Аа") # ӂ[Aa] + sub "\u0427", "CE", after: any("А") # Ч[A] + sub "\u0427", "Ce", after: any("а") # Ч[a] + sub "\u0447", "ce", after: any("Аа") # ч[Aa] + + # note[3] + sub "\u042C", "I", after: boundary # Ь$ + sub "\u044C", "i", after: boundary # ь$ + + + # CHARACTERS + parallel { + sub "\u0410", "A" # А + sub "\u0411", "B" # Б + sub "\u0412", "V" # B + sub "\u0413", "G" # Г note[1] + sub "\u0414", "D" # Д + sub "\u0415", "E" # Е + sub "\u0416", "ZH" # Ж + sub "\u04C1", "GI" # Ӂ note[1] note[2] + sub "\u0417", "Z" # З + sub "\u0418", "I" # И + sub "\u0419", "I" # Й + sub "\u041A", "C" # К note[1] + sub "\u041B", "L" # Л + sub "\u041C", "M" # М + sub "\u041D", "N" # Н + sub "\u041E", "O" # О + sub "\u041F", "P" # П + sub "\u0420", "R" # Р + sub "\u0421", "S" # С + sub "\u0422", "T" # Т + sub "\u0423", "U" # У + sub "\u0424", "F" # Ф + sub "\u0425", "H" # Х + sub "\u0426", "Ţ" # Ц + sub "\u0427", "CI" # Ч note[1] note[2] + sub "\u0428", "Ş" # Ш + sub "\u042B", "Î" # Ы + sub "\u042C", "’" # Ь note[3] + sub "\u042D", "Ă" # Э + sub "\u042E", "IU" # Ю + sub "\u042F", "EA" # Я + + sub "\u0430", "a" # а + sub "\u0431", "b" # б + sub "\u0432", "v" # b + sub "\u0433", "g" # г note[1] + sub "\u0434", "d" # д + sub "\u0435", "e" # е + sub "\u0436", "zh" # ж + sub "\u04C2", "gi" # ӂ note[1] note[2] + sub "\u0437", "z" # з + sub "\u0438", "i" # и + sub "\u0439", "i" # й + sub "\u043A", "c" # к note[1] + sub "\u043B", "l" # л + sub "\u043C", "m" # м + sub "\u043D", "n" # н + sub "\u043E", "o" # о + sub "\u043F", "p" # п + sub "\u0440", "r" # р + sub "\u0441", "s" # с + sub "\u0442", "t" # т + sub "\u0443", "u" # у + sub "\u0444", "f" # ф + sub "\u0445", "h" # х + sub "\u0446", "ţ" # ц + sub "\u0447", "ci" # ч note[1] note[2] + sub "\u0448", "ş" # ш + sub "\u044B", "î" # ы + sub "\u044C", "’" # ь note[3] + sub "\u044D", "ă" # э + sub "\u044E", "iu" # ю + sub "\u044F", "ea" # я + } + +} + diff --git a/ruby/.travis.yml b/ruby/.travis.yml deleted file mode 100644 index a12ad5e1..00000000 --- a/ruby/.travis.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- -language: ruby -cache: bundler -rvm: - - 2.7.2 -before_install: gem install bundler -v 2.1.4 diff --git a/ruby/Gemfile b/ruby/Gemfile index 0709a9ae..de500d02 100644 --- a/ruby/Gemfile +++ b/ruby/Gemfile @@ -8,11 +8,13 @@ gem "rspec", "~> 3.0" gem "interscript-maps", path: "../maps" -group :secryst do - if File.exist? "../../secryst" - gem "secryst", path: "../../secryst" - else - gem "secryst" +unless Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.7") + group :secryst do + if File.exist? "../../secryst" + gem "secryst", path: "../../secryst" + else + gem "secryst" + end end end diff --git a/ruby/Gemfile.lock b/ruby/Gemfile.lock deleted file mode 100644 index 6c17ee8d..00000000 --- a/ruby/Gemfile.lock +++ /dev/null @@ -1,74 +0,0 @@ -PATH - remote: ../../secryst - specs: - secryst (0.1.0) - onnxruntime (~> 0.5) - rubyzip (~> 2.3) - thor (~> 1.0) - torch-rb (~> 0.5) - -PATH - remote: ../maps - specs: - interscript-maps (1.90.0) - -PATH - remote: . - specs: - interscript (1.90.0) - interscript-maps - thor - -GEM - remote: https://rubygems.org/ - specs: - diff-lcs (1.4.4) - docile (1.3.5) - ffi (1.15.0) - libv8 (8.4.255.0) - mini_racer (0.3.1) - libv8 (~> 8.4.255) - onnxruntime (0.5.2) - ffi - rake (12.3.3) - regexp_parser (2.0.3) - rice (3.0.0) - rspec (3.9.0) - rspec-core (~> 3.9.0) - rspec-expectations (~> 3.9.0) - rspec-mocks (~> 3.9.0) - rspec-core (3.9.3) - rspec-support (~> 3.9.3) - rspec-expectations (3.9.2) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.9.0) - rspec-mocks (3.9.1) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.9.0) - rspec-support (3.9.3) - rubyzip (2.3.0) - simplecov (0.21.2) - docile (~> 1.1) - simplecov-html (~> 0.11) - simplecov_json_formatter (~> 0.1) - simplecov-html (0.12.3) - simplecov_json_formatter (0.1.2) - thor (1.0.1) - torch-rb (0.5.3) - rice (>= 2.2) - -PLATFORMS - ruby - -DEPENDENCIES - interscript! - interscript-maps! - mini_racer - rake (~> 12.0) - regexp_parser - rspec (~> 3.0) - secryst! - simplecov - -BUNDLED WITH - 2.1.4 diff --git a/ruby/lib/interscript.rb b/ruby/lib/interscript.rb index b726939b..8dc8e30c 100644 --- a/ruby/lib/interscript.rb +++ b/ruby/lib/interscript.rb @@ -87,23 +87,12 @@ def map_aliases # List all possible maps to use def maps(basename: true, load_path: false, select: "*", libraries: false) - if load_path - paths = Interscript.load_path - else - paths = Interscript.map_locations - end - + paths = load_path ? Interscript.load_path : Interscript.map_locations ext = libraries ? "iml" : "imp" - paths.map do |i| - Dir["#{i}/#{select}.#{ext}"] - end.flatten.yield_self do |i| - if basename - i.map { |j| File.basename(j, ".#{ext}") } - else - i - end - end + imps = paths.map { |i| Dir["#{i}/#{select}.#{ext}"] }.flatten + + basename ? imps.map { |j| File.basename(j, ".#{ext}") } : imps end end end diff --git a/ruby/requirements.txt b/ruby/requirements.txt new file mode 100644 index 00000000..12c6d5d5 --- /dev/null +++ b/ruby/requirements.txt @@ -0,0 +1 @@ +torch