【发布时间】:2018-04-26 17:03:20
【问题描述】:
我正在尝试将附加句子列表加入到一个大的字符串文本对象中,以便我可以将其用作 Gensim 汇总模块的输入。但是,当我尝试这样做时,它说输入的句子小于 2。但是当我对文本运行拆分时,我看到多个句子,但它计算每个句子一次,而不是句子总数。而变量 r 是一个字符串类型的对象。我想将这些句子连接成一个大字符串,以便可以通过 Gensim 汇总模块读取。
示例代码:
import re
ruling_corpora = re.findall("\.?([^\.].\*?I find[^\.]*\. |[^\.]*$In sum[^\.]*\. |[^\.]*$agree[^\.]*\.)", tokenized, re.I |re.DOTALL |re.M)[1:-1]
for r in ruling_corpora:
print(type(r))
rc= ''.join(r)
print(summarize(rc))
样本输出:
raise ValueError("input must have more than one sentence")
ValueError: input must have more than one sentence
这是我想用 Gensim 总结器总结的输入示例。每个字符串下面的数字代表以句点结尾的句子的数量:
####Beginning of File### LUMB65.BL23607963.xml
Background Content: ANDERSON INITIAL DECISIONOn January 13, 2015, the appellant filed this appeal arguing that the agency's decision not to renew his term limited appointment which expired on January 28, 2015, is in error.
For the reasons discussed below, this appeal is DISMISSED for lack of jurisdiction without a hearing.
1
There is nothing in the agreement that curtails the agency's ability not to extend the term appointment.
IdIn reviewing the appellant's arguments, the appellant fails to establish that the Board has jurisdiction to review the agency's decision not to renew his time-limited appointment at issue in this appeal.
Following a review of the record evidence, I find that the appellant has failed to non-frivolously allege Board jurisdiction over this appeal on any basis.
Accordingly, this appeal must be dismissed for lack of jurisdiction.
1
####End of File### LUMB65.BL23607963.xml
【问题讨论】:
-
请修正你的缩进
标签: python regex list join gensim