Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

词典路径的进一步改进 #8

Closed
Eureka6174 opened this issue Jul 14, 2016 · 2 comments
Closed

词典路径的进一步改进 #8

Eureka6174 opened this issue Jul 14, 2016 · 2 comments

Comments

@Eureka6174
Copy link

我最近在实现一个类库,其中调用了Jieba。但是如果我想在其他工程中调用的时候,就需要在每一个工程的config文件中都设置jieba的目录。
我建议给ConfigFileBaseDir添加一个set,这样在项目中就可以动态的指定根目录了。我可以把jieba的资源文件放到整个类库的资源文件中,传一个变量就可以加载。
例如这样子:

        private static string _configFileBaseDir;
        public static string ConfigFileBaseDir
        {
            get
            {
                if (string.IsNullOrEmpty(_configFileBaseDir))
                {
                    _configFileBaseDir = ConfigurationManager.AppSettings["JiebaConfigFileDir"] ?? "Resources";
                }
                return _configFileBaseDir;
            }
            set { _configFileBaseDir = value; }
        }
@anderscui
Copy link
Owner

@Eureka6174 嗯,可以考虑。不过一旦支持了setter,就需要支持动态修改词典路径,等下次修改我再仔细看看哈。

@anderscui
Copy link
Owner

@Eureka6174 已经添加

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants