浅谈使用xml作为配置文件初始化自己的项目
当一个项目的代码不断增加,其中很多的内容诸如全局变量、提示语言等等都有必要放在一个独立的文件,方便变更。这个独立的文件有很多种,可以是init文件、conf文件、xml文件,为了通用性,我选择了xml文件作为自己的配置文件。对于《字符级的CNN文本分类器》一文中,我的xml文件是这样的:
xml version="1.0" encoding="UTF-8" ?>name="train_text_home">TrainText name="test_text_home">TestText name="checkpoint_home">CheckPoints name="summary_home">Summaries name="log_home">Logs name="model_file">ENCharCNNTextClassification_%s name="summary_file">ENCharCNNTextClassification_%s name="log_file">Logs_of_%s.log name="pre_train.py"> name="encode_success">One-Hot encoding done! Totally %d words have been skipped. name="start_train_file">Start to train from file: %s. name="done_train_file">Finish to train from file: %s. name="open_dir">Open directory: %s. name="char_cnn.py"> name="checkpoint_restore">Checkpoint: %s has been restored. name="checkpoint_restore_fail">No checkpoints being restored. name="display_steps">Total steps: %d, batch cost: %.4f, batch accuracy: %.2f%%, time to use: %d seconds. name="display_test">Accuracy: %.2f%%. name="main.py"> name="done_train">The train has been done! name="done_validation">The validation has been done!
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
