Skip to content

Commit

Permalink
Fix a bug for tokenize for place recognize. (#1165)
Browse files Browse the repository at this point in the history
  • Loading branch information
Spaceenter authored Jun 16, 2023
1 parent e5cb640 commit f0b1196
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/server/recon/recognize.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ func tokenize(query string) []string {
if string(partBySpace[0]) == "," {
tokens = append(tokens, ",")
partBySpace = partBySpace[1:]
if partBySpace == "" {
continue
}
}

// Check suffix.
Expand Down
4 changes: 4 additions & 0 deletions internal/server/recon/recognize_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ func TestTokenize(t *testing.T) {
" alpha ,beta,Gamma, delta eta",
[]string{"alpha", ",", "beta", ",", "Gamma", ",", "delta", "eta"},
},
{
"alpha , beta,Gamma",
[]string{"alpha", ",", "beta", ",", "Gamma"},
},
} {
got := tokenize(c.query)
if diff := cmp.Diff(got, c.want); diff != "" {
Expand Down

0 comments on commit f0b1196

Please sign in to comment.