Exemplo n.º 1
0
        /*
         * (non-Javadoc)
         *
         * @see edu.cmu.sphinx.linguist.dictionary.Dictionary#allocate()
         */

        public override void Allocate()
        {
            if (!allocated)
            {
                dictionary     = new HashMap <String, String>();
                wordDictionary = new HashMap <String, Word>();

                Timer loadTimer = TimerPool.GetTimer(this, "Load Dictionary");
                fillerWords = new HashSet <String>();

                loadTimer.Start();

                this.LogInfo("Loading dictionary from: " + wordDictionaryFile);

                LoadDictionary(wordDictionaryFile.OpenStream(), false);

                LoadCustomDictionaries(addendaUrlList);

                this.LogInfo("Loading filler dictionary from: " + fillerDictionaryFile);

                LoadDictionary(fillerDictionaryFile.OpenStream(), true);

                if (g2pModelFile != null && !g2pModelFile.Path.Equals(""))
                {
                    g2pDecoder = new G2PConverter(g2pModelFile);
                }
                loadTimer.Stop();
            }
        }
Exemplo n.º 2
0
        /*
         * (non-Javadoc)
         *
         * @see edu.cmu.sphinx.linguist.dictionary.Dictionary#deallocate()
         */

        public override void Deallocate()
        {
            if (allocated)
            {
                dictionary = null;
                g2pDecoder = null;
                allocated  = false;
            }
        }