public static string GetChsPosStr(POS pos)
{
switch (pos)
case POS.POS_UNK:
return "未知词性";
case POS.POS_D_K:
return "后接成分";
case POS.POS_D_H:
return "前接成分";
case POS.POS_A_NZ:
return "其他专名";
case POS.POS_A_NX:
return "外文字符";
case POS.POS_A_NR:
return "人名";
case POS.POS_D_Z:
return "状态词";
case POS.POS_A_NT:
return "机构团体";
case POS.POS_A_NS:
return "地名";
case POS.POS_D_Y:
return "语气词 语气语素";
case POS.POS_D_X:
return "非语素字";
case POS.POS_D_W:
return "标点符号";
case POS.POS_D_T:
return "时间词";
case POS.POS_D_S:
return "处所词";
case POS.POS_D_V:
return "动词 动语素";
case POS.POS_D_U:
return "助词 助语素";
case POS.POS_D_R:
return "代词 代语素";
case POS.POS_A_Q:
return "量词 量语素";
case POS.POS_D_P:
return "介词";
case POS.POS_D_MQ:
return "数量词";
case POS.POS_A_M:
return "数词 数语素";
case POS.POS_D_O:
return "拟声词";
case POS.POS_D_N:
return "名词 名语素";
case POS.POS_D_F:
return "方位词 方位语素";
case POS.POS_D_E:
return "叹词 叹语素";
case POS.POS_D_L:
return "习语";
case POS.POS_D_I:
return "成语";
case POS.POS_D_D:
return "副词 副语素";
case POS.POS_D_C:
return "连词 连语素";
case POS.POS_D_B:
return "区别词 区别语素";
case POS.POS_D_A:
return "形容词 形语素";
}
public static string DoSegment(string keyWord) { return DoSegment(keyWord, ""); //分词输出的间隔符 }
public static string DoSegment(string keyWord,string separator) { PanGu.Segment.Init(); PanGu.Segment segment = new PanGu.Segment(); ICollection<PanGu.WordInfo> words = segment.DoSegment(keyWord); keyWord = ""; int i=0; string v_list= ""; foreach (PanGu.WordInfo wordInfo in words) { v_list=wordInfo.Word+"^"+wordInfo.Rank+"^"+wordInfo.Frequency+"^"+wordInfo.WordType+"^"+wordInfo.Pos; //词+"^"+权重+"^"+词频+"^"+"^"+词性; if(i==0) keyWord = v_list; else keyWord += separator+v_list; i++; } return keyWord; }