python - 由字符而不是单词分隔的 IPython 小部件
问题描述
如下图所示,表格是由字符而不是完整的单词分隔的。
def apply(f):
text = f
text = re.sub(r'\W+', ' ', text)
res = LM().check_probabilities(text, topk=20)
l = str(res)
paraphrase_widget = widgets.SelectMultiple(
options=l,
description='Paraphrases',
disabled=False,
layout= widgets.Layout(width='100%')
)
display(paraphrase_widget)
return {"result": res}
apply("In order to")
解决方案
推荐阅读
- python-3.x - Python3测试文件夹导入问题
- hibernate - Hibernate 使用函数“GETDATE()”为 last_modified_date 保存实体
- javascript - 是否可以在子类 ES 2015 的实例中调用被覆盖的方法?
- c# - ClientBase 的默认值是多少
.ClientCredentials? - vb.net - 具有固定标题和列的 Gridview
- java - 使用 getter setter 初始化 List
- java - 如何从父类获取href?
- python - 如何用交替字符'“'和'”'(python)替换字符串中随机重复的字符'"'?
- python - 如何在类型提示中定义元组或列表的大小
- python - 正确的数据操作脚本布局,所有合并、删除、聚合、重命名都易于追踪和可见