【发布时间】:2021-01-26 11:19:11
【问题描述】:
假设我有一个段落:
Str_wrds ="Power curve, supplied by turbine manufacturers, are extensively used in condition monitoring, energy estimation, and improving operational efficiency. However, there is substantial uncertainty linked to power curve measurements as they usually take place only at hub height. Data-driven model accuracy is significantly affected by uncertainty. Therefore, an accurate estimation of uncertainty gives the confidence to wind farm operators for improving performance/condition monitoring and energy forecasting activities that are based on data-driven methods. The support vector machine (SVM) is a data-driven, machine learning approach, widely used in solving problems related to classification and regression. The uncertainty associated with models is quantified using confidence intervals (CIs), which are themselves estimated. This study proposes two approaches, namely, pointwise CIs and simultaneous CIs, to measure the uncertainty associated with an SVM-based power curve model. A radial basis function is taken as the kernel function to improve the accuracy of the SVM models. The proposed techniques are then verified by extensive 10 min average supervisory control and data acquisition (SCADA) data, obtained from pitch-controlled wind turbines. The results suggest that both proposed techniques are effective in measuring SVM power curve uncertainty, out of which, pointwise CIs are found to be the most accurate because they produce relatively smaller CIs."
并有以下test_wrds,
Test_wrds = ['Power curve', 'data-driven','wind turbines']
每当Test_wrds 在段落中找到它时,我想选择 1 个句子的前后,并将它们列为单独的字符串。例如,Test_wrds Power curve 出现在第一个句子中,但是当我们选择第二个句子时,还有另一个 Power curve 单词因此输出会是这样的
Power curve, supplied by turbine manufacturers, are extensively used in condition monitoring, energy estimation, and improving operational efficiency. However, there is substantial uncertainty linked to power curve measurements as they usually take place only at hub height. Therefore, an accurate estimation of uncertainty gives the confidence to wind farm operators for improving performance/condition monitoring and energy forecasting activities that are based on data-driven methods.
同样,我想为data-driven 和wind turbines 分割句子并将它们保存在单独的字符串中。
如何使用 Python 以简单的方式实现这一点?
到目前为止,我发现只要有任何Text_wrds 出现,基本上都会删除整个句子的代码。
def remove_sentence(Str_wrds , Test_wrds):
return ".".join((sentence for sentence in input.split(".")
if Test_wrds not in sentence))
但我不明白如何使用它来解决我的问题。
问题更新:基本上,每当段落中出现test_wrds 时,我想将该句子以及一个句子之前和之后切片并将其保存在单个字符串中。因此,例如对于三个text_wrds,我预计会得到三个字符串,它们基本上分别覆盖了带有text_wrds 的句子。我附上pdf,比如输出,我在找
【问题讨论】:
-
嗨,我不明白你说的这部分是什么意思。你能改写一下吗?谢谢“每当 Test_wrds 在段落中找到它时,我想在 1 个句子之前和之后选择它并将它们列为单独的字符串。例如,Test_wrds 功率曲线首先出现在第 1 个句子中,但是当我们选择第 2 个句子时,还有另一个功率曲线单词因此输出将类似于“
-
"Power curve, supplied by turbine manufacturers, are extensively used in condition monitoring, energy estimation, and improving operational efficiency. However, there is substantial uncertainty linked to power curve measurements as they usually take place only at hub height. Data-driven model accuracy is significantly affected by uncertainty.你的输出应该是这样的 -
您的意思是标记
spacy而不是scapy?
标签: python text nlp nltk scapy