Ejemplo n.º 1
0
 static Word()
 {
     Pronunciation[] array = new Pronunciation[]
     {
         Pronunciation.__UNKNOWN
     };
     Word.__UNKNOWN = new Word("<unk>", array, false);
     Pronunciation.__UNKNOWN.setWord(Word.__UNKNOWN);
 }
Ejemplo n.º 2
0
        private Word processEntry(string text)
        {
            LinkedList linkedList = new LinkedList();
            int        num        = 0;
            int        num2       = 0;
            string     text3;
            int        num3;

            do
            {
                num++;
                string text2 = text;
                if (num > 1)
                {
                    text2 = new StringBuilder().append(text2).append('(').append(num).append(')').toString();
                }
                text3 = (string)this.dictionary.get(text2);
                if (text3 != null)
                {
                    StringTokenizer stringTokenizer = new StringTokenizer(text3);
                    string          text4           = stringTokenizer.nextToken();
                    num2 = (String.instancehelper_startsWith(text4, "-F-") ? 1 : 0);
                    num3 = stringTokenizer.countTokens();
                    ArrayList arrayList = new ArrayList(num3);
                    for (int i = 0; i < num3; i++)
                    {
                        string name = stringTokenizer.nextToken();
                        arrayList.add(this.getCIUnit(name, num2 != 0));
                    }
                    linkedList.add(new Pronunciation(arrayList));
                }
            }while (text3 != null);
            Pronunciation[] array = (Pronunciation[])linkedList.toArray(new Pronunciation[linkedList.size()]);
            Word            word  = this.createWord(text, array, num2 != 0);

            Pronunciation[] array2 = array;
            num3 = array2.Length;
            for (int j = 0; j < num3; j++)
            {
                Pronunciation pronunciation = array2[j];
                pronunciation.setWord(word);
            }
            this.wordDictionary.put(text, word);
            return(word);
        }
Ejemplo n.º 3
0
        public virtual Pronunciation getMostLikelyPronunciation()
        {
            float         num    = float.NegativeInfinity;
            Pronunciation result = null;

            Pronunciation[] array = this.pronunciations;
            int             num2  = array.Length;

            for (int i = 0; i < num2; i++)
            {
                Pronunciation pronunciation = array[i];
                if (pronunciation.getProbability() > num)
                {
                    num    = pronunciation.getProbability();
                    result = pronunciation;
                }
            }
            return(result);
        }
Ejemplo n.º 4
0
        private Word extractPronunciation(string text)
        {
            ArrayList  arrayList  = this.g2pDecoder.phoneticize(text, this.g2pMaxPron);
            LinkedList linkedList = new LinkedList();
            Iterator   iterator   = arrayList.iterator();
            int        num;

            while (iterator.hasNext())
            {
                Path path = (Path)iterator.next();
                num = path.getPath().size();
                ArrayList arrayList2 = new ArrayList(num);
                Iterator  iterator2  = path.getPath().iterator();
                while (iterator2.hasNext())
                {
                    string name = (string)iterator2.next();
                    arrayList2.add(this.getCIUnit(name, false));
                }
                if (arrayList2.size() == 0)
                {
                    arrayList2.add(UnitManager.__SILENCE);
                }
                linkedList.add(new Pronunciation(arrayList2));
            }
            Pronunciation[] array = (Pronunciation[])linkedList.toArray(new Pronunciation[linkedList.size()]);
            Word            word  = this.createWord(text, array, false);

            Pronunciation[] array2 = array;
            num = array2.Length;
            for (int i = 0; i < num; i++)
            {
                Pronunciation pronunciation = array2[i];
                pronunciation.setWord(word);
            }
            return(word);
        }