public void Initialize(JPCommonLabelAccentPhrase head, JPCommonLabelAccentPhrase tail, JPCommonLabelBreathGroup prev, JPCommonLabelBreathGroup next) { this.head = head; this.tail = tail; this.prev = prev; this.next = next; }
private int count_accent_phrase_in_utterance(JPCommonLabelAccentPhrase a) { int i; JPCommonLabelAccentPhrase index; for (i = 0, index = a.next; index != null; index = index.next) { i++; } return(index_accent_phrase_in_utterance(a) + i); }
private int index_accent_phrase_in_utterance(JPCommonLabelAccentPhrase a) { int i; JPCommonLabelAccentPhrase index; for (i = 0, index = a; index != null; index = index.prev) { i++; } return(i); }
public void Initialize() { this.short_pause_flag = 0; this.breath_head = null; this.breath_tail = null; this.accent_head = null; this.accent_tail = null; this.word_head = null; this.word_tail = null; this.mora_head = null; this.mora_tail = null; this.phoneme_head = null; this.phoneme_tail = null; }
private int count_accent_phrase_in_breath_group(JPCommonLabelAccentPhrase a) { int i; JPCommonLabelAccentPhrase index; for (i = 0, index = a.up.head; index != null; index = index.next) { i++; if (index == a.up.tail) { break; } } return(i); }
public void Initialize(int acc, string emotion, JPCommonLabelWord head, JPCommonLabelWord tail, JPCommonLabelAccentPhrase prev, JPCommonLabelAccentPhrase next, JPCommonLabelBreathGroup up) { this.accent = acc; if (emotion != null) { this.emotion = emotion; } else { this.emotion = null; } this.head = head; this.tail = tail; this.prev = prev; this.next = next; this.up = up; }
public void Push(string pron, string pos, string ctype, string cform, int acc, int chain_flag) { int i; int find; int is_first_word = 1; if (pron == JPCOMMON_MORA_SHORT_PAUSE) { this.short_pause_flag = 1; return; } // set emotion flag if (pron == JPCOMMON_MORA_QUESTION) { if (this.phoneme_tail != null) { if (this.phoneme_tail.phoneme == JPCOMMON_PHONEME_SHORT_PAUSE) { if (this.phoneme_tail.prev.up.up.up.emotion == null) { this.phoneme_tail.prev.up.up.up.emotion = JPCOMMON_FLAG_QUESTION; } } else { if (this.phoneme_tail.up.up.up.emotion == null) { this.phoneme_tail.up.up.up.emotion = JPCOMMON_FLAG_QUESTION; } } } else { Debug.LogError("WARNING: JPCommonLabel_push_word() in jpcommon_label.c: First mora should not be question flag."); } this.short_pause_flag = 1; return; } // analysis pron int pron_o = 0; while (pron_o < pron.Length) { find = StrTopCmp(pron, pron_o, JPCOMMON_MORA_LONG_VOWEL); if (find != -1) { // for long vowel if (this.phoneme_tail != null && this.short_pause_flag == 0) { this.InsertPause(); this.phoneme_tail.next = new JPCommonLabelPhoneme(); this.mora_tail.next = new JPCommonLabelMora(); this.phoneme_tail.next.Initialize(this.phoneme_tail.phoneme, this.phoneme_tail, null, this.mora_tail.next); this.mora_tail.next.Initialize(JPCOMMON_MORA_LONG_VOWEL, this.phoneme_tail.next, this.phoneme_tail.next, this.mora_tail, null, this.mora_tail.up); this.phoneme_tail = this.phoneme_tail.next; this.mora_tail = this.mora_tail.next; this.word_tail.tail = this.mora_tail; } else { Debug.LogError("WARNING: JPCommonLabel_push_word() in jpcommon_label.c: First mora should not be long vowel symbol."); } pron_o += find; } else { find = StrTopCmp(pron, pron_o, JPCOMMON_MORA_UNVOICE); if (find != -1) { // for unvoice if (this.phoneme_tail != null && is_first_word != 1) { this.phoneme_tail.ConvertUnvoice(); } else { Debug.LogError("WARNING: JPCommonLabel_push_word() in jpcommon_label.c: First mora should not be unvoice flag."); } pron_o += find; } else { // for normal word for (i = 0; jpcommon_mora_list[i] != null; i += 3) { find = StrTopCmp(pron, pron_o, jpcommon_mora_list[i]); if (find != -1) { break; } } if (find != -1) { if (this.phoneme_tail == null) { this.InsertPause(); this.phoneme_tail = new JPCommonLabelPhoneme(); this.mora_tail = new JPCommonLabelMora(); this.word_tail = new JPCommonLabelWord(); this.phoneme_tail.Initialize(jpcommon_mora_list[i + 1], null, null, this.mora_tail); this.mora_tail.Initialize(jpcommon_mora_list[i], this.phoneme_tail, this.phoneme_tail, null, null, this.word_tail); this.word_tail.Initialize(pron, pos, ctype, cform, this.mora_tail, this.mora_tail, null, null); this.phoneme_head = this.phoneme_tail; this.mora_head = this.mora_tail; this.word_head = this.word_tail; is_first_word = 0; } else { if (is_first_word == 1) { this.InsertPause(); this.phoneme_tail.next = new JPCommonLabelPhoneme(); this.mora_tail.next = new JPCommonLabelMora(); this.word_tail.next = new JPCommonLabelWord(); this.phoneme_tail.next.Initialize(jpcommon_mora_list[i + 1], this.phoneme_tail, null, this.mora_tail.next); this.mora_tail.next.Initialize(jpcommon_mora_list[i], this.phoneme_tail.next, this.phoneme_tail.next, this.mora_tail, null, this.word_tail.next); this.word_tail.next.Initialize(pron, pos, ctype, cform, this.mora_tail.next, this.mora_tail.next, this.word_tail, null); this.phoneme_tail = this.phoneme_tail.next; this.mora_tail = this.mora_tail.next; this.word_tail = this.word_tail.next; is_first_word = 0; } else { this.InsertPause(); this.phoneme_tail.next = new JPCommonLabelPhoneme(); this.mora_tail.next = new JPCommonLabelMora(); this.phoneme_tail.next.Initialize(jpcommon_mora_list[i + 1], this.phoneme_tail, null, this.mora_tail.next); this.mora_tail.next.Initialize(jpcommon_mora_list[i], this.phoneme_tail.next, this.phoneme_tail.next, this.mora_tail, null, this.mora_tail.up); this.phoneme_tail = this.phoneme_tail.next; this.mora_tail = this.mora_tail.next; this.word_tail.tail = this.mora_tail; } } if (jpcommon_mora_list[i + 2] != null) { this.InsertPause(); this.phoneme_tail.next = new JPCommonLabelPhoneme(); this.phoneme_tail.next.Initialize(jpcommon_mora_list[i + 2], this.phoneme_tail, null, this.mora_tail); this.phoneme_tail = this.phoneme_tail.next; this.mora_tail.tail = this.phoneme_tail; } pron_o += find; } else { Debug.LogError("WARNING: JPCommonLabel_push_word() in jpcommon_label.c: " + pron + " is wrong mora list."); break; } } } } // check if (is_first_word == 1) { return; } if (this.phoneme_tail == null) { return; } if (this.phoneme_tail.phoneme == JPCOMMON_PHONEME_SHORT_PAUSE) { return; } // make accent, phrase if (this.word_head == this.word_tail) { // first word this.accent_tail = new JPCommonLabelAccentPhrase(); this.breath_tail = new JPCommonLabelBreathGroup(); this.word_tail.up = this.accent_tail; this.accent_tail.Initialize(acc, null, this.word_tail, this.word_tail, null, null, this.breath_tail); this.breath_tail.Initialize(this.accent_tail, this.accent_tail, null, null); this.accent_head = this.accent_tail; this.breath_head = this.breath_tail; } else if (chain_flag == 1) { // common accent phrase and common phrase this.word_tail.up = this.accent_tail; this.accent_tail.tail = this.word_tail; } else { if (this.word_tail.prev.tail.tail.next.phoneme != JPCOMMON_PHONEME_SHORT_PAUSE) { // different accent phrase && common phrase this.accent_tail.next = new JPCommonLabelAccentPhrase(); this.word_tail.up = this.accent_tail.next; this.accent_tail.next.Initialize(acc, null, this.word_tail, this.word_tail, this.accent_tail, null, this.breath_tail); this.breath_tail.tail = this.accent_tail.next; this.accent_tail = this.accent_tail.next; } else { // different accent phrase && different phrase this.accent_tail.next = new JPCommonLabelAccentPhrase(); this.breath_tail.next = new JPCommonLabelBreathGroup(); this.word_tail.up = this.accent_tail.next; this.accent_tail.next.Initialize(acc, null, this.word_tail, this.word_tail, this.accent_tail, null, this.breath_tail.next); this.breath_tail.next.Initialize(this.accent_tail.next, this.accent_tail.next, this.breath_tail, null); this.accent_tail = this.accent_tail.next; this.breath_tail = this.breath_tail.next; } } }