diachronr 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9b2e2d058e7f5f172916afd00f908040629c680a
4
- data.tar.gz: d2f09d22747c1a296eb934cb46cd71a2b532d000
3
+ metadata.gz: c7a9f9ac16985d1197cc75c73f57ece689819fa2
4
+ data.tar.gz: 3fcf7b9076fca9df034ffccd3823ec48065b3ebf
5
5
  SHA512:
6
- metadata.gz: 3359a50b580a06e15ff588e7dffc85e7cf8ab7e2ef4714111e26881722cd6a3950f133eeb00dd648e30b4e5b9b650e3591117c0a16e6c4b17c6e56bf375bfdd5
7
- data.tar.gz: 3db05f89d3c90c60014449877464124d5dd1696320ea57106ea89a81a142f171ba60b211e4333ed23fe000d2513674f07feb478f52b5808e75a2fc584ebbe033
6
+ metadata.gz: 80339def600f19d8f298b89b4e41b893007edf69ffe0a3a60011bcacf2f4dae9fab8ba595c5b516cdf89132e1b8c9ca180facf99a163b37f8f013f7bd36162fd
7
+ data.tar.gz: bc001bb0c87a86b017374037fecdf2b85e3b35e765bfae332933fc76b818f56c4b6104840abd426526ebc0021d9fe35867b983d0d46266d599cff093ec1d73f2
@@ -24,13 +24,14 @@ module Diachronr
24
24
  end
25
25
 
26
26
  def get_categories(value, categories)
27
- categories.select { |c| value.include? c.sign }
27
+ categories.select { |c| value && value.include?(c.sign) }
28
28
  end
29
29
 
30
30
  def new_to(categories, category_index, index)
31
31
  t = get_categories(to, categories)[category_index]
32
32
  return to if t.nil?
33
- t.contents[index]
33
+ contents = t.contents.chars.include?(',') ? t.contents.split(',') : t.contents.chars
34
+ contents[index]
34
35
  end # new_to
35
36
 
36
37
  def new_from(category, char)
@@ -40,7 +41,8 @@ module Diachronr
40
41
  def category_rules(categories)
41
42
  rules = []
42
43
  get_categories(from, categories).each_with_index do |cat, i|
43
- cat.contents.each_char.with_index do |f, fi|
44
+ contents = cat.contents.chars.include?(',') ? cat.contents.split(',') : cat.contents.chars
45
+ contents.each.with_index do |f, fi|
44
46
  rules << Rule.new(
45
47
  "#{new_from(cat, f)}/#{new_to(categories, i, fi)}/#{condition}"
46
48
  )
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Diachronr
4
- VERSION = '1.0.0'
4
+ VERSION = '1.1.0'
5
5
  end
@@ -31,8 +31,15 @@ class DiachronrTest < Minitest::Test
31
31
  def test_apply_ruleset
32
32
  r = Diachronr::RuleSet.load 'test/fixtures/seonic_to_varag.yml'
33
33
  r.options['seonic'].each do |seonic, varag|
34
- assert_equal r.apply(seonic), varag
34
+ assert_equal varag, r.apply(seonic)
35
35
  end
36
36
  end
37
37
 
38
- end
38
+ def test_apply_ruleset_multi_category
39
+ r = Diachronr::RuleSet.load 'test/fixtures/multi-char.yml'
40
+ r.options['test'].each do |from, to|
41
+ assert_equal to, r.apply(from)
42
+ end
43
+ end
44
+
45
+ end
@@ -0,0 +1,13 @@
1
+ rewrites: []
2
+ categories:
3
+ - A=st,zd
4
+ - B=ff,vv
5
+ - C=kʷ,
6
+ - D=wh,
7
+ rules:
8
+ - A/B/_
9
+ - C/D/_
10
+ test:
11
+ star: ffar
12
+ zdar: vvar
13
+ kʷékʷlos: whéwhlos
@@ -116,4 +116,4 @@ seonic:
116
116
  kerric: garrag
117
117
  anvo: anb
118
118
  tactus: dath # dathe
119
- luukas: lah
119
+ luukas: lah
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: diachronr
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miker Irick
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-18 00:00:00.000000000 Z
11
+ date: 2022-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: slop
@@ -87,6 +87,7 @@ files:
87
87
  - lib/diachronr/ruleset.rb
88
88
  - lib/diachronr/version.rb
89
89
  - test/diachronr_test.rb
90
+ - test/fixtures/multi-char.yml
90
91
  - test/fixtures/seonic_to_varag.yml
91
92
  - test/test_helper.rb
92
93
  homepage: http://michaelirick.com
@@ -115,5 +116,6 @@ specification_version: 4
115
116
  summary: applies diachronic sound changes to constructed languages
116
117
  test_files:
117
118
  - test/diachronr_test.rb
119
+ - test/fixtures/multi-char.yml
118
120
  - test/fixtures/seonic_to_varag.yml
119
121
  - test/test_helper.rb