diff --git a/govarnam/channel.go b/govarnam/channel.go index 59b35c2..9d4e855 100644 --- a/govarnam/channel.go +++ b/govarnam/channel.go @@ -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() diff --git a/govarnam/govarnam_ml_test.go b/govarnam/govarnam_ml_test.go index d57f23c..d6c1370 100644 --- a/govarnam/govarnam_ml_test.go +++ b/govarnam/govarnam_ml_test.go @@ -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, "ആലിപ്പഴം") }