zenlish 0.2.06 → 0.2.07

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.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +48 -275
  3. data/CHANGELOG.md +8 -0
  4. data/LICENSE.txt +1 -1
  5. data/lib/zenlish/feature/feature_struct_def.rb +0 -2
  6. data/lib/zenlish/inflect/output_expression.rb +4 -0
  7. data/lib/zenlish/version.rb +1 -1
  8. data/lib/zenlish/wclasses/irregular_verb_extension.rb +0 -1
  9. data/lib/zenlish.rb +3 -3
  10. data/spec/zenlish/feature/boolean_domain_spec.rb +14 -14
  11. data/spec/zenlish/feature/boolean_value_spec.rb +6 -5
  12. data/spec/zenlish/feature/enumeration_domain_spec.rb +16 -16
  13. data/spec/zenlish/feature/feature_def_spec.rb +15 -14
  14. data/spec/zenlish/feature/feature_spec.rb +16 -16
  15. data/spec/zenlish/feature/feature_struct_def_bearer_spec.rb +16 -16
  16. data/spec/zenlish/feature/feature_struct_def_spec.rb +23 -23
  17. data/spec/zenlish/feature/identifier_domain_spec.rb +12 -12
  18. data/spec/zenlish/feature/identifier_value_spec.rb +6 -5
  19. data/spec/zenlish/feature/symbol_value_spec.rb +6 -5
  20. data/spec/zenlish/inflect/concatenation_spec.rb +8 -8
  21. data/spec/zenlish/inflect/equals_literal_spec.rb +17 -16
  22. data/spec/zenlish/inflect/feature_heading_spec.rb +14 -13
  23. data/spec/zenlish/inflect/formal_argument_spec.rb +5 -5
  24. data/spec/zenlish/inflect/function_call_spec.rb +8 -9
  25. data/spec/zenlish/inflect/inflection_rule_spec.rb +20 -20
  26. data/spec/zenlish/inflect/inflection_table_builder_spec.rb +37 -37
  27. data/spec/zenlish/inflect/inflection_table_spec.rb +33 -32
  28. data/spec/zenlish/inflect/input_asis_spec.rb +10 -9
  29. data/spec/zenlish/inflect/literal_asis_spec.rb +7 -7
  30. data/spec/zenlish/inflect/matches_pattern_spec.rb +15 -14
  31. data/spec/zenlish/inflect/membership_spec.rb +16 -15
  32. data/spec/zenlish/inflect/method_heading_spec.rb +12 -11
  33. data/spec/zenlish/inflect/not_equals_literal_spec.rb +17 -16
  34. data/spec/zenlish/inflect/substitution_spec.rb +9 -10
  35. data/spec/zenlish/inflect/unconditionally_true_spec.rb +7 -5
  36. data/spec/zenlish/lang/dictionary_spec.rb +17 -19
  37. data/spec/zenlish/lang/lemmatizer_spec.rb +23 -23
  38. data/spec/zenlish/lang/zenlish_grammar_spec.rb +3 -3
  39. data/spec/zenlish/lex/empty_lexicon_factory_spec.rb +8 -8
  40. data/spec/zenlish/lex/lexeme_spec.rb +18 -18
  41. data/spec/zenlish/lex/lexical_entry_spec.rb +14 -13
  42. data/spec/zenlish/lex/lexicon_spec.rb +44 -43
  43. data/spec/zenlish/lex/literal_spec.rb +6 -6
  44. data/spec/zenlish/lexer/lexer_spec.rb +10 -10
  45. data/spec/zenlish/parser/lesson1_spec.rb +79 -79
  46. data/spec/zenlish/parser/lesson2_spec.rb +102 -102
  47. data/spec/zenlish/parser/lesson3_spec.rb +89 -89
  48. data/spec/zenlish/parser/zparser_spec.rb +6 -6
  49. data/spec/zenlish/support/var2word.rb +0 -2
  50. data/spec/zenlish/trie/base_trie_node_spec.rb +11 -11
  51. data/spec/zenlish/trie/trie_spec.rb +46 -46
  52. data/spec/zenlish/wclasses/common_noun_spec.rb +9 -9
  53. data/spec/zenlish/wclasses/demonstrative_determiner_spec.rb +11 -11
  54. data/spec/zenlish/wclasses/irregular_verb_can_spec.rb +10 -10
  55. data/spec/zenlish/wclasses/irregular_verb_extension_spec.rb +10 -10
  56. data/spec/zenlish/wclasses/irregular_verb_spec.rb +19 -19
  57. data/spec/zenlish/wclasses/lexical_verb_spec.rb +7 -7
  58. data/spec/zenlish/wclasses/modal_verb_can_spec.rb +9 -9
  59. data/spec/zenlish/wclasses/noun_spec.rb +7 -7
  60. data/spec/zenlish/wclasses/personal_pronoun_spec.rb +15 -15
  61. data/spec/zenlish/wclasses/possessive_determiner_spec.rb +15 -15
  62. data/spec/zenlish/wclasses/preposition_spec.rb +5 -5
  63. data/spec/zenlish/wclasses/proper_noun_spec.rb +3 -3
  64. data/spec/zenlish/wclasses/regular_verb_spec.rb +12 -12
  65. data/spec/zenlish/wclasses/regular_verb_want_spec.rb +7 -7
  66. data/spec/zenlish/wclasses/verb_spec.rb +9 -9
  67. data/spec/zenlish_spec.rb +1 -1
  68. data/zenlish.gemspec +6 -5
  69. metadata +32 -16
