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 +4 -4
- data/lib/diachronr/rule.rb +5 -3
- data/lib/diachronr/version.rb +1 -1
- data/test/diachronr_test.rb +9 -2
- data/test/fixtures/multi-char.yml +13 -0
- data/test/fixtures/seonic_to_varag.yml +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c7a9f9ac16985d1197cc75c73f57ece689819fa2
|
4
|
+
data.tar.gz: 3fcf7b9076fca9df034ffccd3823ec48065b3ebf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 80339def600f19d8f298b89b4e41b893007edf69ffe0a3a60011bcacf2f4dae9fab8ba595c5b516cdf89132e1b8c9ca180facf99a163b37f8f013f7bd36162fd
|
7
|
+
data.tar.gz: bc001bb0c87a86b017374037fecdf2b85e3b35e765bfae332933fc76b818f56c4b6104840abd426526ebc0021d9fe35867b983d0d46266d599cff093ec1d73f2
|
data/lib/diachronr/rule.rb
CHANGED
@@ -24,13 +24,14 @@ module Diachronr
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def get_categories(value, categories)
|
27
|
-
categories.select { |c| value.include?
|
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
|
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.
|
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
|
)
|
data/lib/diachronr/version.rb
CHANGED
data/test/diachronr_test.rb
CHANGED
@@ -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)
|
34
|
+
assert_equal varag, r.apply(seonic)
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
-
|
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
|
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.
|
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:
|
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
|