Class: Voicevox::AccentPhrase
- Inherits:
-
Object
- Object
- Voicevox::AccentPhrase
- Defined in:
- lib/voicevox/wrapper/audio_query.rb
Overview
アクセント句ごとの情報。
Defined Under Namespace
Classes: Mora
Instance Attribute Summary collapse
-
#accent ⇒ Integer
readonly
アクセント箇所。.
-
#is_interrogative ⇒ Boolean
(also: #interrogative?)
readonly
疑問系かどうか。.
-
#moras ⇒ Array<Mora>
readonly
モーラのリスト。.
-
#pause_mora ⇒ Mora?
readonly
後ろに無音を付けるかどうか。.
Instance Method Summary collapse
-
#initialize(query) ⇒ AccentPhrase
constructor
A new instance of AccentPhrase.
-
#to_hash ⇒ Hash
AccentPhraseをHashにします。.
Constructor Details
#initialize(query) ⇒ AccentPhrase
Returns a new instance of AccentPhrase.
149 150 151 152 153 154 |
# File 'lib/voicevox/wrapper/audio_query.rb', line 149 def initialize(query) @moras = query[:moras].map { |ap| Mora.new ap } @accent = query[:accent] @pause_mora = query[:pause_mora] && Mora.new(query[:pause_mora]) @is_interrogative = query[:is_interrogative] end |
Instance Attribute Details
#accent ⇒ Integer (readonly)
Returns アクセント箇所。.
142 143 144 |
# File 'lib/voicevox/wrapper/audio_query.rb', line 142 def accent @accent end |
#is_interrogative ⇒ Boolean (readonly) Also known as: interrogative?
Returns 疑問系かどうか。.
146 147 148 |
# File 'lib/voicevox/wrapper/audio_query.rb', line 146 def is_interrogative @is_interrogative end |
#moras ⇒ Array<Mora> (readonly)
Returns モーラのリスト。.
140 141 142 |
# File 'lib/voicevox/wrapper/audio_query.rb', line 140 def moras @moras end |
#pause_mora ⇒ Mora? (readonly)
Returns 後ろに無音を付けるかどうか。.
144 145 146 |
# File 'lib/voicevox/wrapper/audio_query.rb', line 144 def pause_mora @pause_mora end |
Instance Method Details
#to_hash ⇒ Hash
AccentPhraseをHashにします。
161 162 163 164 165 166 167 168 |
# File 'lib/voicevox/wrapper/audio_query.rb', line 161 def to_hash { moras: @moras.map(&:to_hash), accent: @accent, pause_mora: @pause_mora&.to_hash, is_interrogative: @is_interrogative } end |