# 根据词林相似度算法匹配相似度最高的字符串
## 前置条件
    
    输入合法即可
    
## 处理逻辑

[文档](http://adm.sagacloud.cn:8080/doc/dev/data-center/relations/other/sim.html)
[git地址 : http://git.sagacloud.cn/chenhaiyang/sim](http://git.sagacloud.cn/chenhaiyang/sim)


# 函数

<details>
<summary>源码</summary>

```
CREATE OR REPLACE FUNCTION "public"."rel_cilin_str_similar"("word" varchar, "possibilities" _varchar, "num" int4)
  RETURNS "pg_catalog"."text" AS $BODY$

from sim.text_sim import most_similar_items

try:
    result = most_similar_items(word, possibilities, num)
    return result
except Exception as e:
    plpy.warning(e)
    return ""
else:
    plpy.warning(e)
$BODY$
  LANGUAGE plpython3u VOLATILE
  COST 100
```
</details>

## 输入
    1. word : 需要匹配的字符串
    2. possibilities : 被匹配的字符串
    3. num : 指定返回匹配到的字符串中相似度最高的num个字符串
## 返回结果
    
![rel_cilin_1](./img/rel_cilin-1.png)