Class: WenlinDbScanner::DictEntry

Inherits:
Struct
  • Object
show all
Defined in:
lib/wenlin_db_scanner/dict.rb

Overview

Wraps a record in a dictionary database

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#abbreviatesString

Returns the term that this term is an abbreviation for.

Returns:

  • (String)

    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

#constructionString

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.

Returns:

  • (String)

    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

#defnString

Returns the term’s definition, in English or pinyin.

Returns:

  • (String)

    the term’s definition, in English or pinyin



262
263
264
# File 'lib/wenlin_db_scanner/dict.rb', line 262

def defn
  @defn
end

#exampleString

Returns text that shows how the term is used.

Returns:

  • (String)

    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_translationString

Returns translation of the example usage text; if the text is in English, the translation uses pinyin.

Returns:

  • (String)

    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_zhString

Returns the example usage text, in simplified hanzi.

Returns:

  • (String)

    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

#extendString

Returns method for extending the term with a suffix to obtain a related meaning.

Returns:

  • (String)

    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_serialString

Returns the serial of the term obtained by extending this term with a suffix.

Returns:

  • (String)

    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_fromString

Returns the term that this term was derived from.

Returns:

  • (String)

    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_serialString

Returns the serial of the term that this term was derived from.

Returns:

  • (String)

    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

#fieldString

Returns the term’s field of reference, abbreviated in English.

Returns:

  • (String)

    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_zhString

Returns the term’s field of relevance, in simplified hanzi.

Returns:

  • (String)

    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

#freqString

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.

Returns:

  • (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



262
263
264
# File 'lib/wenlin_db_scanner/dict.rb', line 262

def freq
  @freq
end

#gradeString

Returns the level at which this term is taught; ‘A’ to ‘E’.

Returns:

  • (String)

    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_textString (readonly)

Returns might be used in the dictionary app’s help.

Returns:

  • (String)

    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

#inflectionString

Returns instructions on how to inflect an English word; not yet parsed, but in the future it should be an array of String words.

Returns:

  • (String)

    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

#ipaString

Returns pronunciation for English terms, in IPA.

Returns:

  • (String)

    pronunciation for English terms, in IPA



262
263
264
# File 'lib/wenlin_db_scanner/dict.rb', line 262

def ipa
  @ipa
end

#keyString

Returns the term’s sort key in the dictionary.

Returns:

  • (String)

    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_boostBoolean

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.

Returns:

  • (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



262
263
264
# File 'lib/wenlin_db_scanner/dict.rb', line 262

def latin_frequency_boost
  @latin_frequency_boost
end

#latin_termString

Returns the defined term, spelled using Latin characters.

Returns:

  • (String)

    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_serialsString

Returns serials for terms that have the same spelling in some system and are closely related.

Returns:

  • (String)

    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_termsString

Returns terms that have the same spelling in some system and and are closely related.

Returns:

  • (String)

    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_wordString+

Returns the key of the measure word than should be used with this noun; might be an array of dictionary keys instead.

Returns:

  • (String, Array<String>)

    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

#noteObject

Returns the value of attribute note

Returns:

  • (Object)

    the current value of note



262
263
264
# File 'lib/wenlin_db_scanner/dict.rb', line 262

def note
  @note
end

#referenceString

Returns code that indicates where the definition was obtained from; might be useful to researchers.

Returns:

  • (String)

    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_serialString

Returns the serial of the term that this term should be considered to be identical with.

Returns:

  • (String)

    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_termString

Returns a term that is closely related to this term; unlike see_serial, this is rendered as a “See also ” link.

Returns:

  • (String)

    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

#serialString

Returns uniquely identifies a definition in the dictionary.

Returns:

  • (String)

    uniquely identifies a definition in the dictionary



262
263
264
# File 'lib/wenlin_db_scanner/dict.rb', line 262

def serial
  @serial
end

#speech_partString

Returns abbreviation of the term’s part of speech; cross reference this in the appropraite parts-of-speech database.

Returns:

  • (String)

    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

#termString

Returns the defined term.

Returns:

  • (String)

    the defined term



262
263
264
# File 'lib/wenlin_db_scanner/dict.rb', line 262

def term
  @term
end

#term_frequencyString

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.

Returns:

  • (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



262
263
264
# File 'lib/wenlin_db_scanner/dict.rb', line 262

def term_frequency
  @term_frequency
end

#unverifiedBoolean

Returns set on some auto-generated entries in en->zh.

Returns:

  • (Boolean)

    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

#usageString

Returns short clarification about how the term is used.

Returns:

  • (String)

    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_serialsString

Returns serials for terms that contain this term.

Returns:

  • (String)

    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_termsString

Returns terms that contain this term.

Returns:

  • (String)

    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

#yearsObject

Returns the value of attribute years

Returns:

  • (Object)

    the current value of years



262
263
264
# File 'lib/wenlin_db_scanner/dict.rb', line 262

def years
  @years
end

#zhString

Returns the defined term, in simplified Hanzi.

Returns:

  • (String)

    the defined term, in simplified Hanzi



262
263
264
# File 'lib/wenlin_db_scanner/dict.rb', line 262

def zh
  @zh
end

#zh_twString

Returns the defined term, in complex Hanzi.

Returns:

  • (String)

    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_hashHash

Returns:

  • (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