@@ -6,100 +6,100 @@ require_relative '../../../lib/zenlish/trie/trie' # Load the class under test
6
6
  module Zenlish
7
7
  module Trie
8
8
  describe Trie do
9
- subject { Trie.new }
9
+ subject(:trie) { described_class.new }
10
10
 
11
11
  context 'Initialization:' do
12
- it 'should be initialized without argument' do
13
- expect { Trie.new }.not_to raise_error
12
+ it 'is initialized without argument' do
13
+ expect { described_class.new }.not_to raise_error
14
14
  end
15
15
 
16
- it 'should be a leaf node at start' do
17
- expect(subject.root).to be_kind_of(TrieRoot)
16
+ it 'is a leaf node at start' do
17
+ expect(trie.root).to be_a(TrieRoot)
18
18
  end
19
19
  end # context
20
20
 
21
21
  context 'Provided services:' do
22
- it 'should accept the addition of one single node' do
23
- expect { subject.add('a', 'OK') }.not_to raise_error
24
- expect(subject.root.include?('a')).to be_truthy
25
- expect(subject.root.succ['a']).to be_kind_of(TrieNode)
26
- expect(subject.root.succ['a'].value).to eq('OK')
22
+ it 'accepts the addition of one single node' do
23
+ expect { trie.add('a', 'OK') }.not_to raise_error
24
+ expect(trie.root).to include('a')
25
+ expect(trie.root.succ['a']).to be_a(TrieNode)
26
+ expect(trie.root.succ['a'].value).to eq('OK')
27
27
  end
28
28
 
29
- it 'should accept the addition of a node string' do
30
- expect { subject.add('abc', 'OK') }.not_to raise_error
31
- expect(subject.root.include?('a')).to be_truthy
32
- expect(subject.root.include?('b')).to be_falsy
29
+ it 'accepts the addition of a node string' do
30
+ expect { trie.add('abc', 'OK') }.not_to raise_error
31
+ expect(trie.root).to include('a')
32
+ expect(trie.root).not_to include('b')
33
33
 
34
- node_a = subject.root.succ['a']
35
- expect(node_a).to be_kind_of(TrieNode)
34
+ node_a = trie.root.succ['a']
35
+ expect(node_a).to be_a(TrieNode)
36
36
  expect(node_a.value).to be_nil
37
- expect(node_a.include?('b')).to be_truthy
38
- expect(node_a.include?('c')).to be_falsy
37
+ expect(node_a).to include('b')
38
+ expect(node_a).not_to include('c')
39
39
 
40
40
  node_b = node_a.succ['b']
41
- expect(node_b).to be_kind_of(TrieNode)
41
+ expect(node_b).to be_a(TrieNode)
42
42
  expect(node_b.value).to be_nil
43
- expect(node_b.include?('c')).to be_truthy
43
+ expect(node_b).to include('c')
44
44
 
45
45
  node_c = node_b.succ['c']
46
- expect(node_c).to be_kind_of(TrieNode)
46
+ expect(node_c).to be_a(TrieNode)
47
47
  expect(node_c.value).to eq('OK')
48
48
  expect(node_c).to be_leaf
49
49
  end
50
50
 
51
- it 'should accept the addition of multiple node strings' do
52
- subject.add('abc', 'ABC')
53
- expect { subject.add('abe', 'ABE') }.not_to raise_error
54
- root = subject.root
55
- expect(root.include?('a')).to be_truthy
56
- expect(root.include?('b')).to be_falsy
51
+ it 'accepts the addition of multiple node strings' do
52
+ trie.add('abc', 'ABC')
53
+ expect { trie.add('abe', 'ABE') }.not_to raise_error
54
+ root = trie.root
55
+ expect(root).to include('a')
56
+ expect(root).not_to include('b')
57
57
 
