Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit58dda5d

Browse files
author
nickg
committed
updates
1 parenteca0592 commit58dda5d

File tree

7 files changed

+36
-54
lines changed

7 files changed

+36
-54
lines changed

‎genwords/additions.go‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@ func dictAdditions() map[string]string {
77

88
// arent
99
varadditions=`
10+
satisy->satisfy
11+
suport->support
12+
properies->properties
13+
instanciate->instantiate
1014
memoery->memory
15+
memorie->memory
1116
deinitalization->deinitialization
1217
deinitalize->deinitialize
1318
deinitalized->deinitialized

‎genwords/american.go‎

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
package main
22

3+
import (
4+
"strings"
5+
)
6+
37
// dictBritish inverts the basic American word list
48
// and then makes additional corrections
59
//
@@ -12,13 +16,12 @@ func dictBritish() map[string]string {
1216
dict[v]=k
1317
}
1418

15-
needCaseDelete:= []string{
16-
"Anglicize",
17-
"Caroling",
18-
"Savior",
19-
}
20-
2119
needDelete:= []string{
20+
"honorable",
21+
"caroling",
22+
"savior",
23+
"fetal",
24+
"anglicize",
2225
"install",
2326
"installs",
2427
"instal",
@@ -176,25 +179,18 @@ func dictBritish() map[string]string {
176179
delete(dict,word)
177180
}
178181

179-
dict=expandCase(dict)
180-
181-
for_,word:=rangeneedCaseDelete {
182-
removeCase(dict,word)
183-
}
184-
185182
returndict
186183
}
187184

188185
funcdictAmerican()map[string]string {
189-
needCaseDelete:= []string{
186+
needDelete:= []string{
190187
"Armour",
191188
"Bannister",
192189
"Louvre",
193190
}
194191
dict:=parseWikipediaFormat(american)
195-
dict=expandCase(dict)
196-
for_,word:=rangeneedCaseDelete {
197-
removeCase(dict,word)
192+
for_,word:=rangeneedDelete {
193+
delete(dict,strings.ToLower(word))
198194
}
199195

200196
returndict

‎genwords/dictWikipediaArticles.go‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package main
22

33
funcdictWikipediaArticles()map[string]string {
44
dict:=parseWikipediaFormat(additionsWikipediaArticles)
5-
dict=expandCase(dict)
65
returndict
76
}
87

‎genwords/main.go‎

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ import (
77
"os"
88
"sort"
99
"strings"
10-
11-
"github.com/client9/misspell"
1210
)
1311

1412
funcaddOrPanic(dictmap[string]string,key,valuestring) {
@@ -40,31 +38,11 @@ func mergeDict(a, b map[string]string) {
4038
}
4139
}
4240

43-
funcremoveCase(inmapmap[string]string,wordstring) {
44-
style:=misspell.CaseStyle(word)
45-
kcase:=misspell.CaseVariations(word,style)
46-
fori:=0;i<len(kcase);i++ {
47-
delete(inmap,kcase[i])
48-
}
49-
}
50-
funcexpandCase(inmapmap[string]string)map[string]string {
51-
out:=make(map[string]string,len(inmap)*3)
52-
fork,v:=rangeinmap {
53-
style:=misspell.CaseStyle(k)
54-
kcase:=misspell.CaseVariations(k,style)
55-
vcase:=misspell.CaseVariations(v,style)
56-
fori:=0;i<len(kcase);i++ {
57-
addOrPanic(out,kcase[i],vcase[i])
58-
}
59-
}
60-
returnout
61-
}
62-
6341
funcparseWikipediaFormat(textstring)map[string]string {
6442
lines:=strings.Split(strings.TrimSpace(text),"\n")
6543
dict:=make(map[string]string,len(lines))
6644
for_,line:=rangelines {
67-
line=strings.TrimSpace(line)
45+
line=strings.ToLower(strings.TrimSpace(line))
6846
parts:=strings.Split(line,"->")
6947
iflen(parts)!=2 {
7048
log.Fatalf(fmt.Sprintf("failed parsing %q",line))
@@ -97,6 +75,12 @@ func main() {
9775
deferfo.Close()
9876
fo.WriteString("package misspell\n\n")
9977

78+
// standard for machine generated files
79+
// https://github.com/golang/go/issues/13560
80+
// https://godoc.org/github.com/shurcooL/go/generated
81+
// `^// Code generated .* DO NOT EDIT\.$`
82+
fo.WriteString("// Code generated automatically. DO NOT EDIT.\n\n")
83+
10084
// create main word list
10185
dict:=make(map[string]string)
10286
mergeDict(dict,dictWikipedia())

‎genwords/reddit.go‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package main
22

33
func dictReddit() map[string]string {
44
dict := parseWikipediaFormat(additionsReddit)
5-
dict = expandCase(dict)
65
return dict
76
}
87

@@ -7642,7 +7641,6 @@ dribbel->dribble
76427641
driectx->directx
76437642
drifitng->drifting
76447643
driftig->drifting
7645-
drinkeries->drinkers
76467644
drinkes->drinkers
76477645
driveris->drivers
76487646
drotmund->dortmund
@@ -13999,7 +13997,7 @@ meltodwn->meltdown
1399913997
membrance->membrane
1400013998
membrances->membrane
1400113999
memerization->memorization
14002-
memorie->memorize
14000+
memorie->memory
1400314001
memoriez->memorize
1400414002
memorizacion->memorization
1400514003
memorozation->memorization

‎genwords/wikipedia.go‎

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ func dictWikipedia() map[string]string {
1919
delete(dict,"knifes")
2020
delete(dict,"humer")
2121
delete(dict,"convertor")
22-
delete(dict,"Capetown")
22+
delete(dict,"capetown")
2323
delete(dict,"diaster")
24-
delete(dict,"Muhammadan")
24+
delete(dict,"muhammadan")
2525
delete(dict,"slippy")
2626
delete(dict,"specif")// abbreviation
2727
delete(dict,"florescent")// a word: https://en.wiktionary.org/wiki/florescent
@@ -37,9 +37,9 @@ func dictWikipedia() map[string]string {
3737
delete(dict,"miliary")
3838
delete(dict,"nickle")
3939
delete(dict,"lightyear")
40-
delete(dict,"Sionist")
41-
delete(dict,"Sionists")
42-
delete(dict,"Foundland")
40+
delete(dict,"sionist")
41+
delete(dict,"sionists")
42+
delete(dict,"foundland")
4343
delete(dict,"holliday")// surname
4444
// Corrections
4545
delete(dict,"fiel")
@@ -53,7 +53,7 @@ func dictWikipedia() map[string]string {
5353
"mear",// too small
5454
"larg",// too small, similar to "L-arg"
5555
"dum",// too small
56-
"Malcom",// https://en.wikipedia.org/wiki/Malcom_McLean
56+
"malcom",// https://en.wikipedia.org/wiki/Malcom_McLean
5757
"toke",
5858
"moil",
5959
"lsat",
@@ -120,24 +120,23 @@ func dictWikipedia() map[string]string {
120120
}
121121

122122
for_,word:=rangeneedDelete {
123-
delete(dict,word)
123+
delete(dict,strings.ToLower(word))
124124
}
125125

126126
// delete any contractions
127127
forwrong,right:=rangedict {
128128
ifstrings.Contains(wrong,"'")||strings.Contains(right,"'") {
129-
delete(dict,wrong)
129+
delete(dict,strings.ToLower(wrong))
130130
}
131131
}
132132

133133
// delete any multi word corrections
134134
forwrong,right:=rangedict {
135135
ifstrings.Contains(right," ") {
136-
delete(dict,wrong)
136+
delete(dict,strings.ToLower(wrong))
137137
}
138138
}
139139

140-
dict=expandCase(dict)
141140
returndict
142141
}
143142

‎sources/reddit/findtypo.go‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,8 +436,9 @@ var badWord = map[string]bool{
436436
}
437437

438438
varbadTypo=map[string]bool{
439+
"memorie":true,// get corrected to "memorize"
439440
"convertors":true,// real word
440-
"functionallity":true,// getcorrecteds to wrong word
441+
"functionallity":true,// getcorrected to wrong word
441442
"implementational":true,// real word
442443
"perceptron":true,// real word
443444
"perceptrons":true,// real word

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp