Semantic Emoji Search SDK
See the codeText2Emoji is a Node.js SDK which maps input text to relevant emojis using a Vector-based similarity search powered by Upstash.
The key features include:
delicious matches food emojisemoji_data.json).https://upstash-emoji-search.vercel.app/
In this step, we will insert the Emoji data your Upstash Vector DB. So first you need to create an Index and select one of the available embedding models (do not choose custom).
Download or clone the repo.
Rename the .env.example file as .env and add your Upstash Vector DB URL and token.
Install dependencies then run the seed.js:
npm install
node scripts/seed.js
Check your Data Browser on Upstash console to ensure the emoji data inserted into the Upstash Vector index.
Install by:
npm install @upstash/text2emoji
// examples/basic.js
import Text2Emoji from './src/sdk.js';
import dotenv from 'dotenv';
dotenv.config();
async function test() {
const text2emoji = new Text2Emoji({
vectorRestUrl: process.env.UPSTASH_VECTOR_REST_URL,
vectorRestToken: process.env.UPSTASH_VECTOR_REST_TOKEN
});
console.log( await text2emoji.get("delicious", 5) );
const testCases = [
"love",
"happy",
"sad",
"angry",
"celebration",
"food"
];
for (const text of testCases) {
const emojis = await text2emoji.get(text, 3);
console.log(`Emojis for "${text}":`, emojis);
}
}
test().catch(console.error);
Feel free to raise issues or submit pull requests to improve this package or add additional features.
Semantic Emoji Search SDK
See the codeText2Emoji is a Node.js SDK which maps input text to relevant emojis using a Vector-based similarity search powered by Upstash.
The key features include:
delicious matches food emojisemoji_data.json).https://upstash-emoji-search.vercel.app/
In this step, we will insert the Emoji data your Upstash Vector DB. So first you need to create an Index and select one of the available embedding models (do not choose custom).
Download or clone the repo.
Rename the .env.example file as .env and add your Upstash Vector DB URL and token.
Install dependencies then run the seed.js:
npm install
node scripts/seed.js
Check your Data Browser on Upstash console to ensure the emoji data inserted into the Upstash Vector index.
Install by:
npm install @upstash/text2emoji
// examples/basic.js
import Text2Emoji from './src/sdk.js';
import dotenv from 'dotenv';
dotenv.config();
async function test() {
const text2emoji = new Text2Emoji({
vectorRestUrl: process.env.UPSTASH_VECTOR_REST_URL,
vectorRestToken: process.env.UPSTASH_VECTOR_REST_TOKEN
});
console.log( await text2emoji.get("delicious", 5) );
const testCases = [
"love",
"happy",
"sad",
"angry",
"celebration",
"food"
];
for (const text of testCases) {
const emojis = await text2emoji.get(text, 3);
console.log(`Emojis for "${text}":`, emojis);
}
}
test().catch(console.error);
Feel free to raise issues or submit pull requests to improve this package or add additional features.