58
58
  node_a = root.succ['a']
59
59
 
60
60
  node_b = node_a.succ['b']
61
- expect(node_b).to be_kind_of(TrieNode)
61
+ expect(node_b).to be_a(TrieNode)
62
62
  expect(node_b.value).to be_nil
63
- expect(node_b.include?('c')).to be_truthy
64
- expect(node_b.include?('e')).to be_truthy
63
+ expect(node_b).to include('c')
64
+ expect(node_b).to include('e')
65
65
 
66
66
  node_c = node_b.succ['c']
67
- expect(node_c).to be_kind_of(TrieNode)
67
+ expect(node_c).to be_a(TrieNode)
68
68
  expect(node_c.value).to eq('ABC')
69
69
  expect(node_c).to be_leaf
70
70
 
71
71
  node_e = node_b.succ['e']
72
- expect(node_e).to be_kind_of(TrieNode)
72
+ expect(node_e).to be_a(TrieNode)
73
73
  expect(node_e.value).to eq('ABE')
74
74
  expect(node_e).to be_leaf
75
75
  end
76
76
 
77
- it 'should retrieve the node matching a given string' do
78
- subject.add('abc', 'ABC')
79
- subject.add('hello', 'WORLD')
80
- subject.add('hellene', 'GREEK')
77
+ it 'retrieves the node matching a given string' do
78
+ trie.add('abc', 'ABC')
79
+ trie.add('hello', 'WORLD')
80
+ trie.add('hellene', 'GREEK')
81
81
 
82
- hello_node = subject.search('hello')
82
+ hello_node = trie.search('hello')
83
83
  expect(hello_node.key).to eq('o')
84
84
  expect(hello_node.value).to eq('WORLD')
85
- hellish = subject.search('hell')
85
+ hellish = trie.search('hell')
86
86
  expect(hellish.key).to eq('l')
87
87
  expect(hellish.value).to be_nil
88
- expect(subject.search('greeting')).to be_nil
89
- hellene_node = subject.search('hellene')
88
+ expect(trie.search('greeting')).to be_nil
89
+ hellene_node = trie.search('hellene')
90
90
  expect(hellene_node.key).to eq('e')
91
91
  expect(hellene_node.value).to eq('GREEK')
92
- expect(subject.search('hellenes')).to be_nil
92
+ expect(trie.search('hellenes')).to be_nil
93
93
  end
94
94
 
95
- it 'should accept the addition of "synonyms"' do
96
- subject.add('abd', 'first')
97
- subject.add('abduce', 'ABDUCE')
95
+ it 'accepts the addition of "synonyms"' do
96
+ trie.add('abd', 'first')
97
+ trie.add('abduce', 'ABDUCE')
98
98
 
99
- abd_node = subject.search('abd')
99
+ abd_node = trie.search('abd')
100
100
  expect(abd_node.value).to eq('first')
101
101
 
102
- subject.add('abd', 'second')
102
+ trie.add('abd', 'second')
103
103
  expect(abd_node.value).to eq(%w[first second])
104
104
  end
105
105
  end # context
@@ -7,24 +7,24 @@ require_relative '../../../lib/zenlish/wclasses/common_noun' # Load the class un
7
7
  module Zenlish
8
8
  module WClasses
9
9
  describe CommonNoun do
10
- subject { CommonNoun.new }
10
+ subject(:noun) { described_class.new }
11
11
 
12
12
  context 'Initialization:' do
13
- it 'should be initialized without argument' do
14
- expect { CommonNoun.new }.not_to raise_error
13
+ it 'is initialized without argument' do
14
+ expect { described_class.new }.not_to raise_error
15
15
  end
16
16
  end # context
17
17
 
18
18
  context 'Provided services:' do
19
- it 'should provide a default inflection paradigm' do
20
- expect(subject.paradigm).not_to be_nil
19
+ it 'provides a default inflection paradigm' do
20
+ expect(noun.paradigm).not_to be_nil
21
21
  end
22
22
 
23
- it 'should support the pluralization of common nouns' do
23
+ it 'supports the pluralization of common nouns' do
24
24
  samples = %w[animal body people]
25
25
  lexemes = []
26
26
  Lang::Dictionary.entries.each do |ent|
27
- lexm = ent.lexemes.select { |lx| lx.wclass.kind_of?(Zenlish::WClasses::CommonNoun) }
27
+ lexm = ent.lexemes.select { |lx| lx.wclass.kind_of?(described_class) }
28
28
  if lexm && samples.include?(ent.lemma)
