- 浏览: 131378 次
- 性别:
- 来自: 大连
文章分类
最新评论
-
datawarehouse:
datawarehouse 写道ngix 淘宝是基于这个开发了 ...
解密淘宝网的开源架构 -
datawarehouse:
ngix 淘宝是基于这个开发了一个自己的webserver吧。 ...
解密淘宝网的开源架构 -
eyelock:
我运行报错,,楼主能解答一下G,对swing不熟。
raphi ...
假期没事,写了个90行的俄罗斯方块,Java实现,史上最小巧 -
lostsky_11:
楼主写出例子了么?物理碰撞部分可能跟你说的差不多渲染部分可以搜 ...
Where is my water 游戏算法 -
xouou_53320:
都是牛人
假期没事,写了个90行的俄罗斯方块,Java实现,史上最小巧
代码些的比较烂,只是从几篇文章中过滤处单词本中没有的单词,导出成单独的一个文件,再手动一个一个录入到单词本中。。小工具。。mark一下。。使用dom4j。
<?xml version="1.0" encoding="UTF-8"?> <wordbook><item> <word>daunting</word> <trans><![CDATA[adj. 使人畏缩的;使人气馁的;令人怯步的 daunting: 令人沮丧 | 使人畏缩的 | 使人气馁的]]></trans> <phonetic><![CDATA[['dɔ:ntiŋ]]]></phonetic> <tags/> <progress>10</progress> </item><item> <word>informative</word> <trans><![CDATA[adj. 教育性的,有益的;情报的;见闻广博的 informative: 告知性的 | 使知道消息的 | 有益的]]></trans> <phonetic><![CDATA[[in'fɔ:mətiv]]]></phonetic> <tags/> <progress>10</progress> </item><item> <word>contribute</word> <trans><![CDATA[vt. 贡献,出力;投稿;捐献 vt. 贡献,出力;投稿;捐献 contribute: 贡献 | 捐助 | 做出贡献]]></trans> <phonetic><![CDATA[[kən'tribju:t]]]></phonetic> <tags/> <progress>10</progress> </item>
import java.io.BufferedInputStream; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileWriter; import java.io.IOException; import java.io.InputStreamReader; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import org.dom4j.Document; import org.dom4j.DocumentException; import org.dom4j.Element; import org.dom4j.Node; import org.dom4j.io.SAXReader; public class WordNewMain { /** * @param args * @throws DocumentException * @throws IOException */ public static void main(String[] args) throws DocumentException, IOException { Map<String, Word> listMap = new HashMap<String, Word>(); SAXReader saxReader = new SAXReader(); saxReader.setEncoding("utf-8"); Document whole1Xml = saxReader.read(new BufferedInputStream(new FileInputStream("all_sych.xml"))); List<Element> whole1List = whole1Xml.selectNodes("//wordbook/item"); System.out.println("whole1 List Size:" + whole1List.size()); for (int i = 0; i < whole1List.size(); i++) { Element e = whole1List.get(i); Node word = e.selectSingleNode("word"); Node trans = e.selectSingleNode("trans"); Node phonetic = e.selectSingleNode("phonetic"); Node tags = e.selectSingleNode("tags"); Node progress = e.selectSingleNode("progress"); Word w = listMap.get(word.getStringValue()); if (w != null && Integer.parseInt(w.getProgress()) < Integer.parseInt(progress.getStringValue())) { w.setProgress(progress.getStringValue()); } else if (w == null) { e.detach(); w = new Word(word.getStringValue(), trans.getStringValue(), phonetic.getStringValue(), tags.getStringValue(), progress.getStringValue()); } listMap.put(word.getStringValue().toLowerCase(), w); } // txt BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(new File("8word.txt")))); System.out.println("Ok, find the file!"); String line = null; byte[] wordB = new byte[30]; Map<String, String> countArea = new HashMap<String, String>(); int wordBP = 0; String theWord = null; System.out.println("Start count~"); FileWriter fw = new FileWriter("result.txt"); while ((line = br.readLine()) != null) { boolean inWord = true; byte[] lineB = line.getBytes(); for (int i = 0; i < lineB.length; i++) { // is a character if ((lineB[i] < 91 && lineB[i] > 64) || (lineB[i] < 123 && lineB[i] > 96)) { wordB[wordBP] = lineB[i]; wordBP = wordBP + 1; inWord = true; } else if (inWord) { theWord = new String(wordB).trim().toLowerCase(); if (listMap.get(theWord) == null && theWord.length() > 1) { countArea.put(theWord, theWord); } wordBP = 0; inWord = false; wordB = new byte[30]; } } if (inWord) { theWord = new String(wordB).trim().toLowerCase(); if (listMap.get(theWord) == null && theWord.length() > 1) { countArea.put(theWord, theWord); } wordBP = 0; inWord = false; wordB = new byte[30]; } } br.close(); // steven txt br = new BufferedReader(new InputStreamReader(new FileInputStream(new File("steve_4p.txt")))); System.out.println("Ok, find the file!"); while ((line = br.readLine()) != null) { boolean inWord = true; byte[] lineB = line.getBytes(); for (int i = 0; i < lineB.length; i++) { // is a character if ((lineB[i] < 91 && lineB[i] > 64) || (lineB[i] < 123 && lineB[i] > 96)) { wordB[wordBP] = lineB[i]; wordBP = wordBP + 1; inWord = true; } else if (inWord) { theWord = new String(wordB).trim().toLowerCase(); if (listMap.get(theWord) == null && theWord.length() > 1) { countArea.put(theWord, theWord); } wordBP = 0; inWord = false; wordB = new byte[30]; } } if (inWord) { theWord = new String(wordB).trim().toLowerCase(); if (listMap.get(theWord) == null && theWord.length() > 1) { countArea.put(theWord, theWord); } wordBP = 0; inWord = false; wordB = new byte[30]; } } // GRE text br = new BufferedReader(new InputStreamReader(new FileInputStream(new File("gre.txt")))); System.out.println("Ok, find the file!"); while ((line = br.readLine()) != null) { boolean inWord = true; byte[] lineB = line.getBytes(); for (int i = 0; i < lineB.length; i++) { // is a character if ((lineB[i] < 91 && lineB[i] > 64) || (lineB[i] < 123 && lineB[i] > 96)) { wordB[wordBP] = lineB[i]; wordBP = wordBP + 1; inWord = true; } else if (inWord) { theWord = new String(wordB).trim().toLowerCase(); if (listMap.get(theWord) == null && theWord.length() > 1) { countArea.put(theWord, theWord); } wordBP = 0; inWord = false; wordB = new byte[30]; } } if (inWord) { theWord = new String(wordB).trim().toLowerCase(); if (listMap.get(theWord) == null && theWord.length() > 1) { countArea.put(theWord, theWord); } wordBP = 0; inWord = false; wordB = new byte[30]; } } // GaoZhong text br = new BufferedReader(new InputStreamReader(new FileInputStream(new File("gz.txt")))); System.out.println("Ok, find the file!"); while ((line = br.readLine()) != null) { boolean inWord = true; byte[] lineB = line.getBytes(); for (int i = 0; i < lineB.length; i++) { // is a character if ((lineB[i] < 91 && lineB[i] > 64) || (lineB[i] < 123 && lineB[i] > 96)) { wordB[wordBP] = lineB[i]; wordBP = wordBP + 1; inWord = true; } else if (inWord) { theWord = new String(wordB).trim().toLowerCase(); if (listMap.get(theWord) == null && theWord.length() > 1) { countArea.put(theWord, theWord); } wordBP = 0; inWord = false; wordB = new byte[30]; } } if (inWord) { theWord = new String(wordB).trim().toLowerCase(); if (listMap.get(theWord) == null && theWord.length() > 1) { countArea.put(theWord, theWord); } wordBP = 0; inWord = false; wordB = new byte[30]; } } // output Iterator<String> it = countArea.keySet().iterator(); while (it.hasNext()) { fw.write(it.next() + "\r\n"); } fw.close(); System.out.println("End count~"); System.out.println("Sum word of steve is :" + countArea.size()); } }
发表评论
-
MyLab
2015-11-23 12:35 367Server-0 OS:Oracle linux Softwa ... -
Learning
2015-03-23 13:43 314HighOAuth2.0Jira Confluence,G ... -
Eclipse 绘制草图的plugin
2013-02-20 15:52 778http://wireframesketcher.com/d ... -
My Environment
2013-01-22 16:19 771PC1-Server OS:RedHat Softwa ... -
话单匹配问题
2012-09-04 15:35 696需求是,有2套话单,每套中有2个字段为关联字段, 话单文件1 ... -
Senior Solution Architect(Systems)
2012-02-28 11:03 807努力方向. The Senior Solution Archi ... -
关于火车订票系统瓶颈的分析及解决方案
2012-01-09 09:12 2432需求描述 1.网站订票 2.身份证实名验证 思考 1.根据新 ... -
[疑问]关于NIO的耗时服务端业务逻辑问题????
2012-01-04 16:59 1660研究了一下NIO的非阻塞连接。。似乎有点问题。。 当服务端处理 ... -
[小代码]蜘蛛爬虫,抓取某网站所有图片文章中的图片~
2012-01-02 12:02 4442为朋友的网站写了个小代码,把所有图片下载到本地,有点不道德了, ... -
写了个小代码,统计史蒂夫乔布斯传英文版的单词数量
2011-12-11 15:58 842package com.ai; import java. ... -
软件项目版本号的命名规则及格式介绍
2011-01-12 10:19 915版本控制比较普遍 ... -
中文编码基础知识介绍
2009-01-22 15:30 905GB2312 范围: 0xA1A1 - 0xFEFE 汉字范围 ... -
软件架构
2008-12-26 16:03 897软件架构(software arch ... -
理解架构师
2008-12-26 15:35 954架构师应该精通分析和设计。架构师应该比常人容易理解事物的基本原 ... -
架构和架构设计师
2008-12-26 15:34 982系统架构通俗的说起来 ... -
构架师之路
2008-12-12 11:08 828胡德平◎《Java联盟》客栈论坛 构架师(Archit ... -
软件架构师成长之路
2008-12-12 11:07 957对于任何一个软件开发 ... -
某公司的技术能力
2008-11-23 11:36 902操作系统:Windows 2000/2003, Linux,S ... -
大型网站架构之:MySpace的体系架构
2008-10-26 01:31 1129MySpace.com有着6500万的订 ... -
IT网站
2008-10-02 23:24 950一、IT技术开发综合类 http://community ...
相关推荐
金山词霸除了单词查词功能,大家用得比较多的是金山词霸的生词本功能。 不可否认,金山词霸是个非常棒的英文单词查询工具,但其它功能还是有很多功能不完善。如生词本功能。 每一个人学单词时,学的顺序和内容都...
一个winform的小型软件,从有道词典的生词本中导出xml格式的单词本,然后转换为安卓手机的给力背单词软件的所需要的txt词库文件 技术特点: XmlTextReader读取xml,List泛型,生成txt文件 开发环境为Visual ...
有道词典单词表导出工具用于导出有道词典生词本中的单词表,输出为文本格式,可以整理打印出来,也可以作为词汇之沙我爱背单词,极速单词等背单词软件的词库使用。
英语水平一般,平时对生词都加入了生词本,5年积累了1300个高频词汇,但是没有最简单的,if,a,the,end,等,可下载bin结构,用于直接导入网易云词典
要求编程建立一个文本文件,每个单词不包含空格且不跨行,单词由字符序列构成且区分大小写;统计给定单词在文本文件中出现的总次数;检索输出某个单词出现在文本中的行号、在该行中出现的次数以及位置。该设计要求可...
给定文本文件“dict.txt”,该文件用于存储词库。词库为“英-汉”,“汉-英”双语词典,每个单词和其解释的格式固定。每个新单词由“#”开头,解释之间使用“@”隔开。一个词可能有多个解释,解释均存储在一行里,...
该文件主要用来实现将simulink数据字典中的parameter参数导出到excel中,以便全面了解simulink模型中各参数的标定值,便于分析模型;并可在导出的excel表格中记录更改参数的历史,并进行对比分析。将文件导入到...
用于python脚本字典
dict.txt文件英英字典
中文词典 NLP ,收录45159条中文词语,每行一个用 /n 隔开,方便拆分使用 哀怜 哀鸣 哀戚 ... 曝光 曝光表 曝露
《我从来不怕背单词》是一款专门帮您定做属于自己的生词本的软件,您可以在里面查询不懂的单词,然后系统会自动给出国际音标、翻译等信息,并储存在数据库中,生成生词本。以后您就可以把自己的生词本通过本系统强大...
10W+ 英语单词 TXT格式,已经整理好中英双语翻译。方便导入excel和word和数据库等文档
生词本是一个文件名为 filename.kirisame.pyword.json的数据文件,默认存放在 ./json目录下。 示例 样例输入 contradictory -a 样例输出 adj. 相互矛盾的,对立的;好反驳的,爱争辩的; n. 矛盾命题 与单词...
(自定义)单词词典dict.txt
自用的牛津词典的TXT文本文件, 可以使用sqlite3数据库的C语言接口, 轻松将其转换为数据库文件, 可用于实现电子词典小项目
c语言英语词典对应的英语单词文件 c语言英语词典对应的英语单词文件 c语言英语词典对应的英语单词文件 c语言英语词典对应的英语单词文件 c语言英语词典对应的英语单词文件 c语言英语词典对应的英语单词文件 c语言...
语言:English,中文 (简体) ...可以将有道词典或欧路词典导出的生词本中的单词高亮,在鼠标悬浮时显示出单词的意思和音标并将发音读出来,起到在阅读英文文档时加强记忆单词作用使用方法请参考此网站内容:...
有道词典可导入单词本,基础单词方便学习。直接导入即可使用。
在使用jiba分词的情况下,使用这个词典有助于提高你的分词准确度,因为这个分词词典包含了众多领域词汇,这些词汇出自某dog的几十个细胞词库。已使用转换器转换成txt,欢迎下载。
2、设计一个简单的词典类Dict,每个单词包括英文单词及对应的中文含义,并有一个英汉翻译成员函数,通过查词典的方式将一段英语翻译成对应的汉语 词典类Dict接口:add( )(添加单词)和trans( )(英汉翻译)成员函数...