一直喜欢看些英语方面的东西,提高词汇量自然是必不可少的。但是每天捧着单词书实在是不大方便,倒不如直接在手机上装个背单词的小软件,有空的时候就背几个,并且手机软件功能又多,又有艾宾浩斯什么这那的东西,相信比单纯看书效果要好。于是我就下了几个背单词的软件,什么拓词,地铁背单词,给力背单词。。。但是都不尽如人意。
我概念中的背单词软件应该是这样的,首先要将词汇按优先级来排序,比如最重要的使用频度,毕竟是要学以致用的。然后要按照学习计划进行分组,按组学习。对于每一个新单词,要有单词,词性,音标和最常用的例句跟解释几种元素,如果能有词根词源什么的就更好了。然后每天的学习过程中要按照记忆规律穿插进一些以前学过的旧单词,考核的方式可以给出任意几种元素,不要总是给单词选解释,也可以通过读音选解释,通过例句选解释,通过解释选单词等等,这样才能避免模式记忆,将单词真正融会贯通。
这件事情单靠单词书效果没用用软件来的明显,但是我试的这几款软件(还有其他好多),要不就考核模式单一要不就是需要联网,给力背单词还不错,但是不错就要收费。。总要付出代价的。。。
我后来分析一下,如果只重功能,拨出其他花哨的东西,要自制一个背单词小软件也是很简单的。
首先我在网上搜索了词库,找到一篇《俞敏洪托福词汇》,txt的,里面格式大体固定,有单词,解释和例句,现在只要分析格式,按一定规则重新生成词汇文件供安卓软件使用就可以了。以后还可以再找词根版的词汇文件,进一步丰富词汇库,真正实现自己定制,想添啥就添啥。。。。
这个txt的解析代码如下
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
public class Main {
static int lineNo = 0;
static BufferedReader br = null;
static String[] cixing = { "vi.", "vt.", "adj.", "n.", "adv.", "v.",
"int.", "pl." };
static boolean waitingChineseSentence = false;
static ArrayList<String> words = new ArrayList<String>();
static ArrayList<String> interpretation = new ArrayList<String>();
static ArrayList<String> sentence = new ArrayList<String>();
public static String getLine() {
String line = "";
while (true) {
try {
line = br.readLine();
lineNo++;
} catch (IOException e) {
e.printStackTrace();
System.out.println("error in " + lineNo + "line");
return null;
}
if (line == null) {
return null;
}
line = line.trim();
if (line.equals("")) {
continue;
} else {
break;
}
}
return line;
}
public static boolean isChineseAppending(String str){
String _str = str.trim();
String[] strs = _str.split(" ");
return strs.length==1&&(!isEnglish(_str));
}
public static boolean isEnglish(String str) {
if (str == null)
return false;
for (int i = 0; i < str.length(); i++) {
if (str.charAt(i) < 0 || str.charAt(i) > 127)
return false;
}
return true;
}
public static boolean isInterpretation(String str) {
String compareStr;
if(str.length()<7){
compareStr = str;
}else{
compareStr = str.substring(0, 7);
}
for (int i = 0; i < cixing.length; i++) {
if (compareStr.contains(cixing[i]))
return true;
}
return false;
}
public static void main(String[] args) {
File file = new File("res/vocabulary.txt");
try {
br = new BufferedReader(new FileReader(file));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
if (br == null)
return;
String line = getLine();
while (true) {
if (line == null) {
break;
}
StringBuffer interpreteStr = new StringBuffer();
String[] strs = line.split(" ");
words.add(strs[0]);
for (int i = 1; i < strs.length; i++) {
if(strs[i].trim().equals(""))
continue;
interpreteStr.append(strs[i].trim()+"\n");
}
while(true){
line = getLine();
if(line == null)
break;
if(isInterpretation(line)){
interpreteStr.append(line.trim()+"\n");
}else{
break;
}
}
interpretation.add(interpreteStr.toString());
StringBuffer sentenceStr = new StringBuffer();
while(true){
if(line == null)
break;
if(isChineseAppending(line)){
sentenceStr.append(line.trim()+"\n");
line = getLine();
}
strs = line.split(" ");
boolean isSentence=false;
for(int i=1;i<strs.length;i++){
if(strs[i].trim().equals(""))
continue;
if(isEnglish(strs[i])){
isSentence=true;
break;
}else{
break;
}
}
if(!isSentence){
break;
}else{
sentenceStr.append(line.trim());
if(isEnglish(strs[strs.length-1])){
line = getLine();
if(line==null){
break;
}else{
sentenceStr.append(line.trim());
}
}
sentenceStr.append("\n");
line = getLine();
}
}
sentence.add(sentenceStr.toString());
}
try {
br.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
File writeFile = new File("res/new.txt");
if(!writeFile.exists()){
try {
writeFile.createNewFile();
} catch (IOException e) {
e.printStackTrace();
return;
}
}
PrintWriter pw=null;
try {
pw = new PrintWriter(new FileWriter(writeFile));
} catch (IOException e) {
e.printStackTrace();
return;
}
if(pw!=null){
for(int i=0;i<words.size();i++){
pw.println(words.get(i));
pw.print(interpretation.get(i));
pw.print(sentence.get(i));
}
}
pw.flush();
pw.close();
}
}
没注重什么格式,写的比较粗略。。。
下一步就是做出背单词的软件,把这个词汇库用上去,在接下来就是完善一下细节~