亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? nshortpath.cpp

?? 這是一個中科院中文詞法分析器
?? CPP
字號:
//////////////////////////////////////////////////////////////////////
//ICTCLAS簡介:計算所漢語詞法分析系統ICTCLAS(Institute of Computing Technology, Chinese Lexical Analysis System),
//             功能有:中文分詞;詞性標注;未登錄詞識別。
//             分詞正確率高達97.58%(973專家評測結果),
//             未登錄詞識別召回率均高于90%,其中中國人名的識別召回率接近98%;
//             處理速度為31.5Kbytes/s。
//著作權:  Copyright?2002-2005中科院計算所 職務著作權人:張華平 劉群
//遵循協議:自然語言處理開放資源許可證1.0
//Email: zhanghp@software.ict.ac.cn
//Homepage:www.nlp.org.cn;mtgroup.ict.ac.cn
/****************************************************************************
 *
 * Copyright (c) 2000, 2001 
 *     Software Research Lab.
 *     Institute of Computing Tech.
 *     Chinese Academy of Sciences
 *     All rights reserved.
 *
 * This file is the confidential and proprietary property of 
 * Institute of Computing Tech. and the posession or use of this file requires 
 * a written license from the author.
 *
 * Abstract:
 *      N-Shortest Path Problem for graph in word segement
 *
 * Author: Kevin Chang (zhanghp@software.ict.ac.cn)
 *
 * Notes:
 *
 ****************************************************************************/
// NShortPath.cpp: implementation of the CNShortPath class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "NShortPath.h"
#include "Segment.h"
#include <memory.h>
#include <string.h>
//#include <stdlib.h>
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CNShortPath::CNShortPath(CDynamicArray *apCost,unsigned int nValueKind)
{
       m_apCost=apCost;//Set the cost
	   m_nValueKind=nValueKind;//Set the value kind
	   m_nVertex=apCost->m_nCol+1;
       if(m_nVertex<apCost->m_nRow+1)
		   m_nVertex=apCost->m_nRow+1;//Get the vertex numbers

	   m_pParent=new CQueue*[m_nVertex-1];//not including the first node
	   m_pWeight=new ELEMENT_TYPE *[m_nVertex-1];
//	   m_pParent=(CQueue **)malloc((m_nVertex-1)*sizeof(CQueue *));//not including the first node
//	   m_pWeight=(ELEMENT_TYPE **)malloc(sizeof(ELEMENT_TYPE *)*(m_nVertex-1));

		for(unsigned int i=0;i<m_nVertex-1;i++)//The queue array for every node
		{
			m_pParent[i]=new CQueue[nValueKind];
			m_pWeight[i]=new ELEMENT_TYPE[nValueKind];
//			m_pParent[i]=(CQueue *)malloc(sizeof(CQueue)*nValueKind);
//			m_pWeight[i]=(ELEMENT_TYPE *)malloc(sizeof(ELEMENT_TYPE)*nValueKind);
		}
}

CNShortPath::~CNShortPath()
{
	 for(unsigned int i=0;i<m_nVertex-1;i++)//The queue array for every node
	 {
		 delete [] m_pWeight[i];
//		 free(m_pWeight[i]);
/*		 for(unsigned int j=0;j<m_nValueKind;j++)
		 {
			 m_pParent[i][j].~CQueue();//;delete 
		 }*/
//		 free(m_pParent[i]);
         delete [] m_pParent[i];
	 }
	 delete [] m_pWeight;
	 delete [] m_pParent;//not including the first node
//	 free(m_pWeight);
//	 free(m_pParent);
}

