Example #1
0
        public static void Init(string fileName)
        {
            lock (_LockObj)
            {
                if (_Inited)
                {
                    return;
                }

                InitInfinitiveVerbTable();

                if (fileName == null)
                {
                    Setting.SettingLoader loader = new PanGu.Setting.SettingLoader();
                }
                else
                {
                    Setting.SettingLoader loader = new PanGu.Setting.SettingLoader(fileName);
                }

                LoadDictionary();

                _Inited = true;

                _Wildcard = new PanGu.Dict.Wildcard(Setting.PanGuSettings.Config.MatchOptions,
                                                    Setting.PanGuSettings.Config.Parameters);

                string dir = Setting.PanGuSettings.Config.GetDictionaryPath();

                if (Setting.PanGuSettings.Config.MatchOptions.WildcardOutput)
                {
                    _Wildcard.Load(dir);
                }
            }
        }
Example #2
0
        static private void LoadDictionary()
        {
            _WordDictionary = new PanGu.Dict.WordDictionary();
            string dir = Setting.PanGuSettings.Config.GetDictionaryPath();

            _WordDictionary.Load(dir + "Dict.Dct");

            _ChsName = new PanGu.Dict.ChsName();
            _ChsName.LoadChsName(Setting.PanGuSettings.Config.GetDictionaryPath());


            _WordDictionary.ChineseName = _ChsName;

            _StopWord = new PanGu.Dict.StopWord();
            _StopWord.LoadStopwordsDict(dir + "Stopword.txt");

            _Synonym = new PanGu.Dict.Synonym();

            if (Setting.PanGuSettings.Config.MatchOptions.SynonymOutput)
            {
                _Synonym.Load(dir);
            }

            _Wildcard = new PanGu.Dict.Wildcard(Setting.PanGuSettings.Config.MatchOptions,
                                                Setting.PanGuSettings.Config.Parameters);

            if (Setting.PanGuSettings.Config.MatchOptions.WildcardOutput)
            {
                _Wildcard.Load(dir);
            }

            _DictLoader = new PanGu.Dict.DictionaryLoader(Setting.PanGuSettings.Config.GetDictionaryPath());
        }
Example #3
0
        /// <summary>
        /// 传入配置文件初始化
        /// </summary>
        /// <param name="fileName"></param>
        public static void Init(string fileName)
        {
            //IOHelper.WriteLog("InitfileName1=" + fileName);
            lock (_LockObj)
            {
                if (_Inited)
                {
                    return;
                }

                InitInfinitiveVerbTable();

                if (string.IsNullOrEmpty(fileName))
                {
                    Setting.SettingLoader loader = new PanGu.Setting.SettingLoader();
                    //IOHelper.WriteLog("InitfileName2=" + fileName);
                }
                else
                {
                    Setting.SettingLoader loader = new PanGu.Setting.SettingLoader(fileName);
                    //IOHelper.WriteLog("InitfileName3=" + fileName);
                }

                LoadDictionary(fileName);

                _Inited = true;

                _Wildcard = new PanGu.Dict.Wildcard(Setting.PanGuSettings.Config.MatchOptions,
                                                    Setting.PanGuSettings.Config.Parameters);

                string dir = Setting.PanGuSettings.Config.GetDictionaryPath(fileName);

                if (Setting.PanGuSettings.Config.MatchOptions.WildcardOutput)
                {
                    _Wildcard.Load(dir);
                }
            }
        }
Example #4
0
        static private void LoadDictionary()
        {
            _WordDictionary = new PanGu.Dict.WordDictionary();
            string dir = Setting.PanGuSettings.Config.GetDictionaryPath();
            _WordDictionary.Load(dir + "Dict.Dct");

            _ChsName = new PanGu.Dict.ChsName();
            _ChsName.LoadChsName(Setting.PanGuSettings.Config.GetDictionaryPath());


            _WordDictionary.ChineseName = _ChsName;

            _StopWord = new PanGu.Dict.StopWord();
            _StopWord.LoadStopwordsDict(dir + "Stopword.txt");

            _Synonym = new PanGu.Dict.Synonym();

            if (Setting.PanGuSettings.Config.MatchOptions.SynonymOutput)
            {
                _Synonym.Load(dir);
            }

            _Wildcard = new PanGu.Dict.Wildcard(Setting.PanGuSettings.Config.MatchOptions,
                Setting.PanGuSettings.Config.Parameters);

            if (Setting.PanGuSettings.Config.MatchOptions.WildcardOutput)
            {
                _Wildcard.Load(dir);
            }

            _DictLoader = new PanGu.Dict.DictionaryLoader(Setting.PanGuSettings.Config.GetDictionaryPath());
        }
Example #5
0
        public static void Init(string fileName)
        {
            lock (_LockObj)
            {
                if (_Inited)
                {
                    return;
                }

                InitInfinitiveVerbTable();

                if (fileName == null)
                {
                    Setting.SettingLoader loader = new PanGu.Setting.SettingLoader();
                }
                else
                {
                    Setting.SettingLoader loader = new PanGu.Setting.SettingLoader(fileName);
                }

                LoadDictionary();

                _Inited = true;

                _Wildcard = new PanGu.Dict.Wildcard(Setting.PanGuSettings.Config.MatchOptions,
                    Setting.PanGuSettings.Config.Parameters);

                string dir = Setting.PanGuSettings.Config.GetDictionaryPath();

                if (Setting.PanGuSettings.Config.MatchOptions.WildcardOutput)
                {
                    _Wildcard.Load(dir);
                }

            }
        }