ruby-framenet 0.0.2 → 0.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: 47b197dcde86a3220d55e93261bb5d685e7f39dd
4
- data.tar.gz: 30fb45106a85f3d553e21470df98331d4023a252
3
+ metadata.gz: 40eea1fb752ffec367f3c8a60cfc65fb523284a5
4
+ data.tar.gz: 6415a279462c76ffb4d020ee17dc6c7295781d05
5
5
  SHA512:
6
- metadata.gz: d92518f10cc59a6bdc93685a3214d8a5c169f4f507b43f195f81628943c386389fa07959d39b35fa093e09bc55bd560860fa7e003a77b19cd75fb849253d93bb
7
- data.tar.gz: 17f117eca8bcda0f1bb3a847a9130f2c9cea425f466563691b054b821dceedc752666eac6ebccd2f0853149468e560916b21c3d261db6dd1c1b6417066dd42b1
6
+ metadata.gz: f446418a3501e858898aab9e27391dd05e1e8dcbba28828a26ecc43791c4001bb5f1c280546edd9d38d050c5bccc4a98eb33bf563f33e6de2fc21299272a7f0f
7
+ data.tar.gz: ed57b4374a5ab7f62de701ed52e01e355d4d090502ed8712a29a322e7baf357255311cfeb8e8e474e84acb95c7ef880c43ac7972f6fbe08038bb7673eb2e575b
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/ChangeLog CHANGED
@@ -1,8 +1,18 @@
1
+ 2017-03-10 Michael Granger <ged@FaerieMUD.org>
2
+
3
+ * History.md, lib/frame_net.rb, ruby-framenet.gemspec:
4
+ Bump the minor version, update history.
5
+ [e7bcb297f265] [tip]
6
+
7
+ * lib/frame_net/frame.rb, spec/frame_net/frame_spec.rb:
8
+ Add Frame#core_element_sets.
9
+ [da30e8ce8279]
10
+
1
11
  2017-03-09 Michael Granger <ged@FaerieMUD.org>
2
12
 
3
13
  * .hgtags:
4
14
  Added tag v0.0.2 for changeset 88e23983e25b
5
- [d009ab23eff8] [tip]
15
+ [d009ab23eff8]
6
16
 
7
17
  * .hgsigs:
8
18
  Added signature for changeset a275939b201e
data/History.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## v0.1.0 [2017-03-10] Michael Granger <ged@FaerieMUD.org>
2
+
3
+ Enhancements:
4
+
5
+ - Add Frame#core_element_sets.
6
+
7
+
1
8
  ## v0.0.2 [2017-03-09] Michael Granger <ged@FaerieMUD.org>
2
9
 
3
10
  Enhancements:
data/lib/frame_net.rb CHANGED
@@ -16,10 +16,10 @@ module FrameNet
16
16
  extend Loggability
17
17
 
18
18
  # Package version
19
- VERSION = '0.0.2'
19
+ VERSION = '0.1.0'
20
20
 
21
21
  # Version control revision
22
- REVISION = %q$Revision: ecb01eee279b $
22
+ REVISION = %q$Revision: e7bcb297f265 $
23
23
 
24
24
  # The Pathname for the library's data directory, taken from the
25
25
  # FRAME_NET_DATA_DIR env variable first, then the datadir for the ruby-framenet
@@ -59,6 +59,10 @@ class FrameNet::Frame
59
59
  frame.elements = FrameNet::Frame::Element.from_frame_data( doc )
60
60
  frame.relations = FrameNet::Frame::Relation.from_frame_data( doc )
61
61
  frame.lexical_units = FrameNet::Frame::LexicalUnit.from_frame_data( doc )
62
+
63
+ frame.core_element_set_ids = doc.find( '//fn:frame/fn:FEcoreSet' ).map do |set_el|
64
+ set_el.find( './fn:memberFE' ).map {|el| el['ID'].to_i }
65
+ end
62
66
  end
63
67
  end
64
68
 
@@ -74,13 +78,14 @@ class FrameNet::Frame
74
78
 
75
79
  ### Create a new Frame with the specified +id+, +name+, and +modification_date+.
76
80
  def initialize
77
- @id = nil
78
- @name = nil
79
- @creation_time = Time.now
80
- @definition = nil
81
- @elements = []
82
- @relations = []
83
- @lexical_units = []
81
+ @id = nil
82
+ @name = nil
83
+ @creation_time = Time.now
84
+ @definition = nil
85
+ @elements = []
86
+ @relations = []
87
+ @lexical_units = []
88
+ @core_element_set_ids = []
84
89
 
85
90
  yield( self ) if block_given?
86
91
  end
@@ -120,6 +125,10 @@ class FrameNet::Frame
120
125
  # The "lexical units" associated with the frame, as an Array of FrameNet::LexUnits.
121
126
  attr_accessor :lexical_units
122
127
 
128
+ ##
129
+ # The sets of FE IDs that make up the Frame' FEcoreSets.
130
+ attr_accessor :core_element_set_ids
131
+
123
132
 
124
133
  ### Object equality -- returns +true+ if the receiver repressents the same
125
134
  ### FrameNet frame as +other_frame+.
@@ -161,6 +170,16 @@ class FrameNet::Frame
161
170
  end
162
171
 
163
172
 
173
+ ### Return the Frame's core element sets (FEcoreSets) as an Array of
174
+ ### FrameNet::Frame::Elements.
175
+ def core_element_sets
176
+ elements = self.elements_by_id
177
+ return self.core_element_set_ids.map do |id_set|
178
+ id_set.map {|id| elements[id] }
179
+ end
180
+ end
181
+
182
+
164
183
  #
165
184
  # Relations
166
185
  #
@@ -65,6 +65,26 @@ describe FrameNet::Frame do
65
65
  end
66
66
 
67
67
 
68
+ describe "FE core sets" do
69
+
70
+ it "can return the 'core sets' of frame elements that belong to it" do
71
+ frame = described_class.load( :Travel )
72
+ results = frame.core_element_sets
73
+
74
+ expect( results ).to be_an( Array ).and( all be_an(Array) ) # array of arrays
75
+ expect( results.length ).to eq( 2 )
76
+
77
+ expect( results[0] ).to contain_exactly(
78
+ *frame.elements_by_id.values_at( 9786, 2950, 2948, 2945 )
79
+ )
80
+ expect( results[1] ).to contain_exactly(
81
+ *frame.elements_by_id.values_at( 2952, 2949 )
82
+ )
83
+ end
84
+
85
+ end
86
+
87
+
68
88
  describe "relations" do
69
89
 
70
90
  it "can return its relations as a Hash keyed by type" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-framenet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Granger
metadata.gz.sig CHANGED
Binary file