Class: Daidai::Form
- Inherits:
-
Struct
- Object
- Struct
- Daidai::Form
- Defined in:
- lib/daidai/word.rb
Overview
A single conjugated form. ‘kanji` and `reading` hold the inflected surface and its kana; either may be nil (a kana-only word has no `kanji`, and the `reading` is only filled in when one was supplied). `onum` distinguishes equally-valid variants of the same form (e.g. ~なくて vs ~ないで).
Instance Attribute Summary collapse
-
#kanji ⇒ Object
Returns the value of attribute kanji.
-
#name ⇒ Object
Returns the value of attribute name.
-
#negative ⇒ Object
Returns the value of attribute negative.
-
#onum ⇒ Object
Returns the value of attribute onum.
-
#polite ⇒ Object
Returns the value of attribute polite.
-
#reading ⇒ Object
Returns the value of attribute reading.
Instance Method Summary collapse
- #inspect ⇒ Object
-
#label ⇒ Object
Human label for this form (“Past”, “Te-form”, …).
- #negative? ⇒ Boolean
- #polite? ⇒ Boolean
-
#primary? ⇒ Boolean
The primary (most standard) variant for its form/polarity/formality; see Word#variants for the alternatives (e.g. ~なくて beside ~ないで).
-
#to_s ⇒ Object
(also: #text)
The text to show: the kanji writing if there is one, otherwise the kana.
Instance Attribute Details
#kanji ⇒ Object
Returns the value of attribute kanji
29 30 31 |
# File 'lib/daidai/word.rb', line 29 def kanji @kanji end |
#name ⇒ Object
Returns the value of attribute name
29 30 31 |
# File 'lib/daidai/word.rb', line 29 def name @name end |
#negative ⇒ Object
Returns the value of attribute negative
29 30 31 |
# File 'lib/daidai/word.rb', line 29 def negative @negative end |
#onum ⇒ Object
Returns the value of attribute onum
29 30 31 |
# File 'lib/daidai/word.rb', line 29 def onum @onum end |
#polite ⇒ Object
Returns the value of attribute polite
29 30 31 |
# File 'lib/daidai/word.rb', line 29 def polite @polite end |
#reading ⇒ Object
Returns the value of attribute reading
29 30 31 |
# File 'lib/daidai/word.rb', line 29 def reading @reading end |
Instance Method Details
#inspect ⇒ Object
44 |
# File 'lib/daidai/word.rb', line 44 def inspect = "#<Daidai::Form #{name}#{" negative" if negative}#{" polite" if polite}: #{self}>" |
#label ⇒ Object
Human label for this form (“Past”, “Te-form”, …).
38 |
# File 'lib/daidai/word.rb', line 38 def label = FORMS[name] |
#negative? ⇒ Boolean
30 |
# File 'lib/daidai/word.rb', line 30 def negative? = negative |
#polite? ⇒ Boolean
31 |
# File 'lib/daidai/word.rb', line 31 def polite? = polite |
#primary? ⇒ Boolean
The primary (most standard) variant for its form/polarity/formality; see Word#variants for the alternatives (e.g. ~なくて beside ~ないで).
35 |
# File 'lib/daidai/word.rb', line 35 def primary? = onum == 1 |
#to_s ⇒ Object Also known as: text
The text to show: the kanji writing if there is one, otherwise the kana.
41 |
# File 'lib/daidai/word.rb', line 41 def to_s = (kanji || reading).to_s |