Ejemplo n.º 1
0
 public void Initialize(string phoneme, JPCommonLabelPhoneme prev, JPCommonLabelPhoneme next, JPCommonLabelMora up)
 {
     this.phoneme = phoneme;
     this.prev    = prev;
     this.next    = next;
     this.up      = up;
 }
Ejemplo n.º 2
0
 public void Initialize(string mora, JPCommonLabelPhoneme head, JPCommonLabelPhoneme tail, JPCommonLabelMora prev, JPCommonLabelMora next, JPCommonLabelWord up)
 {
     this.mora = mora;
     this.head = head;
     this.tail = tail;
     this.prev = prev;
     this.next = next;
     this.up   = up;
 }
Ejemplo n.º 3
0
        private int count_mora_in_utterance(JPCommonLabelMora m)
        {
            int i;
            JPCommonLabelMora index;

            for (i = 0, index = m.next; index != null; index = index.next)
            {
                i++;
            }
            return(index_mora_in_utterance(m) + i);
        }
Ejemplo n.º 4
0
        private int index_mora_in_utterance(JPCommonLabelMora m)
        {
            int i;
            JPCommonLabelMora index;

            for (i = 0, index = m; index != null; index = index.prev)
            {
                i++;
            }
            return(i);
        }
Ejemplo n.º 5
0
 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;
 }
Ejemplo n.º 6
0
        private int count_mora_in_breath_group(JPCommonLabelMora m)
        {
            int i;
            JPCommonLabelMora index;

            for (i = 0, index = m.up.up.up.head.head.head; index != null; index = index.next)
            {
                i++;
                if (index == m.up.up.up.tail.tail.tail)
                {
                    break;
                }
            }
            return(i);
        }
Ejemplo n.º 7
0
        private int index_mora_in_accent_phrase(JPCommonLabelMora m)
        {
            int i;
            JPCommonLabelMora index;

            for (i = 0, index = m.up.up.head.head; index != null; index = index.next)
            {
                i++;
                if (index == m)
                {
                    break;
                }
            }
            return(i);
        }
Ejemplo n.º 8
0
        public void Initialize(string pron, string pos, string ctype, string cform, JPCommonLabelMora head, JPCommonLabelMora tail, JPCommonLabelWord prev, JPCommonLabelWord next)
        {
            int i, find;

            this.pron = pron;
            for (i = 0, find = 0; jpcommon_pos_list[i] != null; i += 2)
            {
                if (jpcommon_pos_list[i] == pos)
                {
                    find = 1;
                    break;
                }
            }

            if (find == 0)
            {
                Debug.LogError("WARNING: JPCommonLabelWord_initializel() in jpcommon_label.c: " + pos + " is unknown POS");
                i = 0;
            }

            this.pos = jpcommon_pos_list[i + 1];

            for (i = 0, find = 0; jpcommon_ctype_list[i] != null; i += 2)
            {
                if (jpcommon_ctype_list[i] == ctype)
                {
                    find = 1;
                    break;
                }
            }

            if (find == 0)
            {
                Debug.LogError("WARNING: JPCommonLabelWord_initializel() in jpcommon_label.c: " + ctype + " is unknown conjugation type.");
                i = 0;
            }

            this.ctype = jpcommon_ctype_list[i + 1];

            for (i = 0, find = 0; jpcommon_cform_list[i] != null; i += 2)
            {
                if (jpcommon_cform_list[i] == cform)
                {
                    find = 1;
                    break;
                }
            }

            if (find == 0)
            {
                Debug.LogError("WARNING: JPCommonLabelWord_initializel() in jpcommon_label.c: " + cform + " is unknown conjugation form.");
                i = 0;
            }

            this.cform = jpcommon_cform_list[i + 1];

            this.head = head;
            this.tail = tail;
            this.prev = prev;
            this.next = next;
        }
Ejemplo n.º 9
0
        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;
                }
            }
        }