int CNShortPath::ShortPath()
{
	unsigned int nCurNode=1,nPreNode,i,nIndex;
	ELEMENT_TYPE eWeight;
	PARRAY_CHAIN pEdgeList;

    for(;nCurNode<m_nVertex;nCurNode++)
	{
	   CQueue queWork;
	   eWeight=m_apCost->GetElement(-1,nCurNode,0,&pEdgeList);//Get all the edges
       while(pEdgeList!=0 && pEdgeList->col==nCurNode)
	   {
		   nPreNode=pEdgeList->row;
		   eWeight=pEdgeList->value;//Get the value of edges
           for(i=0;i<m_nValueKind;i++)
		   {
			   if(nPreNode>0)//Push the weight and the pre node infomation
			   {
				   if(m_pWeight[nPreNode-1][i]==INFINITE_VALUE)
					   break;
		           queWork.Push(nPreNode,i,eWeight+m_pWeight[nPreNode-1][i]);
			   }
			   else
			   {
				   queWork.Push(nPreNode,i,eWeight);
				   break;
			   }
		   }//end for
           pEdgeList=pEdgeList->next;
		   
	   }//end while
       
	   //Now get the result queue which sort as weight.
	   //Set the current node information
	   for(i=0;i<m_nValueKind;i++)
	   {
			m_pWeight[nCurNode-1][i]=INFINITE_VALUE;
	   }
	   //memset((void *),(int),sizeof(ELEMENT_TYPE)*);
       //init the weight
	   i=0;	   
       while(i<m_nValueKind&&queWork.Pop(&nPreNode,&nIndex,&eWeight)!=-1)
	   {//Set the current node weight and parent
		   if(m_pWeight[nCurNode-1][i]==INFINITE_VALUE)
			   m_pWeight[nCurNode-1][i]=eWeight;
		   else if(m_pWeight[nCurNode-1][i]<eWeight)//Next queue
		   {
			   i++;//Go next queue and record next weight
			   if(i==m_nValueKind)//Get the last position
				   break;
			   m_pWeight[nCurNode-1][i]=eWeight;
		   }
           m_pParent[nCurNode-1][i].Push(nPreNode,nIndex);
	   }
	}//end for

	return 1;
}
//bBest=true: only get one best result and ignore others
//Added in 2002-1-24
void CNShortPath::GetPaths(unsigned int nNode,unsigned int nIndex,int **nResult,bool bBest)
{
    CQueue queResult;
	unsigned int nCurNode,nCurIndex,nParentNode,nParentIndex,nResultIndex=0;
    
	if(m_nResultCount>=MAX_SEGMENT_NUM)//Only need 10 result
		return ;
	nResult[m_nResultCount][nResultIndex]=-1;//Init the result 
	queResult.Push(nNode,nIndex);
    nCurNode=nNode;
	nCurIndex=nIndex;
    bool bFirstGet;
    while(!queResult.IsEmpty())
	{
		while(nCurNode>0)//
		{//Get its parent and store them in nParentNode,nParentIndex
			if(m_pParent[nCurNode-1][nCurIndex].Pop(&nParentNode,&nParentIndex,0,false,true)!=-1)
			{
			   nCurNode=nParentNode;
			   nCurIndex=nParentIndex;
			}
			if(nCurNode>0)
                queResult.Push(nCurNode,nCurIndex);
		}
		if(nCurNode==0)
		{ //Get a path and output
  		   nResult[m_nResultCount][nResultIndex++]=nCurNode;//Get the first node
		   bFirstGet=true;
		   nParentNode=nCurNode;
		   while(queResult.Pop(&nCurNode,&nCurIndex,0,false,bFirstGet)!=-1)
		   {
			   nResult[m_nResultCount][nResultIndex++]=nCurNode;
    	       bFirstGet=false;
			   nParentNode=nCurNode;
		   }
		   nResult[m_nResultCount][nResultIndex]=-1;//Set the end
		   m_nResultCount+=1;//The number of result add by 1
		   if(m_nResultCount>=MAX_SEGMENT_NUM)//Only need 10 result
				return ;
		   nResultIndex=0;
		   nResult[m_nResultCount][nResultIndex]=-1;//Init the result 

		   if(bBest)//Return the best result, ignore others
			   return ;
		}
		queResult.Pop(&nCurNode,&nCurIndex,0,false,true);//Read the top node
        while(queResult.IsEmpty()==false&&(m_pParent[nCurNode-1][nCurIndex].IsSingle()||m_pParent[nCurNode-1][nCurIndex].IsEmpty(true)))
		{
	       queResult.Pop(&nCurNode,&nCurIndex,0);//Get rid of it
		   queResult.Pop(&nCurNode,&nCurIndex,0,false,true);//Read the top node
		}
        if(queResult.IsEmpty()==false&&m_pParent[nCurNode-1][nCurIndex].IsEmpty(true)==false)
		{
			   m_pParent[nCurNode-1][nCurIndex].Pop(&nParentNode,&nParentIndex,0,false,false);
			   nCurNode=nParentNode;
			   nCurIndex=nParentIndex;
			   if(nCurNode>0)
			       queResult.Push(nCurNode,nCurIndex);
		}
	}
}
int CNShortPath::Output(int **nResult,bool bBest,int *npCount)
{//sResult is a string array
  unsigned int i;
  
  m_nResultCount=0;//The 
  if(m_nVertex<2)
  {
	  nResult[0][0]=0;
	  nResult[0][1]=1;
	  *npCount=1;
	  return 1;
  }
  for(i=0;i<m_nValueKind&&m_pWeight[m_nVertex-2][i]<INFINITE_VALUE;i++)
  {
	  GetPaths(m_nVertex-1,i,nResult,bBest);
	  *npCount=m_nResultCount;
	  if(nResult[i][0]!=-1&&bBest)//Get the best answer
		  return 1;
      if(m_nResultCount>=MAX_SEGMENT_NUM)//Only need 10 result
	 	  return 1;
  }
  return 1;
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久免费电影网| 国产一区二区在线影院| 日韩激情中文字幕| 久久99精品久久久久久久久久久久| 麻豆精品在线播放| 国产成人精品aa毛片| 成人avav在线| 91精品国产综合久久精品图片| 精品国产凹凸成av人导航| 欧美国产一区二区| 日韩高清一级片| 大白屁股一区二区视频| 欧美写真视频网站| 国产欧美一区二区精品仙草咪| 一区2区3区在线看| 国产福利一区二区| 欧美日韩高清一区二区不卡| 久久精品免视看| 日韩精品每日更新| 成人国产精品免费网站| 日韩三区在线观看| 日韩美女啊v在线免费观看| 奇米影视一区二区三区| 国产91丝袜在线播放| 欧美二区乱c少妇| 自拍偷拍欧美精品| 国产在线看一区| 777午夜精品免费视频| 中文字幕一区免费在线观看| 久久国内精品视频| 欧美系列在线观看| 中文字幕人成不卡一区| 久久国内精品视频| 欧美日韩综合不卡| 一区在线中文字幕| 国产一区二区三区香蕉| 欧美最新大片在线看| 国产清纯美女被跳蛋高潮一区二区久久w| 亚洲一区二区欧美| 91天堂素人约啪| 久久久777精品电影网影网| 日av在线不卡| 欧美伊人久久久久久久久影院 | 日本不卡123| 色噜噜狠狠成人网p站| 国产精品系列在线| 国产真实乱偷精品视频免| 日韩一区二区三区免费看| 亚洲在线视频免费观看| 色婷婷亚洲精品| 国产精品电影院| 懂色av中文一区二区三区| 精品国产乱子伦一区| 蜜臀av一级做a爰片久久| 欧美精品一卡二卡| 亚洲国产成人av好男人在线观看| 不卡视频一二三| 国产精品天干天干在观线| 国产电影一区在线| 久久人人97超碰com| 久久精品免费看| 91精品欧美综合在线观看最新 | 欧美色网站导航| 一区二区三区四区在线免费观看| 国产91对白在线观看九色| 欧美电影免费观看高清完整版在线 | 国产伦精品一区二区三区视频青涩| 欧美一区二区精品在线| 一区二区成人在线观看| 在线精品视频一区二区| 亚洲精品精品亚洲| 91福利在线观看| 亚洲精品第一国产综合野| 色中色一区二区| 亚洲高清久久久| 在线成人小视频| 免费日韩伦理电影| 精品国内片67194| 国产成人h网站| 一区精品在线播放| 91精品办公室少妇高潮对白| 亚洲一区视频在线| 制服丝袜av成人在线看| 日本sm残虐另类| 久久精品日产第一区二区三区高清版 | av在线综合网| 亚洲综合免费观看高清完整版 | 看电影不卡的网站| 久久九九久精品国产免费直播| 国产精品一二三四五| 欧美激情一区不卡| 一本久久综合亚洲鲁鲁五月天| 怡红院av一区二区三区| 欧美一区二区三区影视| 国产美女精品在线| 国产精品理论片在线观看| 色爱区综合激月婷婷| 天天射综合影视| 久久亚洲一区二区三区四区| 成人不卡免费av| 亚洲成av人片在线观看无码| 日韩欧美视频一区| 成人免费看的视频| 亚洲国产sm捆绑调教视频| 欧美成人乱码一区二区三区| 成人性色生活片| 亚洲成人在线免费| 久久综合九色欧美综合狠狠 | 亚洲香肠在线观看| 日韩欧美成人激情| 成人av电影免费观看| 亚洲444eee在线观看| 久久精品亚洲一区二区三区浴池| 色偷偷88欧美精品久久久| 久久精品二区亚洲w码| 国产精品国产三级国产有无不卡| 欧美日韩一级大片网址| 国产乱码精品1区2区3区| 一区二区三区在线播放| 26uuu久久天堂性欧美| 91浏览器在线视频| 久久99国产精品尤物| 综合久久久久久| 精品国产在天天线2019| 在线精品视频免费观看| 国产麻豆视频一区| 亚洲国产aⅴ天堂久久| 欧美韩国日本一区| 日韩视频永久免费| 日本道色综合久久| 国产精品亚洲第一区在线暖暖韩国| 亚洲午夜久久久久久久久电影网| 久久久国产午夜精品| 欧美人妖巨大在线| 99国产欧美另类久久久精品| 麻豆久久一区二区| 亚洲成av人片www| 中文字幕一区二区三区四区不卡| 日韩精品一区二区三区四区视频 | 亚洲成人www| 成人免费在线播放视频| 精品国产乱码久久久久久久久 | 奇米在线7777在线精品 | 欧美日韩国产综合视频在线观看| 高清不卡在线观看av| 麻豆久久久久久久| 午夜精彩视频在线观看不卡| 中文字幕在线不卡一区二区三区| 日韩一区二区精品葵司在线 | 日本特黄久久久高潮| 一区二区三区不卡在线观看| 国产欧美日本一区二区三区| 精品欧美乱码久久久久久1区2区| 91久久精品网| www.久久精品| 顶级嫩模精品视频在线看| 激情都市一区二区| 日日欢夜夜爽一区| 亚洲综合一二区| 亚洲精品国久久99热| 国产精品国模大尺度视频| 久久久久久麻豆| 久久综合五月天婷婷伊人| 91精品国产综合久久小美女| 欧美日韩在线不卡| 欧美亚洲综合在线| 欧美性大战xxxxx久久久| 在线视频欧美区| 色悠久久久久综合欧美99| 99精品视频在线播放观看| 不卡一区二区在线| 成人免费精品视频| av电影在线观看不卡| 成人性生交大片免费看中文网站| 国产精品一级在线| 国产精品亚洲视频| 福利一区二区在线| 成人理论电影网| 成a人片国产精品| 99国产精品久久久久久久久久久| av动漫一区二区| 色噜噜夜夜夜综合网| 91福利小视频| 欧美伦理视频网站| 日韩欧美国产综合一区| 欧美成人一区二区三区| 精品久久久久久亚洲综合网| 久久综合一区二区| 欧美国产禁国产网站cc| 亚洲日本在线天堂| 亚洲一区二区三区国产| 视频在线观看91| 另类人妖一区二区av| 狠狠色丁香久久婷婷综合_中 | 久久久久久99精品| 久久精品视频在线免费观看| 国产精品每日更新| 亚洲免费av网站| 亚洲bt欧美bt精品| 九色porny丨国产精品|