【发布时间】:2019-07-22 04:07:44
【问题描述】:
我有三组文本块(实际上更多...),它们显示了完整文本的一部分。然而,由于一些句子在两个文本块之间分割,原始文本的划分没有正确完成。
text1 = {"We will talk about data about model specification parameter \
estimation and model application and the context where we will apply \
the simple example.Is an application where we would like to analyze \
the market for electric cars because"};
text2 = {"we are interested in the market of electric cars.The choice \
that we are interested in is the choice of each individual to \
purchase an electric car or not And we will see how"};
text3 = {"to address this question. Furthermore, it needs to be noted that this is only a model text and there is no content associated with it. "};
例如text2 以“我们对电动汽车市场感兴趣”开头。这是一个不完整的第一句,实际上是从文本块 1 开始的(见最后一句)。
我想确保每个文本块都以完整的句子结尾。所以我想将不完整的第一句话移到最后一个文本块。例如这里的结果是:
text1corr = {"We will talk about data about model specification parameter \
estimation and model application and the context where we will apply \
the simple example.Is an application where we would like to analyze \
the market for electric cars because we are interested in the market of electric cars."};
text2corr = {"The choice that we are interested in is the choice of each individual to purchase an electric car or not And we will see how to address this question."};
text3corr = {"Furthermore, it needs to be noted that this is only a model text and there is no content associated with it. "};
如何在 Python 中做到这一点?这甚至可能吗?
【问题讨论】:
-
句号是否表示句尾?
-
@paradox 确实如此。