SemanticOwl + LangOwl open-core
Project description
pipowl 🦉
Open Semantic Tools for Python
pipowl: 目標:快速、穩定的 embedding 相似度工具
v1.6.0
pipowl 提供:
SemanticOwl
輕量語意編碼器(使用 SentenceTransformer)
LangOwl
語意搜尋(top-k + cosine similarity)
安裝
pip install pipowl
使用方式
① 叫出 LangOwl(像叫一隻貓頭鷹出來)
from pipowl.lang import LangOwl
lang = LangOwl()
② 準備一些要比對的句子清單
corpus = [
"我今天真的好累",
"我覺得今天狀態不太好",
"今天的天氣真的很好",
]
③ 丟一句話進去,看哪句最像
results = lang.topk("我今天真的很想睡覺,因為工作太累了", corpus)
④ 印出結果(分數+句子)
for text, score in results:
print(score, text)
總結
pipowl 是一個用來「比較句子語意相似度」的小工具。
你只要給它兩個東西:
你的句子(要查的)
你的一組句子(要比的)
它就會告訴你「哪一句最像」。
輸出示例
0.903 我今天真的好累
0.882 我覺得今天狀態不太好
0.834 今天的天氣真的很好
快速試用(Quickstart)
quickstart.py
- py -m quickstart
from pipowl.lang import LangOwl
# 叫出語意偵探 LangOwl
lang = LangOwl()
# 準備一組你想比較的句子清單
corpus = [
"我今天真的好累",
"我覺得今天狀態不太好",
"今天的天氣真的很好",
]
# 互動式輸入
while True:
query = input("請輸入句子: ")
results = lang.topk(query, corpus)
print("\n相似結果:")
for text, score in results:
print(f"{score:.3f} | {text}")
print()
minimal.py
from pipowl.lang import LangOwl
lang = LangOwl()
results = lang.topk("我很累", ["我好累", "我想吃飯"])
print(results)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pipowl-1.6.0.tar.gz
(8.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pipowl-1.6.0.tar.gz.
File metadata
- Download URL: pipowl-1.6.0.tar.gz
- Upload date:
- Size: 8.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
29c61a33177e47e3f33ee4bbbe2032c67875710f088493dc1c9a8fdb33613e71
|
|
| MD5 |
11e30486386b12862d6949ba300822e1
|
|
| BLAKE2b-256 |
9202850766c2d75a8b291b23237f29a6f808261812a36d51b032818c09e52658
|
File details
Details for the file pipowl-1.6.0-py3-none-any.whl.
File metadata
- Download URL: pipowl-1.6.0-py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a87f56efd90ef30018d74fe6e14929957d248add4ae2da925941533b29bd94c3
|
|
| MD5 |
97dd5c8cf8c4173138361eeb34e11a3d
|
|
| BLAKE2b-256 |
3097dfcbebf622bb750bfe2628b430f0f5835b9e307af028d8b813d6bfaa12d6
|