在较大字符串中查找最佳匹配字符串。

find-best-string的Python项目详细描述


查找最佳字符串

说明

在较大字符串中查找最佳匹配字符串。返回第一个匹配项或所有匹配项及其匹配值。

安装

pip install find-best-string

pipenv install find-best-string

参数

  1. 查询-在语料库中查找匹配项的文本字符串。
  2. corpus-要扫描查询匹配项的文本字符串。
  3. 通过语料库扫描第一个匹配值的步长。可以看作是一种“扫描分辨率”。不应超过查询的长度。
  4. flex-最大左/右子串位置调整值。不应超过查询的长度/2。
  5. 区分大小写-如果为false,则在fid匹配之前将语料库和查询转换为小写。

用法

fromfind_best_stringimportfind_best_stringcorpus="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum."query="Ipsum"first_match=find_best_string(query,corpus)

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java附加两个数组   java如何在Extjs的不同页面中使用相同的存储   java Jung,大顶点的布局重叠,图形出现在奇怪的位置   java如何在Android中通过画布绘制圆?   java验证库设计模式选择   java研磨机未知标记“timedTests”   java Android领域子类实例方法   java使用resteasy/jaxrs从请求负载接收两种类型的数据   缓冲策略Java缓冲策略有时不能正确绘制   java跟踪棋子   密度无关像素如何在java中锐化图像缩略图?   java如何在MongoDB更新查询中编写(或)更新   java A*寻路游戏系统退出问题   java在安卓中读取xml的最佳方式是什么?   通过反射调用的方法的java抑制警告   安卓 java。语言错误:信号11(SIGSEGV),代码10(?),故障地址006e006f   java lombok 1.18.2使用DexBuilderForDebug抛出TransformClasses   java JOptionPane CD对话框按钮?   java只返回json中的一些值,而不是完整实体对象   java包不存在错误,请稍后重试