Class: Camdict::Sentence

Inherits:
Object
  • Object
show all
Includes:
Common
Defined in:
lib/camdict/sentence.rb

Overview

Parse the html to get the example sentence and its typical usage information associated with this sentence.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(html) ⇒ Sentence

New a sentence object from html containing the eg block.



18
19
20
21
# File 'lib/camdict/sentence.rb', line 18

def initialize(html)
  @usage = get_usage(html)
  @sentence = get_sentence(html)
end

Instance Attribute Details

#sentenceObject (readonly)

Get one sentence inside an example block.



15
16
17
# File 'lib/camdict/sentence.rb', line 15

def sentence
  @sentence
end

#usageObject (readonly)

Get the grammar code or usage in this sentence. It means how the word is used in this sentence. For example, a grammar code for the word - ‘somewhere’ is “+to infinitive”. I’m looking for somewhere to eat.



12
13
14
# File 'lib/camdict/sentence.rb', line 12

def usage
  @usage
end