Class: WenlinDbScanner::DictEntry
- Inherits:
-
Struct
- Object
- Struct
- WenlinDbScanner::DictEntry
- Defined in:
- lib/wenlin_db_scanner/dict.rb
Overview
Wraps a record in a dictionary database
Instance Attribute Summary collapse
-
#abbreviates ⇒ String
The term that this term is an abbreviation for.
-
#construction ⇒ String
A grammatical construction that the term can be used in; the associated definition, examples, etc.
-
#defn ⇒ String
The term’s definition, in English or pinyin.
-
#example ⇒ String
Text that shows how the term is used.
-
#example_translation ⇒ String
Translation of the example usage text; if the text is in English, the translation uses pinyin.
-
#example_zh ⇒ String
The example usage text, in simplified hanzi.
-
#extend ⇒ String
Method for extending the term with a suffix to obtain a related meaning.
-
#extend_serial ⇒ String
The serial of the term obtained by extending this term with a suffix.
-
#extended_from ⇒ String
The term that this term was derived from.
-
#extended_from_serial ⇒ String
The serial of the term that this term was derived from.
-
#field ⇒ String
The term’s field of reference, abbreviated in English.
-
#field_zh ⇒ String
The term’s field of relevance, in simplified hanzi.
-
#freq ⇒ String
Floating-point number indicating the term’s popularity; lower strings, such as “1” are associated with more popular terms; unpopular terms don’t have this property set.
-
#grade ⇒ String
The level at which this term is taught; ‘A’ to ‘E’.
-
#help_text ⇒ String
readonly
Might be used in the dictionary app’s help.
-
#inflection ⇒ String
Instructions on how to inflect an English word; not yet parsed, but in the future it should be an array of String words.
-
#ipa ⇒ String
Pronunciation for English terms, in IPA.
-
#key ⇒ String
The term’s sort key in the dictionary.
-
#latin_frequency_boost ⇒ Boolean
If true, the term is the most frequent among all terms with the same Latin alphabet spelling; useful for ordering suggestions when the user is typing raw Latin characters; use the latin_term property to get a term’s LAtin spelling.
-
#latin_term ⇒ String
The defined term, spelled using Latin characters.
-
#linked_serials ⇒ String
Serials for terms that have the same spelling in some system and are closely related.
-
#linked_terms ⇒ String
Terms that have the same spelling in some system and and are closely related.
-
#measure_word ⇒ String+
The key of the measure word than should be used with this noun; might be an array of dictionary keys instead.
-
#note ⇒ Object
Returns the value of attribute note.
-
#reference ⇒ String
Code that indicates where the definition was obtained from; might be useful to researchers.
-
#see_serial ⇒ String
The serial of the term that this term should be considered to be identical with.
-
#see_term ⇒ String
A term that is closely related to this term; unlike see_serial, this is rendered as a “See also ” link.
-
#serial ⇒ String
Uniquely identifies a definition in the dictionary.
-
#speech_part ⇒ String
Abbreviation of the term’s part of speech; cross reference this in the appropraite parts-of-speech database.
-
#term ⇒ String
The defined term.
-
#term_frequency ⇒ String
The definition rank among all terms that are spelled the same; for Chinese terms, the spelling is pinyin; the most frequent term has rank 1.
-
#unverified ⇒ Boolean
Set on some auto-generated entries in en->zh.
-
#usage ⇒ String
Short clarification about how the term is used.
-
#used_in_serials ⇒ String
Serials for terms that contain this term.
-
#used_in_terms ⇒ String
Terms that contain this term.
-
#years ⇒ Object
Returns the value of attribute years.
-
#zh ⇒ String
The defined term, in simplified Hanzi.
-
#zh_tw ⇒ String
The defined term, in complex Hanzi.
Instance Method Summary collapse
Instance Attribute Details
#abbreviates ⇒ String
Returns the term that this term is an abbreviation for.
262 263 264 |
# File 'lib/wenlin_db_scanner/dict.rb', line 262 def abbreviates @abbreviates end |
#construction ⇒ String
Returns a grammatical construction that the term can be used in; the associated definition, examples, etc. all apply to the term’s use in the construction.
262 263 264 |
# File 'lib/wenlin_db_scanner/dict.rb', line 262 def construction @construction end |
#defn ⇒ String
Returns the term’s definition, in English or pinyin.
262 263 264 |
# File 'lib/wenlin_db_scanner/dict.rb', line 262 def defn @defn end |
#example ⇒ String
Returns text that shows how the term is used.
262 263 264 |
# File 'lib/wenlin_db_scanner/dict.rb', line 262 def example @example end |
#example_translation ⇒ String
Returns translation of the example usage text; if the text is in English, the translation uses pinyin.
262 263 264 |
# File 'lib/wenlin_db_scanner/dict.rb', line 262 def example_translation @example_translation end |
#example_zh ⇒ String
Returns the example usage text, in simplified hanzi.
262 263 264 |
# File 'lib/wenlin_db_scanner/dict.rb', line 262 def example_zh @example_zh end |
#extend ⇒ String
Returns method for extending the term with a suffix to obtain a related meaning.
262 263 264 |
# File 'lib/wenlin_db_scanner/dict.rb', line 262 def extend @extend end |
#extend_serial ⇒ String
Returns the serial of the term obtained by extending this term with a suffix.
262 263 264 |
# File 'lib/wenlin_db_scanner/dict.rb', line 262 def extend_serial @extend_serial end |
#extended_from ⇒ String
Returns the term that this term was derived from.
262 263 264 |
# File 'lib/wenlin_db_scanner/dict.rb', line 262 def extended_from @extended_from end |
#extended_from_serial ⇒ String
Returns the serial of the term that this term was derived from.
262 263 264 |
# File 'lib/wenlin_db_scanner/dict.rb', line 262 def extended_from_serial @extended_from_serial end |
#field ⇒ String
Returns the term’s field of reference, abbreviated in English.
262 263 264 |
# File 'lib/wenlin_db_scanner/dict.rb', line 262 def field @field end |
#field_zh ⇒ String
Returns the term’s field of relevance, in simplified hanzi.
262 263 264 |
# File 'lib/wenlin_db_scanner/dict.rb', line 262 def field_zh @field_zh end |
#freq ⇒ String
Returns floating-point number indicating the term’s popularity; lower strings, such as “1” are associated with more popular terms; unpopular terms don’t have this property set.
262 263 264 |
# File 'lib/wenlin_db_scanner/dict.rb', line 262 def freq @freq end |
#grade ⇒ String
Returns the level at which this term is taught; ‘A’ to ‘E’.
262 263 264 |
# File 'lib/wenlin_db_scanner/dict.rb', line 262 def grade @grade end |
#help_text ⇒ String (readonly)
Returns might be used in the dictionary app’s help.
368 369 370 |
# File 'lib/wenlin_db_scanner/dict.rb', line 368 def to_hash Hash[each_pair.reject { |k, v| v.nil? }.to_a] end |
#inflection ⇒ String
Returns instructions on how to inflect an English word; not yet parsed, but in the future it should be an array of String words.
262 263 264 |
# File 'lib/wenlin_db_scanner/dict.rb', line 262 def inflection @inflection end |
#ipa ⇒ String
Returns pronunciation for English terms, in IPA.
262 263 264 |
# File 'lib/wenlin_db_scanner/dict.rb', line 262 def ipa @ipa end |
#key ⇒ String
Returns the term’s sort key in the dictionary.
262 263 264 |
# File 'lib/wenlin_db_scanner/dict.rb', line 262 def key @key end |
#latin_frequency_boost ⇒ Boolean
Returns if true, the term is the most frequent among all terms with the same Latin alphabet spelling; useful for ordering suggestions when the user is typing raw Latin characters; use the latin_term property to get a term’s LAtin spelling.
262 263 264 |
# File 'lib/wenlin_db_scanner/dict.rb', line 262 def latin_frequency_boost @latin_frequency_boost end |
#latin_term ⇒ String
Returns the defined term, spelled using Latin characters.
262 263 264 |
# File 'lib/wenlin_db_scanner/dict.rb', line 262 def latin_term @latin_term end |
#linked_serials ⇒ String
Returns serials for terms that have the same spelling in some system and are closely related.
262 263 264 |
# File 'lib/wenlin_db_scanner/dict.rb', line 262 def linked_serials @linked_serials end |
#linked_terms ⇒ String
Returns terms that have the same spelling in some system and and are closely related.
262 263 264 |
# File 'lib/wenlin_db_scanner/dict.rb', line 262 def linked_terms @linked_terms end |
#measure_word ⇒ String+
Returns the key of the measure word than should be used with this noun; might be an array of dictionary keys instead.
262 263 264 |
# File 'lib/wenlin_db_scanner/dict.rb', line 262 def measure_word @measure_word end |
#note ⇒ Object
Returns the value of attribute note
262 263 264 |
# File 'lib/wenlin_db_scanner/dict.rb', line 262 def note @note end |
#reference ⇒ String
Returns code that indicates where the definition was obtained from; might be useful to researchers.
262 263 264 |
# File 'lib/wenlin_db_scanner/dict.rb', line 262 def reference @reference end |
#see_serial ⇒ String
Returns the serial of the term that this term should be considered to be identical with.
262 263 264 |
# File 'lib/wenlin_db_scanner/dict.rb', line 262 def see_serial @see_serial end |
#see_term ⇒ String
Returns a term that is closely related to this term; unlike see_serial, this is rendered as a “See also ” link.
262 263 264 |
# File 'lib/wenlin_db_scanner/dict.rb', line 262 def see_term @see_term end |
#serial ⇒ String
Returns uniquely identifies a definition in the dictionary.
262 263 264 |
# File 'lib/wenlin_db_scanner/dict.rb', line 262 def serial @serial end |
#speech_part ⇒ String
Returns abbreviation of the term’s part of speech; cross reference this in the appropraite parts-of-speech database.
262 263 264 |
# File 'lib/wenlin_db_scanner/dict.rb', line 262 def speech_part @speech_part end |
#term ⇒ String
Returns the defined term.
262 263 264 |
# File 'lib/wenlin_db_scanner/dict.rb', line 262 def term @term end |
#term_frequency ⇒ String
Returns the definition rank among all terms that are spelled the same; for Chinese terms, the spelling is pinyin; the most frequent term has rank 1.
262 263 264 |
# File 'lib/wenlin_db_scanner/dict.rb', line 262 def term_frequency @term_frequency end |
#unverified ⇒ Boolean
Returns set on some auto-generated entries in en->zh.
262 263 264 |
# File 'lib/wenlin_db_scanner/dict.rb', line 262 def unverified @unverified end |
#usage ⇒ String
Returns short clarification about how the term is used.
262 263 264 |
# File 'lib/wenlin_db_scanner/dict.rb', line 262 def usage @usage end |
#used_in_serials ⇒ String
Returns serials for terms that contain this term.
262 263 264 |
# File 'lib/wenlin_db_scanner/dict.rb', line 262 def used_in_serials @used_in_serials end |
#used_in_terms ⇒ String
Returns terms that contain this term.
262 263 264 |
# File 'lib/wenlin_db_scanner/dict.rb', line 262 def used_in_terms @used_in_terms end |
#years ⇒ Object
Returns the value of attribute years
262 263 264 |
# File 'lib/wenlin_db_scanner/dict.rb', line 262 def years @years end |
#zh ⇒ String
Returns the defined term, in simplified Hanzi.
262 263 264 |
# File 'lib/wenlin_db_scanner/dict.rb', line 262 def zh @zh end |
#zh_tw ⇒ String
Returns the defined term, in complex Hanzi.
262 263 264 |
# File 'lib/wenlin_db_scanner/dict.rb', line 262 def zh_tw @zh_tw end |
Instance Method Details
#to_hash ⇒ Hash
368 369 370 |
# File 'lib/wenlin_db_scanner/dict.rb', line 368 def to_hash Hash[each_pair.reject { |k, v| v.nil? }.to_a] end |