Class ToneNumber
java.lang.Object
ca.phon.ipa.IPAElement
ca.phon.ipa.ToneNumber
- All Implemented Interfaces:
IExtendable
,Visitable<IPAElement>
Represents a tone number in an IPA transcription.
Tone numbers are represented as superscript numbers
from 0 to 9 at the end of a syllable. A tone melody
is a sequence of tone numbers.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionToneNumber
(char[] toneChars) ToneNumber
(char[] toneChars, FeatureSet overrideFeatureSet, SyllableInfo syllableInfo) ToneNumber
(int number) -
Method Summary
Modifier and TypeMethodDescriptionprotected FeatureSet
Private method to return the feature set for theIPAElement
.int
asInt()
Get tone number as integer value.static char[]
fromNumber
(int number) Get tone number character from integer value.static ToneNumber
fromString
(String toneStr) Return a ToneNumber from a string of digits.getText()
Get the text for this phoneboolean
Check if this tone number represents an ambiguous tone error.boolean
isMelody()
Check if this tone number is a melody (i.e.int
length()
Get the length of the tone number character array.char[]
Get the tone number characters.Methods inherited from class ca.phon.ipa.IPAElement
accept, constituentType, featureSet, getExtension, getExtensions, isDiphthong, overrideFeatureSet, putExtension, removeExtension, segregated, sonority, sonorityDistance, stress, syllableIndex, syllableInfo, tone, toString
-
Field Details
-
TONE_NUMBER_AMBIGUOUS
- See Also:
-
-
Constructor Details
-
ToneNumber
public ToneNumber(int number) -
ToneNumber
public ToneNumber(char[] toneChars) -
ToneNumber
-
-
Method Details
-
fromNumber
public static char[] fromNumber(int number) Get tone number character from integer value. Valid values are 0 to 9.- Parameters:
number
- the tone number- Returns:
- the corresponding superscript character
-
fromString
Return a ToneNumber from a string of digits. The string may be composed of superscript or normal digits. Anything that is not a digit is ignored. If no digits are found, or '-1', an error tone number is returned.- Parameters:
toneStr
- the tone number string- Returns:
- the corresponding ToneNumber
-
toneChars
public char[] toneChars()Get the tone number characters.- Returns:
- the tone number characters
-
length
public int length()Get the length of the tone number character array.- Returns:
- the length of the tone number character array
-
isMelody
public boolean isMelody()Check if this tone number is a melody (i.e. has more than one tone number).- Returns:
- true if this is a melody, false otherwise
-
isAmbiguous
public boolean isAmbiguous()Check if this tone number represents an ambiguous tone error. An error tone number is represented by two combining superscript x characters: ˣˣ- Returns:
- true if this is an ambiguous tone number, false otherwise
-
_getFeatureSet
Description copied from class:IPAElement
Private method to return the feature set for theIPAElement
.- Specified by:
_getFeatureSet
in classIPAElement
- Returns:
- the feature set for the implementing type.
-
getText
Description copied from class:IPAElement
Get the text for this phone- Specified by:
getText
in classIPAElement
- Returns:
- the phone string
-
asInt
public int asInt()Get tone number as integer value. If the tone number is a sequence of digits, the integer value is the concatenation of the digits. If the tone number is an error, -1 is returned.- Returns:
- the tone number as an integer
-