-
Notifications
You must be signed in to change notification settings - Fork 70
/
build.gradle
134 lines (103 loc) · 4.54 KB
/
build.gradle
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
apply plugin: 'java'
apply plugin: 'groovy'
apply plugin: 'eclipse'
String outDir = "build/hunspell"
version=new File("${projectDir}/../../VERSION").text.trim()
println "Version: $version"
repositories {
mavenCentral()
}
dependencies {
implementation group: 'org.apache.groovy', name: 'groovy', version: '4.0.+'
implementation group: 'org.apache.groovy', name: 'groovy-cli-picocli', version: '4.0.+'
implementation group: 'commons-cli', name: 'commons-cli', version: '1.4'
implementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.+'
}
sourceSets {
main {
java {
srcDir '../../src/main/java'
}
groovy {
srcDir 'src/main/groovy'
srcDir '../../src/main/groovy'
}
resources {
srcDir '../../src/main/resources'
srcDir 'src/main/resources'
}
}
}
processResources {
duplicatesStrategy = DuplicatesStrategy.WARN
}
task hunspell (type: JavaExec, dependsOn: classes) {
outputs.files "$outDir/uk_UA.aff", "$outDir/uk_UA.dic"
doFirst {
new File(outDir).mkdirs()
}
classpath = sourceSets.main.runtimeClasspath
mainClass = "Hunspell"
}
task hunspellZip (type: Zip, dependsOn: hunspell) {
from "$outDir"
include 'uk_UA.aff'
include 'uk_UA.dic'
archiveFileName = "hunspell-uk_UA_${project.version}.zip"
destinationDirectory = file("$outDir")
}
task hunspellFull (type: JavaExec, dependsOn: classes) {
outputs.files "$outDir/uk_UA.aff", "$outDir/uk_UA.dic"
doFirst {
new File(outDir).mkdirs()
}
classpath = sourceSets.main.runtimeClasspath
mainClass = "Hunspell"
args "-forSearch"
}
task testHunspellGood(type: Exec) { //, dependsOn: hunspell) {
def txt = "головатого білого білолицьому ницого"
txt += " швидко вже"
txt += " хата хатами дами вимені воріт Карпат кайданів вовчища селом сіл агрошкіл автовізка"
txt += " карбованця авантюрнице авантюрницею"
txt += " абонував абортує гуляв хропу сядете живемо абонуватиму жнеш вечоріло"
txt += " абонувавши абонуючи хроплячи"
txt += " заправлено казано вимито метено введено"
txt += " обікрав вжену уженіться"
txt += " Абакумовича Абакумівни Абакума"
txt += " Білгород-Дністровського Захер-Мазоха Захера-Мазоха"
txt += " відіб\\'ю"
txt += " всього усього"
txt += " більш найменш перш" // якнайскоріш
txt += " кури курей гуси гусей"
def cmd = "echo $txt | hunspell -d $outDir/uk_UA | grep -E '^&'" + '; [ $? == 1 ]'
commandLine "sh", "-c", "${cmd}"
}
task testHunspellBad (type: Exec) { //, dependsOn: hunspell) {
def txt = " кккк білолицого пілі відб\\'ю бльо хер"
txt += " увсього визначіть вимажіть підем"
txt += " ніштяк гарная пірвати стріляючий февдалізм"
// txt += " сміючися певніш"
def cmd = "echo $txt | hunspell -d $outDir/uk_UA | grep -E '^(\\+|\\*)'" + '; [ $? == 1 ]'
commandLine "sh", "-c", "${cmd}"
}
task testHunspell(dependsOn: [testHunspellGood, testHunspellBad]) {
}
task testHunspellFull(type: Exec) { //, dependsOn: hunspell) {
def txt = "добрії алярм головуючий абонуєм розженем всії даючися"
txt += " раніш гірш"
def cmd = "echo $txt | hunspell -d $outDir/_full/uk_UA | grep -E '^&'" + '; [ $? == 1 ]'
commandLine "sh", "-c", "${cmd}"
}
task getSpellWords (type: Exec) {
inputs.files "${projectDir}/../../out/dict_corp_lt.txt"
outputs.files "${projectDir}/build/words_spell.txt"
def cmd = "grep -vE \"noun:inanim:.:v_kly|(:inf|:3).*:short|:2:long|advp.*long|adv.*:short|adj.*:long|:(bad|subst|alt|arch|slang|vulg|obsc|rare)|[.'] \""
cmd += " ${projectDir}/../../out/dict_corp_lt.txt | cut -d ' ' -f 1 | sort -u > ${projectDir}/build/words_spell.txt"
commandLine "sh", "-c", "${cmd}"
}
task testHunspellDirect (type: Exec) {
dependsOn 'getSpellWords', "hunspell"
def cmd = "hunspell -d $outDir/uk_UA -l ${projectDir}/build/words_spell.txt | grep -vE \"^'\" > hunspell.unknown.txt; wc -l hunspell.unknown.txt"
commandLine "sh", "-c", "${cmd}"
}