Package: pykosinus
pykosinuspykosinus is an open-source Python library for text similarity search scoring. It provides a fast and memory-efficient way to calculate cosine similarity scores, making it suitable for various text similarity applications. The library is designed to be user-friendly and encourages contributions from the community.InstallationTo install pykosinus, make sure you have Python 3.8.17 or higher installed. Then, you can install the library using pip:pipinstallpykosinusAdditional Library for Mac UsersIf you are using pykosinus on a Mac, you may need to install the GCC compiler to enable certain features. GCC is a widely used compiler for various programming languages.To install GCC on macOS, you can use Homebrew, a popular package manager for macOS. Follow these steps to install GCC using Homebrew:Open a terminal window.Install Homebrew by running the following command:[/bin/bash](VALID_FILE)-c"$(curl-fsSLhttps://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"Install GCC by running the following command:brewinstallgccVerify the installation by running the following command:gcc--versionSet gfortranexportFC=gfortranVerify gfortran installationgfortran--versionInstall openblas and set pkg config openblasbrewinstallopenblasexportPKG_CONFIG_PATH="/opt/homebrew/opt/openblas/lib/pkgconfig"UsageTo use pykosinus in your Python project, you can follow these steps:Import the necessary modules and classes:frompykosinusimportContentfrompykosinus.lib.scoringimportTextScoringCreate an instance of theTextScoringclass, providing the collection name as a parameter:similarity=TextScoring(collection_name)Set the contents to be searched using thepush_contentsmethod, passing a list ofContentobjects:contents=[Content(content="Lorem ipsum dolor sit amet, consectetur adipiscing elit.",identifier="blog-1",section="blog_title",),Content(content="Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",identifier="blog-2",section="blog_title",),Content(content="Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris.",identifier="blog-3",section="blog_title",),# Add more contents as needed]similarity.push_contents(contents)Initialize the similarity search by calling theinitializemethod:similarity.initialize()Perform a similarity search by calling thesearchmethod, providing a keyword and an optional threshold:results=similarity.search(keyword="search keyword",threshold=0.2)Thesearchmethod returns a list ofScoringResultobjects, which contain the relevant information about the search results. You can access the properties of each result, such asidentifier,content,section,similar, andscore.forresultinresults:print(result.identifier,result.content,result.section,result.similar,result.score)Contributingpykosinus welcomes contributions from the community. If you would like to contribute to the library, please follow these steps:Fork the pykosinus repository onGitHub.Create a new branch for your feature or bug fix.Make your changes and commit them with descriptive commit messages.Push your changes to your forked repository.Submit a pull request to the master pykosinus repository, explaining the changes you have made.Versioningpykosinus is currently in version 0.2.0. We encourage continuous development and contributions from other contributors to improve and expand the library.Licensepykosinus is released under theMIT License.