SemanticOwl + LightOwl + LangOwl open-core
Project description
pipowl 🦉
Open Semantic Tools for Python
SemanticOwl + LightOwl + LangOwl Open-Core
pipowl 提供:
SemanticOwl
輕量語意編碼器(使用 SentenceTransformer)
LightOwl
文本清洗工具
LangOwl
語意搜尋(top-k + cosine similarity)
安裝
pip install pipowl
使用方式
① 叫出 LangOwl(像叫一隻貓頭鷹出來)
python
複製程式碼
from pipowl.lang import LangOwl
lang = LangOwl()
② 準備一些要比對的句子清單
python
複製程式碼
corpus = [
"我今天真的好累",
"我覺得今天狀態不太好",
"今天的天氣真的很好",
]
③ 丟一句話進去,看哪句最像
python
複製程式碼
results = lang.topk("我今天真的很想睡覺,因為工作太累了", corpus)
④ 印出結果(分數+句子)
python
複製程式碼
for text, score in results:
print(score, text)
總結
pipowl 是一個用來「比較句子語意相似度」的小工具。
你只要給它兩個東西:
你的句子(要查的)
你的一組句子(要比的)
它就會告訴你「哪一句最像」。
輸出示例
0.903 我今天真的好累
0.882 我覺得今天狀態不太好
0.834 今天的天氣真的很好
快速試用(Quickstart)
py -m quickstart
quickstart.py
from pipowl.lang import LangOwl
# 叫出語意偵探 LangOwl
lang = LangOwl()
# 準備一組你想比較的句子清單
corpus = [
"我今天真的好累",
"我覺得今天狀態不太好",
"今天的天氣真的很好",
]
print("模型載入完成!你可以開始輸入句子(Ctrl+C 結束)\n")
# 互動式輸入
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)
```bash
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.4.7.tar.gz
(9.3 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.4.7.tar.gz.
File metadata
- Download URL: pipowl-1.4.7.tar.gz
- Upload date:
- Size: 9.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8f33c88579b5f2f861b54cc9b4337d36af85cf384d7d4c712a6c3ba6efbc466f
|
|
| MD5 |
0f554fa53c4c870440c69d6f48b954ac
|
|
| BLAKE2b-256 |
6ca6d38ffab8806c3156b65ffa582f085742289fa503e45cf9745658560383e7
|
File details
Details for the file pipowl-1.4.7-py3-none-any.whl.
File metadata
- Download URL: pipowl-1.4.7-py3-none-any.whl
- Upload date:
- Size: 9.1 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 |
3f1529a60eb8ea82b78f3a605501b7b2da1be3b3b9a16e6cbbb67a35c6613476
|
|
| MD5 |
e97e9d0e1d8ae4afa2c7b9f48dec60f5
|
|
| BLAKE2b-256 |
3400d8e90629ffcf9222c74d8a4b5f26240e88219ace1cf4ea136d07aa9a666f
|