Module: Phonology::SoundBase

Included in:
Affricate, Sound
Defined in:
lib/phonology/sound.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#featuresObject

Returns the value of attribute features.



5
6
7
# File 'lib/phonology/sound.rb', line 5

def features
  @features
end

#hintsObject

Orthography hints that can be useful to consult when applying rules.



47
48
49
# File 'lib/phonology/sound.rb', line 47

def hints
  @hints
end

#orthographyObject

Returns the value of attribute orthography.



5
6
7
# File 'lib/phonology/sound.rb', line 5

def orthography
  @orthography
end

#syllableObject

Returns the value of attribute syllable.



5
6
7
# File 'lib/phonology/sound.rb', line 5

def syllable
  @syllable
end

Instance Method Details

#backnessObject

Get the sound’s backness.



95
96
97
# File 'lib/phonology/sound.rb', line 95

def backness
  features.intersection(Features::BACKNESS)
end

#coarticulated?Boolean

Does the sound have more than one place of articulation?

Returns:

  • (Boolean)


75
76
77
# File 'lib/phonology/sound.rb', line 75

def coarticulated?
  place.size > 1
end

#codepointsObject

Raises:

  • (NotImplementedError)


61
62
63
# File 'lib/phonology/sound.rb', line 61

def codepoints
  raise NotImplementedError
end

#exists?Boolean

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


65
66
67
# File 'lib/phonology/sound.rb', line 65

def exists?
  raise NotImplementedError
end

#heightObject

Get the sound’s height.



90
91
92
# File 'lib/phonology/sound.rb', line 90

def height
  features.intersection(Features::HEIGHT)
end

#hint(*args) ⇒ Object

TODO set up list of valid hints



52
53
54
55
# File 'lib/phonology/sound.rb', line 52

def hint(*args)
  self.hints += args.flatten
  self
end

#mannerObject

Get the sound’s manner of articulation.



85
86
87
# File 'lib/phonology/sound.rb', line 85

def manner
  features.intersection(Features::MANNER)
end

#placeObject

Get the sound’s place of articulation.



80
81
82
# File 'lib/phonology/sound.rb', line 80

def place
  features.intersection(Features::PLACE)
end

#place_groupsObject

Get the place groups (:coronal, :dorsal, etc). Normally there should only be one.



100
101
102
# File 'lib/phonology/sound.rb', line 100

def place_groups
  Features.place_groups(features)
end

#sonorityObject



35
36
37
38
39
40
41
42
43
44
# File 'lib/phonology/sound.rb', line 35

def sonority
  case
  when vocalic?     then 5
  when approximant? then 4
  when liquid?      then 3
  when nasal?       then 2
  when fricative?   then 1
  else 0
  end
end

#symbolObject

Get the IPA codepoints for the sound, including any diacritics.



70
71
72
# File 'lib/phonology/sound.rb', line 70

def symbol
  codepoints.pack("U*")
end