-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated options + added a new option for ignoring runes
- Loading branch information
1 parent
d3e67b1
commit 5389ccb
Showing
6 changed files
with
70 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,29 @@ | ||
package words | ||
|
||
type config struct { | ||
includeSymbols bool | ||
includePunctuation bool | ||
includeSpaces bool | ||
includeSymbols bool | ||
includePunctuation bool | ||
includeSpaces bool | ||
allowHyphenatedWords bool | ||
ignoredRunes []rune | ||
} | ||
|
||
// newDefaultConfig defines the standards | ||
// of the word extractor | ||
func newDefaultConfig() *config { | ||
return &config{ | ||
includeSymbols: false, | ||
includePunctuation: false, | ||
includeSpaces: false, | ||
includeSymbols: false, | ||
includePunctuation: false, | ||
includeSpaces: false, | ||
allowHyphenatedWords: false, | ||
ignoredRunes: make([]rune, 0), | ||
} | ||
} | ||
|
||
// apply applies all the options to the | ||
// current config | ||
func (c *config) apply(options ...Option) { | ||
for _, opt := range options { | ||
opt.apply(c) | ||
opt(c) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
module github.com/imbue11235/words | ||
|
||
go 1.16 | ||
go 1.18 | ||
|
||
require golang.org/x/exp v0.0.0-20220613132600-b0d781184e0d // indirect |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
golang.org/x/exp v0.0.0-20220613132600-b0d781184e0d h1:vtUKgx8dahOomfFzLREU8nSv25YHnTgLBn4rDnWZdU0= | ||
golang.org/x/exp v0.0.0-20220613132600-b0d781184e0d/go.mod h1:Kr81I6Kryrl9sr8s2FK3vxD90NdsKWRuOIl2O4CvYbA= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters