Class: PROIEL::Dictionary
- Inherits:
-
TreebankObject
- Object
- TreebankObject
- PROIEL::Dictionary
- Defined in:
- lib/proiel/dictionary.rb
Instance Attribute Summary collapse
-
#dialect ⇒ String
readonly
Dialect of the source.
-
#export_time ⇒ DateTime
readonly
Export time for the dictionary.
-
#language ⇒ String
readonly
Language of the source as an ISO 639-3 language tag.
-
#lemmata ⇒ Hash
readonly
All lemmata in the dictionary.
-
#n ⇒ Integer
readonly
Number of lemmata in the dictionary.
-
#sources ⇒ Hash
readonly
All sources in the dictionary.
-
#treebank ⇒ Treebank
readonly
Treebank that this source belongs to.
Instance Method Summary collapse
-
#id ⇒ Object
FIXME.
-
#initialize(parent, export_time, language, dialect, xml = nil) ⇒ Dictionary
constructor
Creates a new dictionary object.
Methods inherited from TreebankObject
Constructor Details
#initialize(parent, export_time, language, dialect, xml = nil) ⇒ Dictionary
Creates a new dictionary object.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/proiel/dictionary.rb', line 30 def initialize(parent, export_time, language, dialect, xml = nil) @treebank = parent raise ArgumentError, 'string or nil expected' unless export_time.nil? or export_time.is_a?(String) @export_time = export_time.nil? ? nil : DateTime.parse(export_time).freeze @language = language.freeze @dialect = dialect ? dialect.freeze : nil @lemmata = {} @sources = {} @n = 0 from_xml(xml) if xml end |
Instance Attribute Details
#dialect ⇒ String (readonly)
Returns dialect of the source.
15 16 17 |
# File 'lib/proiel/dictionary.rb', line 15 def dialect @dialect end |
#export_time ⇒ DateTime (readonly)
Returns export time for the dictionary.
18 19 20 |
# File 'lib/proiel/dictionary.rb', line 18 def export_time @export_time end |
#language ⇒ String (readonly)
Returns language of the source as an ISO 639-3 language tag.
12 13 14 |
# File 'lib/proiel/dictionary.rb', line 12 def language @language end |
#lemmata ⇒ Hash (readonly)
Returns all lemmata in the dictionary.
21 22 23 |
# File 'lib/proiel/dictionary.rb', line 21 def lemmata @lemmata end |
#n ⇒ Integer (readonly)
Returns number of lemmata in the dictionary.
24 25 26 |
# File 'lib/proiel/dictionary.rb', line 24 def n @n end |
#sources ⇒ Hash (readonly)
Returns all sources in the dictionary.
27 28 29 |
# File 'lib/proiel/dictionary.rb', line 27 def sources @sources end |
#treebank ⇒ Treebank (readonly)
Returns treebank that this source belongs to.
9 10 11 |
# File 'lib/proiel/dictionary.rb', line 9 def treebank @treebank end |
Instance Method Details
#id ⇒ Object
FIXME
47 48 49 |
# File 'lib/proiel/dictionary.rb', line 47 def id @language end |