Punctuation should demarcate word endings too.
This commit is contained in:
parent
cb9f067ff4
commit
00059194a5
|
@ -371,7 +371,7 @@ func WordCount(input string) (count int) {
|
|||
}
|
||||
var inSpace bool
|
||||
for _, value := range input {
|
||||
if unicode.IsSpace(value) {
|
||||
if unicode.IsSpace(value) || unicode.IsPunct(value) {
|
||||
if !inSpace {
|
||||
inSpace = true
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue