module SSMD::Processors::ProsodyProcessor::Regex

Public Instance Methods

content(name = nil) click to toggle source

Matches either a single char or a longer string starting and ending with a non-whitespace char.

# File lib/ssmd/processors/prosody_processor.rb, line 109
def content(name = nil)
  id = name ? "?<#{name}>" : ""
  /(#{id}(?:[^\s])|(?:[^\s].*[^\s]))/
end
fast_rate() click to toggle source

Match example: >>extra fast>> or >fast>

# File lib/ssmd/processors/prosody_processor.rb, line 90
def fast_rate
  /(?:#{ws_start}&gt;&gt;#{content('x-fast')}&gt;&gt;#{ws_end})|(?:#{ws_start}&gt;#{content('fast')}&gt;#{ws_end})/
end
high_pitch() click to toggle source

Match example: ^^extra high^^ or ^high^

# File lib/ssmd/processors/prosody_processor.rb, line 102
def high_pitch
  /(?:#{ws_start}\^\^#{content('x-high')}\^\^#{ws_end})|(?:#{ws_start}\^#{content('high')}\^#{ws_end})/
end
loud_volume() click to toggle source

Match example: ++extra loud or loud

# File lib/ssmd/processors/prosody_processor.rb, line 78
def loud_volume
  /(?:#{ws_start}\+\+#{content('x-loud')}\+\+#{ws_end})|(?:#{ws_start}\+#{content('loud')}\+#{ws_end})/
end
low_pitch() click to toggle source

Match example: __extra low__ or low

# File lib/ssmd/processors/prosody_processor.rb, line 96
def low_pitch
  /(?:#{ws_start}__#{content('x-low')}__#{ws_end})|(?:#{ws_start}_#{content('low')}_#{ws_end})/
end
prosody() click to toggle source
# File lib/ssmd/processors/prosody_processor.rb, line 52
def prosody
  %r{
    (?:#{slow_rate}) |
    (?:#{fast_rate}) |
    (?:#{silent_volume}) |
    (?:#{soft_volume}) |
    (?:#{loud_volume}) |
    (?:#{low_pitch}) |
    (?:#{high_pitch})
  }x
end
silent_volume() click to toggle source

Match example: ~silent~

# File lib/ssmd/processors/prosody_processor.rb, line 66
def silent_volume
  /#{ws_start}~#{content('silent')}~#{ws_end}/
end
slow_rate() click to toggle source

Match example: <<extra slow<< or <slow<

# File lib/ssmd/processors/prosody_processor.rb, line 84
def slow_rate
  /(?:#{ws_start}&lt;&lt;#{content('x-slow')}&lt;&lt;#{ws_end})|(?:#{ws_start}&lt;#{content('slow')}&lt;#{ws_end})/
end
soft_volume() click to toggle source

Match example: –extra soft– or -soft-

# File lib/ssmd/processors/prosody_processor.rb, line 72
def soft_volume
  /(?:#{ws_start}--#{content('x-soft')}--#{ws_end})|(?:#{ws_start}-#{content('soft')}-#{ws_end})/
end
ws_end() click to toggle source

Matches the end of the input or a whitespace char via lookahead, meaning it's excluded from the match result.

# File lib/ssmd/processors/prosody_processor.rb, line 124
def ws_end
  /(?=(\Z)|(?:\s))/
end
ws_start() click to toggle source

Matches the beginning of the input or a whitespace char via lookbehind, meaning it's excluded from the match result.

# File lib/ssmd/processors/prosody_processor.rb, line 117
def ws_start
  /(?<=(\A)|(?:\s))/
end