Ajeet Singh Ajeet Singh - 27 days ago 14
Python Question

Is it possible to seperate a string into sentences using context?

Is it possible to seperate string to multiple sentences using NLP in python by string contexts.

Input:

string="Chinese people use social media called weibo in China it is the same as Twitter."

Output:


  • Chinese people use social media called weibo in China

  • it is the same as Twitter.



Or can we set the boundary of the sentences.

I have tried using tokenization, but using that I can only seperate string by punctuations, whitespace, blanklines etc.

Answer

Your example can be splitted in different places still giving a valid sentences.

string="Chinese people use social media called weibo in China it is the same as Twitter."
  • Chinese people use social media
  • Chinese people use social media called weibo.
  • Social media called weibo in China is the same as Twitter.
  • weibo in China is the same as Twitter
  • China is the same as Twitter

and so on ...

There's no one best split for given example so your algorithm should generate all valid possibilities.