用Java来写有道词典,需要哪些知识

Python015

用Java来写有道词典,需要哪些知识,第1张

1.首先,你要确定你要开发什么样的软件,是PC端的,还是移动端的。

2.如果是PC端的,那么你要确定是Windows的,还是Mac OS的,或者是Linux的。前两者可能性最大。windows 的去学C#和Qt还有MFC,你现在掌握的C和C++肯定是不够的。Mac OS 去学Objective-C和Cocoa库/框架。

3.如果是移动端,你最容易的还是区别一下Android和IOS的。Android去学Java和Android对应的知识,比如去看第一行代码,对Android 有一个初步认识。IOS的话刚开始对C要求不高,你就先去学Objective-C。

4.可以查词的话你还的去学学算法,例如倒排索引,bfs,dfs等,刚开始可以直接上框架(可以了解一下solr和lucene),然后还得有词库。

*******************************************************************

假如InputDictionary.txt文件放在D盘根目录下,新建类Dictionary.java,代码如下:

*******************************************************************

import java.io.BufferedReader

import java.io.BufferedWriter

import java.io.FileReader

import java.io.FileWriter

public class Dictionary {

public static void main(String[] args) throws Exception {

BufferedReader br = new BufferedReader(new FileReader(

"d:\\InputDictionary.txt"))

BufferedWriter bw = new BufferedWriter(new FileWriter(

"d:\\OutputDictionary.txt"))

String input, output

while ((input = br.readLine()) != null) {

output = input.replaceAll(" +", "\t")

bw.append(output)

bw.newLine()

}

bw.flush()

bw.close()

br.close()

System.out.println("Success!")

}

}

*******************************************************************