?
ความคล้ายคลึงกัน : ชุดเครื่องมือสำหรับการคำนวณความคล้ายคลึงกันและการค้นหาความหมายรองรับข้อความและรูปภาพที่คล้ายคลึงกัน
ความคล้ายคลึงกัน ใช้การคำนวณความคล้ายคลึงกันที่หลากหลายและอัลกอริทึมการจับคู่ความหมายสำหรับข้อความและรูปภาพและรองรับการค้นหาข้อมูลหลายพันล้านรายการการค้นหาข้อความและการค้นหารูปภาพการพัฒนา Python3 การติดตั้ง PIP และนอกกรอบ
แนะนำ
ตัวอย่างการค้นหาภาพ: https://huggingface.co/spaces/shibing624/clip-image-search

ตัวอย่างการค้นหาข้อความ: https://huggingface.co/spaces/shibing624/similarities

pip install torch # conda install pytorch
pip install -U similarities
หรือ
git clone https://github.com/shibing624/similarities.git
cd similarities
pip install -e .
ตัวอย่าง: ตัวอย่าง/text_similarity_demo.py
from similarities import BertSimilarity
m = BertSimilarity ( model_name_or_path = "shibing624/text2vec-base-chinese" )
r = m . similarity ( '如何更换花呗绑定银行卡' , '花呗更改绑定银行卡' )
print ( f"similarity score: { float ( r ) } " ) # similarity score: 0.855146050453186model_name_or_path : ชื่อหรือเส้นทางของรุ่นจะถูกดาวน์โหลดจากฮับรุ่น HF โดยค่าเริ่มต้นและรุ่นการจับคู่ความหมายของจีน Shibing624/text2Vec-base-chinese ถูกใช้ค้นหาข้อความที่คล้ายกับการสืบค้นในชุดผู้สมัครเอกสารซึ่งมักใช้สำหรับการจับคู่ที่คล้ายกันและการค้นหาข้อความในสถานการณ์ QA
ตัวอย่าง: ตัวอย่าง/text_semantic_search_demo.py
ตัวอย่าง: ตัวอย่าง/fast_text_semantic_search_demo.py
เวกเตอร์การถ่ายโอนข้อความการจัดทำดัชนีการค้นหาแบทช์บริการเริ่มต้น: ตัวอย่าง/faiss_bert_search_server_demo.py
การโทร Python front-end: ตัวอย่าง/faiss_bert_search_client_demo.py
รองรับการคำนวณความคล้ายคลึงกันและการค้นหาการจับคู่ที่แท้จริงสำหรับคำพ้องความหมายเช่น cilin, cnki hownet, wordembedding, tfidf, simhash, bm25 ฯลฯ และมักจะใช้สำหรับการจับคู่ข้อความเริ่มต้นเย็น
ตัวอย่าง: ตัวอย่าง/literal_text_semantic_search_demo.py
รองรับการคำนวณความคล้ายคลึงกันของภาพและการค้นหาอัลกอริทึมเช่นคลิป, Phash และ SIFT
ตัวอย่าง: ตัวอย่าง/image_semantic_search_demo.py

การเปลี่ยนภาพเวกเตอร์การจัดทำดัชนีการค้นหาแบทช์บริการเริ่มต้น: ตัวอย่าง/faiss_clip_search_server_demo.py
การโทร Python front-end: ตัวอย่าง/faiss_clip_search_client_demo.py
front-end gradio call: ตัวอย่าง/faiss_clip_search_gradio_demo.py

การทำคลัสเตอร์สามารถทำได้ในชุดข้อมูลขนาดใหญ่ผ่านอัลกอริทึม Community_detection เพื่อค้นหาการจัดกลุ่ม (เช่นกลุ่มประโยคที่คล้ายกัน)
ตัวอย่าง: ตัวอย่าง/text_clustering_demo.py
อัลกอริทึมคำพ้องความหมาย (paraphrase_mining_embeddings) อัลกอริทึมสามารถใช้ในการขุดคู่ประโยคที่มีความหมายคล้ายกันจากประโยคหรือเอกสารจำนวนมากซึ่งสามารถใช้สำหรับกราฟิกและการตรวจจับข้อความซ้ำซ้อน
รหัส: cli.py
> similarities -h
NAME
similarities
SYNOPSIS
similarities COMMAND
COMMANDS
COMMAND is one of the following:
bert_embedding
Compute embeddings for a list of sentences
bert_index
Build indexes from text embeddings using autofaiss
bert_filter
Entry point of bert filter, batch search index
bert_server
Main entry point of bert search backend, start the server
clip_embedding
Embedding text and image with clip model
clip_index
Build indexes from embeddings using autofaiss
clip_filter
Entry point of clip filter, batch search index
clip_server
Main entry point of clip search backend, start the server
วิ่ง:
pip install similarities -U
similarities clip_embedding -h
# example
cd examples
similarities clip_embedding data/toy_clip/bert_embedding เป็นต้นเป็นคำสั่งรองsimilarities clip_embedding -hdata/toy_clip/ เป็นพารามิเตอร์ input_dir ของวิธี clip_embedding และป้อนไดเรกทอรีไฟล์ (จำเป็น) 
หากคุณใช้ความคล้ายคลึงกันในการวิจัยของคุณโปรดอ้างอิงในรูปแบบต่อไปนี้:
APA:
Xu, M. Similarities: Compute similarity score for humans (Version 1.0.1) [Computer software]. https://github.com/shibing624/similarities
bibtex:
@misc{Xu_Similarities_Compute_similarity,
title={Similarities: similarity calculation and semantic search toolkit},
author={Xu Ming},
year={2022},
howpublished={url{https://github.com/shibing624/similarities}},
}
ข้อตกลงใบอนุญาตคือ Apache License 2.0 ซึ่งสามารถใช้เพื่อวัตถุประสงค์ทางการค้าได้ฟรี โปรดแนบลิงค์และข้อตกลงการอนุญาตให้กับคำอธิบายผลิตภัณฑ์
รหัสโครงการยังคงหยาบมาก
testspython -m pytest เพื่อเรียกใช้การทดสอบหน่วยทั้งหมดเพื่อให้แน่ใจว่าการทดสอบครั้งเดียวทั้งหมดจะผ่านไปคุณสามารถส่ง PR ของคุณได้ในภายหลัง
ขอบคุณสำหรับการทำงานที่ยอดเยี่ยม!