Knowledge-graphs / utils.py
BertChristiaens's picture julien-c's picture
julien-c HF Staff
Duplicate from ml6team/Knowledge-graphs
1e72ee6
Raw History Blame Contribute Delete
218 Bytes
def clip_text(t, lenght = 4):
t_sub = t.replace("...", "dotdotdot")
t_clipped = ".".join(t_sub.split(".")[:lenght]) + "."
t_reverted = t_clipped.replace("dotdotdot", "...")
return t_reverted