⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 conffile.pas

📁 解码器是基于短语的统计机器翻译系统的核心模块
💻 PAS
字号:
(*
* CONFFILE.PAS  -  Configuration file** Copyright (C) 2006 by Yidong Chen <ydchen@xmu.edu.cn>Institute of Artificial Intelligence, Xiamen University* Begin       : 09/18/2006* Last Change : 09/18/2006** This program is free software; you can redistribute it and/or* modify it under the terms of the GNU Lesser General Public* License as published by the Free Software Foundation; either* version 2.1 of the License, or (at your option) any later version.** This program is distributed in the hope that it will be useful,* but WITHOUT ANY WARRANTY; without even the implied warranty of* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* GNU General Public License for more details.** You should have received a copy of the GNU Lesser General Public* License along with this program; if not, write to the Free Software* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.*)
UNIT CONFFILE;

INTERFACE

TYPE
  TConfFile=CLASS
    PRIVATE
      FCEMTPath: STRING;
      FSegTagPath: STRING;
      FICTCLASPath: STRING;
      FLMPath: STRING;

      FLanguageModel: STRING;
      FBilingualPhrases: STRING;

      FiNp: Integer;
      FrTp: Real;

      FrLPce: Real;
      FrLLce: Real;
      FrLPec: Real;
      FrLLec: Real;
      FrLLenP: Real;
      FrLLm: Real;
    PUBLIC
      PROPERTY CEMTPath: STRING READ FCEMTPath;
      PROPERTY SegTagPath: STRING READ FSegTagPath;
      PROPERTY ICTCLASPath: STRING READ FICTCLASPath;
      PROPERTY LMPath: STRING READ FLMPath;

      PROPERTY LanguageModel: STRING READ FLanguageModel;
      PROPERTY BilingualPhrases: STRING READ FBilingualPhrases;

      PROPERTY iNp: Integer READ FiNp;
      PROPERTY rTp: Real READ FrTp;

      PROPERTY rLPce: Real READ FrLPce;
      PROPERTY rLLce: Real READ FrLLce;
      PROPERTY rLPec: Real READ FrLPec;
      PROPERTY rLLec: Real READ FrLLec;
      PROPERTY rLLenP: Real READ FrLLenP;
      PROPERTY rLLm: Real READ FrLLm;

      CONSTRUCTOR Create(strIniFileName, strSysPathName: STRING);
  END;

IMPLEMENTATION

USES SysUtils, IniFiles;

CONSTRUCTOR TConfFile.Create(strIniFileName, strSysPathName: STRING);
VAR IniFile: TMemIniFile; strTemp, Section: STRING;
BEGIN
  IniFile:=TMemIniFile.Create(strIniFileName);

  Section:='ce';

  FCEMTPath:=strSysPathName+IniFile.ReadString(Section, 'cemtsdk_path', '');
  FSegTagPath:=strSysPathName+IniFile.ReadString(Section, 'segtag_path', '');
  FICTCLASPath:=strSysPathName+IniFile.ReadString(Section, 'ictclas_path', '');
  FLMPath:=strSysPathName+IniFile.ReadString(Section, 'lm_path', '');

  FLanguageModel:=strSysPathName+IniFile.ReadString(Section, 'language_model_file', '');
  FBilingualPhrases:=strSysPathName+IniFile.ReadString(Section, 'bilingual_phrases_file', '');

  strTemp:=IniFile.ReadString(section, 'tp', '');
  FrTp:=StrToFloatDef(strTemp, 0);
  strTemp:=IniFile.ReadString(section, 'np', '');
  FiNp:=StrToIntDef(strTemp, 0);

  strTemp:=IniFile.ReadString(section, 'p_c_e', '');
  FrLPce:=StrToFloatDef(strTemp, 0);
  strTemp:=IniFile.ReadString(section, 'lex_c_e', '');
  FrLLce:=StrToFloatDef(strTemp, 0);
  strTemp:=IniFile.ReadString(section, 'p_e_c', '');
  FrLPec:=StrToFloatDef(strTemp, 0);
  strTemp:=IniFile.ReadString(section, 'lex_e_c', '');
  FrLLec:=StrToFloatDef(strTemp, 0);
  strTemp:=IniFile.ReadString(section, 'word_penalty', '');
  FrLLenP:=StrToFloatDef(strTemp, 0);
  strTemp:=IniFile.ReadString(section, 'language_model', '');
  FrLLm:=StrToFloatDef(strTemp, 0);

  IniFile.Free;
END;

END.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -