Skip to content

Commit

Permalink
Ignore overly broad phonetic token in IndicPhone for better results.
Browse files Browse the repository at this point in the history
  • Loading branch information
knadh committed Dec 5, 2023
1 parent 9607367 commit 7d7bd6d
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions tokenizers/indicphone/indicphone.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,9 @@ func (ip *IndicPhone) ToQuery(s string, lang string) (string, error) {

tokens := slices.Compact([]string{key2, key1, key0})

switch len(tokens) {
case 1:
return tokens[0], nil
case 2:
return fmt.Sprintf("%s | %s ", tokens[0], tokens[1]), nil
case 3:
return fmt.Sprintf("%s | (%s & %s) ", key2, key1, key0), nil
if len(tokens) == 3 {
return fmt.Sprintf("%s | %s", key2, key1), nil
}

return key0, nil
return tokens[0], nil
}

0 comments on commit 7d7bd6d

Please sign in to comment.