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

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/包含点的排序数组   java如何在EJB项目中创建会话?   java JavaFX我切换了场景,但我不能再回来了   环境变量为java设置类路径时%classpath%的含义是什么   java如何使用Serenity BDD管理浏览器选项卡?   java如何创建一个。gwt中的war文件在eclipse中使用maven?   java使用java程序更新HTML文件   Java、SQLite、向数据库插入数据   java无法在RPi上安装JDK 16   在不进行反射的情况下调用动态java方法   如何在Ubuntu上安装Eclipse和Java SDK?   JavaSSHMySQL连接   在内存和性能方面,用Java每秒打印格式化日期+时间的最有效方法是什么?   java如何匹配映射返回类型的键和值?   java JUnit测试挂起在clientSocket上。接受()?   jbossweb中的java系统属性引用。服务器启动时未解析xml   java如何在set操作中使用arrayUnion   java 安卓。看法充气异常:二进制XML文件行#22