29
29
  lexemes.concat(lexm)
30
30
  end
@@ -38,11 +38,11 @@ module Zenlish
38
38
  end
39
39
  end
40
40
 
41
- it 'should know all its inflections' do
41
+ it 'knows all its inflections' do
42
42
  samples = %w[animal body people]
43
43
  lexemes = []
44
44
  Lang::Dictionary.entries.each do |ent|
45
- lexm = ent.lexemes.select { |lx| lx.wclass.kind_of?(Zenlish::WClasses::CommonNoun) }
45
+ lexm = ent.lexemes.select { |lx| lx.wclass.kind_of?(described_class) }
46
46
  if lexm && samples.include?(ent.lemma)
47
47
  lexemes.concat(lexm)
48
48
  end
@@ -8,18 +8,18 @@ require_relative '../../../lib/zenlish/wclasses/demonstrative_determiner' # Load
8
8
  module Zenlish
9
9
  module WClasses
10
10
  describe DemonstrativeDeterminer do
11
- subject { DemonstrativeDeterminer.new }
11
+ subject(:determiner) { described_class.new }
12
12
 
13
13
  context 'Initialization:' do
14
- it 'should be initialized without argument' do
15
- expect { DemonstrativeDeterminer.new }.not_to raise_error
14
+ it 'is initialized without argument' do
15
+ expect { described_class.new }.not_to raise_error
16
16
  end
17
17
  end # context
18
18
 
19
19
  context 'Provided services:' do
20
20
  def build_det(aBaseForm)
21
21
  entry = Zenlish::Lex::LexicalEntry.new(aBaseForm)
22
- Zenlish::Lex::Lexeme.new(subject, entry)
22
+ Zenlish::Lex::Lexeme.new(determiner, entry)
23
23
  end
24
24
 
25
25
  def test_all_inflections(det_form, wforms)
@@ -28,17 +28,17 @@ module Zenlish
28
28
  expect(inflected.sort).to eq(wforms.sort)
29
29
  end
30
30
 
31
- it 'should know that it is inflectable' do
32
- expect(subject).not_to be_invariable
31
+ it 'knows that it is inflectable' do
32
+ expect(determiner).not_to be_invariable
33
33
  end
34
34
 
35
- it 'should know its feature definitions' do
36
- expect(subject['NUMBER']).to be_kind_of(Feature::FeatureDef)
37
- expect(subject['DISTANCE']).to be_kind_of(Feature::FeatureDef)
38
- expect(subject['PARADIGM'].default.val).to eq('Demonstrative_det_paradigm')
35
+ it 'knows its feature definitions' do
36
+ expect(determiner['NUMBER']).to be_a(Feature::FeatureDef)
37
+ expect(determiner['DISTANCE']).to be_a(Feature::FeatureDef)
38
+ expect(determiner['PARADIGM'].default.val).to eq('Demonstrative_det_paradigm')
39
39
  end
40
40
 
41
- it 'should give all word forms' do
41
+ it 'gives all word forms' do
42
42
  test_all_inflections('this', %w[this that these those])
43
43
  end
44
44
  end # context
@@ -10,24 +10,24 @@ require_relative '../../../lib/zenlish/wclasses/irregular_verb_can'
10
10
  module Zenlish
11
11
  module WClasses
12
12
  describe IrregularVerbCan do
13
- subject { IrregularVerbCan.new }
13
+ subject(:irreg_can) { described_class.new }
14
14
 
15
15
  context 'Initialization:' do
16
- it 'should be initialized without argument' do
17
- expect { IrregularVerbCan.new }.not_to raise_error
16
+ it 'is initialized without argument' do
17
+ expect { described_class.new }.not_to raise_error
18
18
  end
19
19
  end # context
20
20
 
21
21
  context 'Provided services:' do
22
- it 'should know its inherited feature definitions' do
23
- expect(subject['NUMBER']).to be_kind_of(Feature::FeatureDef)
24
- expect(subject['PERSON']).to be_kind_of(Feature::FeatureDef)
25
- expect(subject['PARADIGM'].default.val).to eq('Verb_can_inflection')
22
+ it 'knows its inherited feature definitions' do
23
+ expect(irreg_can['NUMBER']).to be_a(Feature::FeatureDef)
24
+ expect(irreg_can['PERSON']).to be_a(Feature::FeatureDef)
25
+ expect(irreg_can['PARADIGM'].default.val).to eq('Verb_can_inflection')
26
26
  end
