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

📄 tgws.h

📁 这是一个用C++编写的编译原理的词法分析程序,希望对各位学习编译的同学有一定帮助
💻 H
字号:
/****************************************************************************
 *
 * Copyright (c) 2001-2005 Fajava Intelligence Technology (Beijing) Ltd.
 *     
 *     All rights reserved.
 *
 * This file is the confidential and proprietary property of 
 * Fajava Intelligence Technology (Beijing) Ltd.
 *        and the possession or use of this file requires 
 *         a written license from FAJAVA.
 *  Created:	2005-11-10   10:59
 *	File Path:	F:\TGWS\TGWS30
 * 	Filename: 	TGWS
 *	File ext:	h
 *  
 *  Author:     Fajava Intelligence Technology (Beijing) Ltd.
 *              www.fajava.com; www.fajava.cn
 *  Purpose:	
 *  
 *  History:    1. Created   2005-11-10
 *              2.             
 ****************************************************************************/
#if !defined(__TGWS_LIB_INCLUDED__)
#define __TGWS_LIB_INCLUDED__

#ifdef OS_LINUX
	#define TGWS_API 
#else
	#ifdef TGWS_EXPORTS
		#define TGWS_API __declspec(dllexport)
	#else
		#define TGWS_API 
	#endif
#endif
/*********************************************************************
 *
 *  Func Name  : Init
 *
 *  Description: Init TGWS
 *              The function must be invoked before any operation listed as following
 *
 *  Parameters : const char * sInitDirPath=NULL
 *       sInitDirPath: Initial Directory Path, where file Configure.xml and Data directory stored.
 * the default value is NULL, it indicates the initial directory is current working directory path
 *
 *  Returns    : success or fail
 *  Author     : Kevin Zhang  
 *  History    : 
 *              1.create 2002-8-6
 *********************************************************************/
TGWS_API bool TGWS_Init(const char * sInitDirPath=0);
/*********************************************************************
 *
 *  Func Name  : TGWS_Exit
 *
 *  Description: Exist TGWS and free related buffer
 *              Exit the program and free memory
 *The function must be invoked while you needn't any lexical anlysis
 *
 *  Parameters : None
 *
 *  Returns    : success or fail
 *  Author     : Kevin Zhang  
 *  History    : 
 *              1.create 2002-8-6
 *********************************************************************/
TGWS_API bool TGWS_Exit();
/*********************************************************************
 *
 *  Func Name  : ImportUserDict
 *
 *  Description: Import User-defined dictionary
 *  Parameters : Text filename for user dictionary 
 *  Returns    : The  number of  lexical entry imported successfully
 *  Author     : Kevin Zhang
 *  History    : 
 *              1.create 2003-11-28
 *********************************************************************/
TGWS_API unsigned int TGWS_ImportUserDict(const char *sFilename);

/*********************************************************************
 *
 *  Func Name  : ParagraphProcessing
 *
 *  Description: Process a paragraph
 *    
 *
 *  Parameters : sParagraph: The source paragraph 
 *               sResult: The result
 *  i.e.  张华平于1978年3月9日出生于江西省波阳县。
 *        Result: 张/nr  华平/nr  于/p  1978年/t  3月/t  9日/t  出生于/v  江西省/ns  波阳县/ns  。/w   
 *  Returns    : the result buffer pointer 
 *  Author     : Kevin Zhang  
 *  History    : 
 *              1.create 2003-12-22
 *********************************************************************/
TGWS_API const char * TGWS_ParagraphProcess(const char *sParagraph);
/*********************************************************************
 *
 *  Func Name  : TGWS_FileProcess
 *
 *  Description: Process a text file
 *    
 *
 *  Parameters : sSourceFilename: The source file name  
 *               sResultFilename: The result file name 
 *  i.e. FileProcess("E:\\Sample\\Corpus_NewPOS\\199802_Org.txt","E:\\Sample\\Corpus_NewPOS\\199802_Org_cla.txt");
 *  Returns    : success: 
 *               fail: 
 *  Author     : Kevin Zhang  
 *  History    : 
 *              1.create 2005-11-22
 *********************************************************************/
TGWS_API double TGWS_FileProcess(const char *sSourceFilename,const char *sResultFilename);
/*********************************************************************
 *
 *  Func Name  : TGWS_FileProcess
 *
 *  Description: Process a text file
 *    
 *
 *  Parameters : sSourceFilename: The source file name  
 *               sResultFilename: The result file name 
 *  i.e. FileProcess("E:\\Sample\\Corpus_NewPOS\\199802_Org.txt","E:\\Sample\\Corpus_NewPOS\\199802_Org_cla.txt");
 *  Returns    : success: 
 *               fail: 
 *  Author     : Kevin Zhang  
 *  History    : 
 *              1.create 2005-12-22
 *********************************************************************/
TGWS_API bool TGWS_ParagraphProcessHTML(const char *sParagraph,const char *sResultFilename);


/*********************************************************************
 *
 *  class CTGWS
 *   描述:
 *		   TGWS 类,使用之前必须调用TGWS_Init(),退出必须调用TGWS_Exit
 *		   在使用过程中可以使用多份CTGWS,支持多线程分词处理
 *
 *  History    : 
 *              1.create 2005-11-10
 *********************************************************************/
class TGWS_API CTGWS {
	public:
		CTGWS();
		~CTGWS();
		bool FileProcess(const char *sSourceFilename,const char *sResultFilename);
		//Process a file,类似于C下的TGWS_FileProcess
		const char * ParagraphProcess(const char *sLine); 
		//Process a file,类似于C下的TGWS_FileProcess
	private:
		unsigned int m_nHandle;//该成员作为该类的Handle值,有系统自动分配,用户不可修改
};

#endif//#define __TGWS_LIB_INCLUDED__

⌨️ 快捷键说明

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