Skip to content

Commit 21b698c

Browse files
committed
fixing markdown issues
1 parent 92cd01a commit 21b698c

File tree

1 file changed

+62
-62
lines changed

1 file changed

+62
-62
lines changed

README.md

Lines changed: 62 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,86 @@
11
# spell
22

3-
[![GoDoc](https://godoc.org/github.com/eskriett/spell?status.svg)](https://godoc.org/github.com/eskriett/spell)
3+
[![GoDoc](https://godoc.org/github.com/eskriett/spell?status.svg)](https://godoc.org/github.com/eskriett/spell)
44
[![Go Report Card](https://goreportcard.com/badge/github.com/eskriett/spell)](https://goreportcard.com/report/github.com/eskriett/spell)
55

66
A blazing fast spell checker written in Go.
77

88
__N.B.__ This library is still in early development and may change.
99

10-
# Overview
10+
## Overview
1111

1212
```go
1313
package main
1414

1515
import (
16-
"fmt"
16+
"fmt"
1717

18-
"github.com/eskriett/spell"
18+
"github.com/eskriett/spell"
1919
)
2020

2121
func main() {
2222

23-
// Create a new instance of spell
24-
s := spell.New()
25-
26-
// Add words to the dictionary. Words require a frequency, but can have
27-
// other arbitrary metadata associated with them
28-
s.AddEntry(spell.Entry{
29-
Word: "two",
30-
WordData: spell.WordData{
31-
"frequency": 100,
32-
"type": "number",
33-
},
34-
})
35-
s.AddEntry(spell.Entry{
36-
Word: "town",
37-
WordData: spell.WordData{
38-
"frequency": 10,
39-
"type": "noun",
40-
},
41-
})
42-
43-
// Lookup a misspelling, by default the "best" suggestion will be returned
44-
suggestions, _ := s.Lookup("twon")
45-
fmt.Printf("%v\n", suggestions)
46-
// -> [two]
47-
48-
// Get metadata from the suggestion
49-
suggestion := suggestions[0]
50-
fmt.Printf("%v\n", suggestion.WordData["type"])
51-
// -> number
52-
53-
// Get multiple suggestions during lookup
54-
suggestions, _ = s.Lookup("twon", spell.SuggestionLevel(spell.LevelAll))
55-
fmt.Printf("%v\n", suggestions)
56-
// -> [two, town]
57-
58-
// Save the dictionary
59-
s.Save("dict.spell")
60-
61-
// Load the dictionary
62-
s2, _ := spell.Load("dict.spell")
63-
64-
suggestions, _ = s2.Lookup("twon", spell.SuggestionLevel(spell.LevelAll))
65-
fmt.Printf("%v\n", suggestions)
66-
// -> [two, town]
67-
68-
// Spell supports word segmentation
69-
s3 := spell.New()
70-
71-
wd := spell.WordData{"frequency": 1}
72-
s3.AddEntry(spell.Entry{Word: "the", WordData: wd})
73-
s3.AddEntry(spell.Entry{Word: "quick", WordData: wd})
74-
s3.AddEntry(spell.Entry{Word: "brown", WordData: wd})
75-
s3.AddEntry(spell.Entry{Word: "fox", WordData: wd})
76-
77-
segmentResult, _ := s3.Segment("thequickbrownfox")
78-
fmt.Println(segmentResult)
79-
// -> the quick brown fox
23+
// Create a new instance of spell
24+
s := spell.New()
25+
26+
// Add words to the dictionary. Words require a frequency, but can have
27+
// other arbitrary metadata associated with them
28+
s.AddEntry(spell.Entry{
29+
Word: "two",
30+
WordData: spell.WordData{
31+
"frequency": 100,
32+
"type": "number",
33+
},
34+
})
35+
s.AddEntry(spell.Entry{
36+
Word: "town",
37+
WordData: spell.WordData{
38+
"frequency": 10,
39+
"type": "noun",
40+
},
41+
})
42+
43+
// Lookup a misspelling, by default the "best" suggestion will be returned
44+
suggestions, _ := s.Lookup("twon")
45+
fmt.Printf("%v\n", suggestions)
46+
// -> [two]
47+
48+
// Get metadata from the suggestion
49+
suggestion := suggestions[0]
50+
fmt.Printf("%v\n", suggestion.WordData["type"])
51+
// -> number
52+
53+
// Get multiple suggestions during lookup
54+
suggestions, _ = s.Lookup("twon", spell.SuggestionLevel(spell.LevelAll))
55+
fmt.Printf("%v\n", suggestions)
56+
// -> [two, town]
57+
58+
// Save the dictionary
59+
s.Save("dict.spell")
60+
61+
// Load the dictionary
62+
s2, _ := spell.Load("dict.spell")
63+
64+
suggestions, _ = s2.Lookup("twon", spell.SuggestionLevel(spell.LevelAll))
65+
fmt.Printf("%v\n", suggestions)
66+
// -> [two, town]
67+
68+
// Spell supports word segmentation
69+
s3 := spell.New()
70+
71+
wd := spell.WordData{"frequency": 1}
72+
s3.AddEntry(spell.Entry{Word: "the", WordData: wd})
73+
s3.AddEntry(spell.Entry{Word: "quick", WordData: wd})
74+
s3.AddEntry(spell.Entry{Word: "brown", WordData: wd})
75+
s3.AddEntry(spell.Entry{Word: "fox", WordData: wd})
76+
77+
segmentResult, _ := s3.Segment("thequickbrownfox")
78+
fmt.Println(segmentResult)
79+
// -> the quick brown fox
8080
}
8181
```
8282

83-
# Credits
83+
## Credits
8484

8585
Spell makes use of a symmetric delete algorithm and is loosely based on the
8686
[SymSpell](https://github.com/wolfgarbe/SymSpell) implementation.

0 commit comments

Comments
 (0)