Skip to content

Commit

Permalink
Fix breaking of character when a partial word from dictionary
Browse files Browse the repository at this point in the history
is combined to input having native language words, bugfix after #53
  • Loading branch information
subins2000 committed Nov 21, 2023
1 parent 8f08330 commit aa5022c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion govarnam/channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func (varnam *Varnam) channelGetFromDictionary(ctx context.Context, word string,

if len(dictResult.partialMatches) > 0 {
// Tokenize the word after the longest match found in dictionary
restOfWord := word[dictResult.longestMatchPosition+1:]
restOfWord := string([]rune(word)[dictResult.longestMatchPosition+1:])

start := time.Now()

Expand Down
1 change: 1 addition & 0 deletions govarnam/govarnam_ml_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -507,4 +507,5 @@ func TestMLNativePartialWordsInInput(t *testing.T) {

assertEqual(t, varnam.TransliterateAdvanced("ആലppu").DictionarySuggestions[0].Word, "ആലപ്പുഴ")
assertEqual(t, varnam.TransliterateAdvanced("puസ്ത").DictionarySuggestions[0].Word, "പുസ്തകം")
assertEqual(t, varnam.TransliterateAdvanced("ആലippazham").DictionarySuggestions[0].Word, "ആലിപ്പഴം")
}

0 comments on commit aa5022c

Please sign in to comment.