是否有一种正则表达式、python或javascript方法来搜索句点、单词和定义,然后将其附加到字典或其他对象
例如:
. Reversion: A reversion is turning back again to a previous state or condition. Rhetoric: Rhetoric is the skill or art of using language to persuade or influence people, especially language that sounds impressive but may not be sincere or honest.
这将成为{"Reversion" : "A reversion is turning back again to a previous state or condition", "Rhetoric" : "Rhetoric is the skill or art of using language to persuade or influence people, especially language that sounds impressive but may not be sincere or honest" }
请看下面的代码:
用于过滤单词的正则表达式,其定义为:
演示:https://regex101.com/r/utgrCb/1/
\.\s*
起始点和可选空格([^:]*)
“单词”是冒号之前的所有内容\s*:\s*
用可选空格包围的冒号([^.]*)
“定义”是最后一个点之前的一切我想使用reduce,但最终得到了这个