-
Notifications
You must be signed in to change notification settings - Fork 55
Expand file tree
/
Copy pathRebuild_formation.java
More file actions
43 lines (33 loc) · 1.13 KB
/
Copy pathRebuild_formation.java
File metadata and controls
43 lines (33 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package test.Examples;
import com.knziha.plod.dictionary.mdict;
import com.knziha.plod.dictionaryBuilder.mdictBuilder;
import java.io.IOException;
/**
* TEsts
* @author KnIfER
* @date 2019/10/25
*/
public class Rebuild_formation {
static int d=0;
public static void main(String[] args) throws IOException{
mdictBuilder mdxDB = new mdictBuilder("GoldenDict Hunspell en_US构词法规则库","converted by mdict-java builder to reduce entries of unwanted formation rules","UTF-16");
mdict mraw = new mdict("D:\\assets\\mdicts\\构词法\\白鸽英语构词法.mdx");
for(int i=0;i<100;i++) {
String key = mraw.getEntryAt(i).trim();
String record = mraw.getRecordAt(i).trim();
if(startWith(record, key)){
mdxDB.insert(key, record);
}
}
//mdxDB.setCompressionType(2);
mdxDB.write("D:\\assets\\mdicts\\构词法\\精简白鸽英语构词法.mdx");
}
private static boolean startWith(String record, String key) {
if(record.length()>=2 && key.length()>=2){
if(record.substring(0,2).equalsIgnoreCase(key.substring(0,2))){
return true;
}
}
return false;
}
}