Closed sudiptob2 closed 2 years ago
since MD is a common first name, may be we can use both indexes (0 and 1) instead of just 0th index. we can treat it as a special case and create a dedicated method to handle slicing when 0th index has string "MD". I would be happy to add this logic. Let me know your thoughts @sudiptob2
Thanks much for looking into the issue :pray:
I am thinking about a more generalized approach. If the given string
is larger than the max_len
we can generate the sliced string incrementally. I think that will be more resilient
I am thinking about something like
string = string.split()
for token in string:
if len(token ) + len(res) < max_len:
res += token
return res
What do you think about this approach? @csemanish12
Looks good enough to me. @sudiptob2
Great :rocket: Please also take care of the spaces between tokens while doing res += token
.
There are names such as
MD Abdul Rahman Talukder
. These names will be converted intoMD
by the slicer. We need to update the slicer so that it can slice the name in a more readable manner.