是自动判断单个单词吗?
比如words 当你点中w或者插入点在w上时,就得到整体的单词words??!
是这样吗??
如果是,我知道解决方法!!
下面是我自己研究后做到的取单词的程序源码!!概念应该是这样的!!
用到了RichTextBox
public static string fixWord(System.Windows.Forms.RichTextBox richTextBox,int num)
{
int length=richTextBox.TextLength;
int wordStart=0,wordEnd=length-1;
string word="";
//Get the start position of the single word.
for(int j=num;j>=0;j--)
{
if(richTextBox.Text[num]==' ')
{
wordStart=num;
break;
} if(richTextBox.Text[j]==' ')
{
wordStart=j+1;
break;
}
} //Get the end position of the single word.
for(int i=num;i<length;i++)
{
if(richTextBox.Text[i]==' ')
{
wordEnd=i;
break;
}
} for(int k=wordStart;k<=wordEnd;k++)
{
word=word.Insert(word.Length,Convert.ToString(richTextBox.Text[k]));
}
return word;
}
比如words 当你点中w或者插入点在w上时,就得到整体的单词words??!
是这样吗??
如果是,我知道解决方法!!
下面是我自己研究后做到的取单词的程序源码!!概念应该是这样的!!
用到了RichTextBox
public static string fixWord(System.Windows.Forms.RichTextBox richTextBox,int num)
{
int length=richTextBox.TextLength;
int wordStart=0,wordEnd=length-1;
string word="";
//Get the start position of the single word.
for(int j=num;j>=0;j--)
{
if(richTextBox.Text[num]==' ')
{
wordStart=num;
break;
} if(richTextBox.Text[j]==' ')
{
wordStart=j+1;
break;
}
} //Get the end position of the single word.
for(int i=num;i<length;i++)
{
if(richTextBox.Text[i]==' ')
{
wordEnd=i;
break;
}
} for(int k=wordStart;k<=wordEnd;k++)
{
word=word.Insert(word.Length,Convert.ToString(richTextBox.Text[k]));
}
return word;
}
串频统计和词形匹配相结合的汉语自动分词系统
作者 刘 挺 吴 岩 王开铸
作者单位 哈尔滨工业大学计算机系 1 50 0 0 1http://naxun.sjtu.edu.cn/articles/zhongwenxinxixuebao/comment.asp?article_name=串频统计和词形匹配相结合的汉语自动分词系统http://www5.nlc.gov.cn/disk4/xuehui/2000nianhui/xsjl-2xm.htm你自己去www.google.com,用"自动分词"查一下,有不少有用的东西.
判断鼠标点击的位置可以先用判断鼠标的点击事件,然后由于插入点变更,所以就会得到全部单词!!
判断鼠标move到哪一个单词可以用GetCharIndexFromPosition方法获得richTextBox控件的文本索引index!!
我的程序代码使用方法请自己研究,如果不明白,请留言!!
50分少了点,想当初这个问题烦了我一个礼拜!!不过现在闭着眼睛我也能在5分钟内敲出来~~~~~~~~~~
赫赫~~~~~~~
在这里阿!!!!!!!!!
唉~~~~~~~总是跟我抢分!!!!!!!!
你也真是的!!也不看看自己什么身份!!!
得得~~~~这50分都给你好了!!!我安心得去做我的2等绿星吧!!
祝你早日得到3颗红星
如果说你说的东西,我盼他能给你满分.