Rss & SiteMap

课外天地 李树青 http://www.njcie.com

李树青 论坛 南京 财经 课外天地
共1 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:[推荐]第二次上机作业的说明——分词

1楼
admin 发表于:2008/3/25 22:42:21
public class WordSegmentation
{
        public static void main(String[] args)
        {
                String[] stopList = { "an", "and", "are", "as", "at", "be", "by",
                                "for", "from", "has", "he", "in", "is", "it", "its", "of",
                                "on", "that", "the", "to", "was", "were", "will", "with" };
                String doc = "The search trees overcome many issues of hash dictionary";
                java.util.Arrays.sort(stopList);
                String[] result = doc.toLowerCase().split("\\W");
                
                for(int i=0;i<result.length;i++)
                {
                        if(result[i].equals(""))
                                continue;
                        if(java.util.Arrays.binarySearch(stopList,result[i])<0)
                                System.out.println(result[i]);                  
                }
        }
}
[此贴子已经被作者于2010-12-12 08:24:12编辑过]
共1 条记录, 每页显示 10 条, 页签: [1]

Copyright ©2002 - 2016 课外天地.Net
Powered By Dvbbs Version 8.3.0
Processed in .04688 s, 2 queries.