27
27
 
28
28
  def build_verb(aBaseForm)
29
29
  entry = Zenlish::Lex::LexicalEntry.new(aBaseForm)
30
- Zenlish::Lex::Lexeme.new(subject, entry)
30
+ Zenlish::Lex::Lexeme.new(irreg_can, entry)
31
31
  end
32
32
 
33
33
  def test_inflection_of(verb_form, pairs)
@@ -43,7 +43,7 @@ module Zenlish
43
43
  expect(inflected.sort).to eq(wforms.sort)
44
44
  end
45
45
 
46
- it 'should know how to inflect modal verb can' do
46
+ it 'knows how to inflect modal verb can' do
47
47
  expectations1 = [
48
48
  [:present, 'can'],
49
49
  [:past_simple, 'could']
@@ -51,7 +51,7 @@ module Zenlish
51
51
  test_inflection_of('can', expectations1)
52
52
  end
53
53
 
54
- it 'should give all word forms of a given verb' do
54
+ it 'gives all word forms of a given verb' do
55
55
  test_all_inflections('can', %w[can could])
56
56
  end
57
57
  end # context
@@ -8,28 +8,28 @@ require_relative '../../../lib/zenlish/wclasses/irregular_verb_extension'
8
8
  module Zenlish
9
9
  module WClasses
10
10
  describe IrregularVerbExtension do
11
- subject do
11
+ subject(:verb) do
12
12
  obj = Object.new
13
- obj.extend(IrregularVerbExtension)
13
+ obj.extend(described_class)
14
14
  obj.init_extension(obj)
15
15
  obj
16
16
  end
17
17
 
18
18
  context 'Initialization:' do
19
- it 'should mix-in with a host object' do
20
- expect { Object.new.extend(IrregularVerbExtension) }.not_to raise_error
19
+ it 'allows mix-in with a host object' do
20
+ expect { Object.new.extend(described_class) }.not_to raise_error
21
21
  end
22
22
 
23
- it 'should inject an instance variable' do
24
- expect(subject.instance_variable_get(:@forms)).to be_kind_of(Array)
23
+ it 'injects an instance variable' do
24
+ expect(verb.instance_variable_get(:@forms)).to be_a(Array)
25
25
  end
26
26
  end # context
27
27
 
28
28
  context 'Provided services:' do
29
- it 'should provide a write accessor' do
30
- subject.forms past_simple: 'chose', past_participle: 'chosen'
31
- expect(subject.past_simple).to eq('chose')
32
- expect(subject.past_participle).to eq('chosen')
29
+ it 'provides a write accessor' do
30
+ verb.forms past_simple: 'chose', past_participle: 'chosen'
31
+ expect(verb.past_simple).to eq('chose')
32
+ expect(verb.past_participle).to eq('chosen')
33
33
  end
34
34
  end # context
35
35
  end # describe
@@ -10,31 +10,18 @@ require_relative '../../../lib/zenlish/wclasses/irregular_verb'
10
10
  module Zenlish
11
11
  module WClasses
12
12
  describe IrregularVerb do
13
- subject { IrregularVerb.new }
13
+ subject(:verb) { described_class.new }
14
14
 
15
15
  context 'Initialization:' do
16
- it 'should be initialized without argument' do
17
- expect { IrregularVerb.new }.not_to raise_error
16
+ it 'is initialized without argument' do
17
+ expect { described_class.new }.not_to raise_error
18
18
  end
19
19
  end # context
20
20
 
21
21
  context 'Provided services:' do
22
- it 'should know its inherited feature definitions' do
23
- expect(subject['NUMBER']).to be_kind_of(Feature::FeatureDef)
24
- expect(subject['PERSON']).to be_kind_of(Feature::FeatureDef)
25
- expect(subject['PARADIGM'].default.val).to eq('Irregular_inflection')
26
- end
27
-
28
- let(:present_1sg) { [:first, :singular, :present, nil] }
29
- let(:present_3sg) { [:third, :singular, :present, nil] }
30
- let(:present_1pl) { [:first, :plural, :present, nil] }
31
- let(:progressive) { [nil, nil, :progressive, nil] }
32
- let(:past_simple) { [nil, nil, :past_simple, nil] }
33
- let(:past_participle) { [nil, nil, :past_participle, nil] }
34
-
35
22
  def build_verb(aBaseForm, p_simple, p_participle)
36
23
  entry = Zenlish::Lex::LexicalEntry.new(aBaseForm)
37
- lexeme = Zenlish::Lex::Lexeme.new(subject, entry)
24
+ lexeme = Zenlish::Lex::Lexeme.new(verb, entry)
38
25
  lexeme.forms past_simple: p_simple, past_participle: p_participle
39
26
  lexeme
40
27
  end
@@ -52,7 +39,20 @@ module Zenlish
52
39
  expect(inflected.sort).to eq(wforms.sort)
53
40
  end
54
41
 
55
- it 'should know how to inflect irregular verbs' do
42
+ let(:present_1sg) { [:first, :singular, :present, nil] }
43
+ let(:present_3sg) { [:third, :singular, :present, nil] }
44
+ let(:present_1pl) { [:first, :plural, :present, nil] }
45
+ let(:progressive) { [nil, nil, :progressive, nil] }
46
+ let(:past_simple) { [nil, nil, :past_simple, nil] }
47
+ let(:past_participle) { [nil, nil, :past_participle, nil] }
48
+
49
+ it 'knows its inherited feature definitions' do
50
+ expect(verb['NUMBER']).to be_a(Feature::FeatureDef)
51
+ expect(verb['PERSON']).to be_a(Feature::FeatureDef)
52
+ expect(verb['PARADIGM'].default.val).to eq('Irregular_inflection')
53
+ end
54
+
55
+ it 'knows how to inflect irregular verbs' do
56
56
  expectations1 = [
57
57
  [present_1sg, 'see'],
58
58
  [present_3sg, 'sees'],
@@ -74,7 +74,7 @@ module Zenlish
74
74
  test_inflection_of('make', 'made', 'made', expectations2)
75
75
  end
76
76
 
77
- it 'should give all word forms of a given verb' do
77
+ it 'gives all word forms of a given verb' do
78
78
  test_all_inflections('see', 'saw', 'seen', %w[see sees seeing saw seen])
79
79
  end
80
80
  end # context
@@ -15,19 +15,19 @@ module Zenlish
15
15
  end
16
16
 
17
17
  describe LexicalVerb do
18
- subject { LexicalVerb.new }
18
+ subject(:verb) { described_class.new }
19
19
 
20
20
  context 'Initialization:' do
21
- it 'should be initialized without argument' do
22
- expect { LexicalVerb.new }.not_to raise_error
21
+ it 'is initialized without argument' do
22
+ expect { described_class.new }.not_to raise_error
23
23
  end
24
24
  end # context
25
25
 
26
26
  context 'Provided services:' do
27
- it 'should know its inherited feature definitions' do
28
- expect(subject['NUMBER']).to be_kind_of(Feature::FeatureDef)
29
- expect(subject['PERSON']).to be_kind_of(Feature::FeatureDef)
30
- expect(subject['PARADIGM'].default.val).to eq('Regular_inflection')
27
+ it 'knows its inherited feature definitions' do
28
+ expect(verb['NUMBER']).to be_a(Feature::FeatureDef)
29
+ expect(verb['PERSON']).to be_a(Feature::FeatureDef)
30
+ expect(verb['PARADIGM'].default.val).to eq('Regular_inflection')
31
31
  end
32
32
  end # context
33
33
  end # describe
@@ -10,24 +10,24 @@ require_relative '../../../lib/zenlish/wclasses/modal_verb_can'
10
10
  module Zenlish
11
11
  module WClasses
12
12
  describe ModalVerbCan do
13
- subject { ModalVerbCan.new }
13
+ subject(:modal_can) { described_class.new }
14
14
 
15
15
  context 'Initialization:' do
16
- it 'should be initialized without argument' do
17
- expect { ModalVerbCan.new }.not_to raise_error
16
+ it 'is initialized without argument' do
17
+ expect { described_class.new }.not_to raise_error
18
18
  end
19
19
  end # context
20
20
 
21
21
  context 'Provided services:' do
22
- it 'should know its inherited feature definitions' do
23
- expect(subject['NUMBER']).to be_kind_of(Feature::FeatureDef)
24
- expect(subject['PERSON']).to be_kind_of(Feature::FeatureDef)
25
- expect(subject['PARADIGM'].default.val).to eq('Verb_can_inflection')
22
+ it 'knows its inherited feature definitions' do
23
+ expect(modal_can['NUMBER']).to be_a(Feature::FeatureDef)
24
+ expect(modal_can['PERSON']).to be_a(Feature::FeatureDef)
25
+ expect(modal_can['PARADIGM'].default.val).to eq('Verb_can_inflection')
26
26
  end
27
27
 
28
28
  def build_verb(aBaseForm)
29
29
  entry = Zenlish::Lex::LexicalEntry.new(aBaseForm)
30
- Zenlish::Lex::Lexeme.new(subject, entry)
30
+ Zenlish::Lex::Lexeme.new(modal_can, entry)
31
31
  end
32
32
 
33
33
  def test_inflection_of(verb_form, pairs)
@@ -37,7 +37,7 @@ module Zenlish
37
37
  end
38
38
  end
39
39
 
40
- it 'should know how to inflect modal verb can' do
40
+ it 'knows how to inflect modal verb can' do
41
41
  expectations1 = [
42
42
  [:present, 'can'],
43
43
  [:past_simple, 'could']
@@ -6,23 +6,23 @@ require_relative '../../../lib/zenlish/wclasses/noun' # Load the class under tes
6
6
  module Zenlish
7
7
  module WClasses
8
8
  describe Noun do
9
- subject { Noun.new }
9
+ subject(:noun) { described_class.new }
10
10
 
11
11
  context 'Initialization:' do
12
- it 'should be initialized without argument' do
13
- expect { Noun.new }.not_to raise_error
12
+ it 'is initialized without argument' do
13
+ expect { described_class.new }.not_to raise_error
14
14
  end
15
15
  end # context
16
16
 
17
17
  context 'Provided services:' do
18
- it 'should know that it is variable (has inflected forms)' do
19
- expect(subject).not_to be_invariable
18
+ it 'knows that it is variable (has inflected forms)' do
19
+ expect(noun).not_to be_invariable
20
20
  end
21
21
 
22
- it 'should know its feature names' do
22
+ it 'knows its feature names' do
23
23
  expectations = %w(NUMBER COUNTABILITY)
24
24
  expectations.each do |name|
25
- expect(subject[name]).not_to be_nil
25
+ expect(noun[name]).not_to be_nil
26
26
  end
27
27
  end
28
28
  end # context
@@ -10,22 +10,22 @@ module Zenlish
10
10
  module WClasses
11
11
  describe PersonalPronoun do
12
12
  include Feature::FeatureStructDefBearer
13
- subject { PersonalPronoun.new }
13
+ subject(:pronoun) { described_class.new }
14
14
 
15
15
  context 'Initialization:' do
16
- it 'should be initialized without argument' do
17
- expect { PersonalPronoun.new }.not_to raise_error
16
+ it 'is initialized without argument' do
17
+ expect { described_class.new }.not_to raise_error
18
18
  end
19
19
 
20
- it 'should know that it is inflectable' do
21
- expect(subject).not_to be_invariable
20
+ it 'knows that it is inflectable' do
21
+ expect(pronoun).not_to be_invariable
22
22
  end
23
23
  end # context
24
24
 
25
25
  context 'Provided services:' do
26
26
  def build_ppn(aBaseForm, aFeatureHash)
27
27
  entry = Zenlish::Lex::LexicalEntry.new(aBaseForm)
28
- Zenlish::Lex::Lexeme.new(subject, entry, aFeatureHash)
28
+ Zenlish::Lex::Lexeme.new(pronoun, entry, aFeatureHash)
29
29
  end
30
30
 
31
31
  def test_all_inflections(det_form, aFeatureHash, wforms)
@@ -34,28 +34,28 @@ module Zenlish
34
34
  expect(inflected.sort).to eq(wforms.sort)
35
35
  end
36
36
 
37
- it 'should know its feature definitions' do
38
- expect(subject['NUMBER']).to be_kind_of(Feature::FeatureDef)
39
- expect(subject['PERSON']).to be_kind_of(Feature::FeatureDef)
40
- expect(subject['GENDER']).to be_kind_of(Feature::FeatureDef)
41
- expect(subject['CASE']).to be_kind_of(Feature::FeatureDef)
42
- expect(subject['PARADIGM'].default.val).to eq('ppn_1st_paradigm')
37
+ it 'knows its feature definitions' do
38
+ expect(pronoun['NUMBER']).to be_a(Feature::FeatureDef)
39
+ expect(pronoun['PERSON']).to be_a(Feature::FeatureDef)
40
+ expect(pronoun['GENDER']).to be_a(Feature::FeatureDef)
41
+ expect(pronoun['CASE']).to be_a(Feature::FeatureDef)
42
+ expect(pronoun['PARADIGM'].default.val).to eq('ppn_1st_paradigm')
43
43
  end
44
44
 
45
- it 'should give all word forms for the first person' do
45
+ it 'gives all word forms for the first person' do
46
46
  feature_defs = { 'PERSON' => enumeration(:first),
47
47
  'GENDER' => enumeration(:feminine, :masculine) }
48
48
  test_all_inflections('I', feature_defs, %w[I we me us])
49
49
  end
50
50
 
51
- it 'should give all word forms for the second person' do
51
+ it 'gives all word forms for the second person' do
52
52
  feature_defs = { 'PERSON' => enumeration(:second),
53
53
  'GENDER' => enumeration(:feminine, :masculine),
54
54
  'PARADIGM' => [identifier, 'ppn_2nd_paradigm'] }
55
55
  test_all_inflections('you', feature_defs, ['you'])
56
56
  end
57
57
 
58
- it 'should give all word forms for the third person' do
58
+ it 'gives all word forms for the third person' do
59
59
  feature_defs = { 'PERSON' => enumeration(:third),
60
60
  'PARADIGM' => [identifier, 'ppn_3rd_paradigm'] }
61
61
  test_all_inflections('it', feature_defs, %w[she he it they her him them])
@@ -10,18 +10,18 @@ module Zenlish
10
10
  module WClasses
11
11
  describe PossessiveDeterminer do
12
12
  include Feature::FeatureStructDefBearer
13
- subject { PossessiveDeterminer.new }
13
+ subject(:determiner) { described_class.new }
14
14
 
15
15
  context 'Initialization:' do
16
- it 'should be initialized without argument' do
17
- expect { PossessiveDeterminer.new }.not_to raise_error
16
+ it 'is initialized without argument' do
17
+ expect { described_class.new }.not_to raise_error
18
18
  end
19
19
  end # context
20
20
 
21
21
  context 'Provided services:' do
22
22
  def build_det(aBaseForm, aFeatureHash)
23
23
  entry = Zenlish::Lex::LexicalEntry.new(aBaseForm)
24
- Zenlish::Lex::Lexeme.new(subject, entry, aFeatureHash)
24
+ Zenlish::Lex::Lexeme.new(determiner, entry, aFeatureHash)
25
25
  end
26
26
 
27
27
  def test_all_inflections(det_form, aFeatureHash, wforms)
@@ -30,37 +30,37 @@ module Zenlish
30
30
  expect(inflected.sort).to eq(wforms.sort)
31
31
  end
32
32
 
33
- it 'should know that it is inflectable' do
34
- expect(subject).not_to be_invariable
33
+ it 'knows that it is inflectable' do
34
+ expect(determiner).not_to be_invariable
35
35
  end
36
36
 
37
- it 'should know its feature definitions' do
38
- expect(subject['NUMBER']).to be_kind_of(Feature::FeatureDef)
39
- expect(subject['PERSON']).to be_kind_of(Feature::FeatureDef)
40
- expect(subject['GENDER']).to be_kind_of(Feature::FeatureDef)
41
- expect(subject['PARADIGM'].default.val).to eq('possdet_1st_paradigm')
37
+ it 'knows its feature definitions' do
38
+ expect(determiner['NUMBER']).to be_a(Feature::FeatureDef)
39
+ expect(determiner['PERSON']).to be_a(Feature::FeatureDef)
40
+ expect(determiner['GENDER']).to be_a(Feature::FeatureDef)
41
+ expect(determiner['PARADIGM'].default.val).to eq('possdet_1st_paradigm')
42
42
  end
43
43
 
44
- it 'should give all word forms for the first person' do
44
+ it 'gives all word forms for the first person' do
45
45
  feature_defs = { 'PERSON' => enumeration(:first),
46
46
  'GENDER' => enumeration(:feminine, :masculine) }
47
47
  test_all_inflections('my', feature_defs, %w[my our])
48
48
  end
49
49
 
50
- it 'should give all word forms for the second person' do
50
+ it 'gives all word forms for the second person' do
51
51
  feature_defs = { 'PERSON' => enumeration(:second),
52
52
  'GENDER' => enumeration(:feminine, :masculine),
53
53
  'PARADIGM' => [identifier, 'possdet_2nd_paradigm'] }
54
54
  test_all_inflections('your', feature_defs, ['your'])
55
55
  end
56
56
 
57
- it 'should give all word forms for the third person' do
57
+ it 'gives all word forms for the third person' do
58
58
  feature_defs = { 'PERSON' => enumeration(:third),
59
59
  'PARADIGM' => [identifier, 'possdet_3rd_paradigm'] }
60
60
  test_all_inflections('its', feature_defs, %w[its her his their])
61
61
  end
62
62
 
63
- # it 'should give all word forms' do
63
+ # it 'gives all word forms' do
64
64
  # test_all_inflections('this', ['this', 'that', 'these', 'those'])
65
65
  # end
66
66
  end # context