A library for seamless frontend (no server side) semantic search in the browser.
npm install @lizozom/semanticjs --save
Checkout this repository and run the following commands:
npm install
npm start
import { init, embed, search } from '@lizozom/semanticjs';
window.load = () => {
await init({
modelName: 'Xenova/all-MiniLM-L6-v2',
});
const pageContent = document.getElementById('main-text-cont').value;
// Split the content by sentences, tokens, etc. This logic is not included in this package.
const splitContent = splitText(pageContent);
const embeddingMap = await embedContent(splitContent);
const searchResults = await search('search query', embeddingMap);
}