Skip to main content

SemanticOwl + LightOwl + LangOwl open-core

Project description

pipowl 🦉

Open Semantic Tools for Python

PyPI version Python Version License Downloads Wheel Size

SemanticOwl + LightOwl + LangOwl Open-Core

pipowl 提供:

SemanticOwl:輕量語意編碼器(使用 SentenceTransformer)

LightOwl:基本文本清洗

LangOwl:語意搜尋(top-k + cosine similarity)

pip install:

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 是一個用來比較句子語意相似度的小工具。 你只要給它兩個東西:

  1. 你的句子(要查的)
  2. 你有的一堆句子(要比的)

它就會告訴你「哪一句最像」。

輸出示例:

0.903 我今天真的好累 0.882 我覺得今天狀態不太好 0.834 今天的天氣真的很好

請試試看(範例):

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)

"""

Project details


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.5.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pipowl-1.4.5-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file pipowl-1.4.5.tar.gz.

File metadata

  • Download URL: pipowl-1.4.5.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for pipowl-1.4.5.tar.gz
Algorithm Hash digest
SHA256 2f81276fd5b85d20b94d029c93183084fca4aaaf990a6d2ef108e41e479772d4
MD5 76a216b1388431e2cfee2c0b38d13c1b
BLAKE2b-256 e748355548f95360547a86299cc8a467c83c12a53c1847e2274f3315decb017e

See more details on using hashes here.

File details

Details for the file pipowl-1.4.5-py3-none-any.whl.

File metadata

  • Download URL: pipowl-1.4.5-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for pipowl-1.4.5-py3-none-any.whl
Algorithm Hash digest
SHA256 d331b5b1c26d962d598fd48a8dddc7ec47f6035e6b013adb50ae0a1e9d9ea723
MD5 a470ddbbfbfcadefb891ca7d09c74b02
BLAKE2b-256 12c85fa83f1a66fcc6ceab8dee090d89fcb2a0d06e6f8271c7724b3b5cd2a708

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page