【发布时间】:2020-06-27 09:08:31
【问题描述】:
要求是:
-
句子的开头必须是首字母大写的单词
( As, The, In)ONLY,句子的结尾应该是一个点。
例如:输入:
"This is a new book. I like to read this book"预期输出:
['This is a new book.' , 'I like to read this book'] -
但是,如果句末有引文,则应将其包含在句子中。在这种情况下,点可能在引用之后(或)在引用之前和之后。
例如:
输入:"This is a new book.(Steve and Rasol 2014). I like to read this book (Rashi & Shabana 2015)."
预期输出:['This is a new book.(Steve and Rasol 2014)' , 'I like to read this book (Rashi & Shabana 2015).']
【问题讨论】:
-
到目前为止你有什么尝试?
-
r'\w。 +(\w. +\d{4} ) ' - 这个模式对我有用。