npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

emoji-keyword

v1.1.5

Published

一个功能强大的 Emoji 搜索和文本处理库,支持中文语义分析和多种搜索模式

Readme

emoji-keyword

一个功能强大的 Emoji 搜索和文本处理库,支持中文语义分析和多种搜索模式。

功能特点

  • 🚀 智能搜索:支持精确匹配、部分匹配、模糊匹配和语义匹配
  • 🇨🇳 中文优化:针对中文文本进行语义分析和关键词匹配
  • 😊 情感识别:自动识别文本中的情感并推荐相关 Emoji
  • 🎯 上下文感知:根据文本内容识别场景并推荐相关 Emoji
  • 🧠 智能替换:将文本中的关键词替换为 Emoji
  • 📊 多种排序:支持按匹配度、得分、字母顺序排序
  • 高性能:内置缓存和索引机制,提升搜索速度

安装

npm install emoji-keyword

快速开始

import { search, fuzzy, popular, byCategory, smart, replace, convert } from 'emoji-keyword';

// 基础搜索
const results = search('开心');
console.log(results);

// 模糊搜索
const fuzzyResults = fuzzy('高兴');

// 获取热门 Emoji
const popularEmojis = popular(10);

// 智能搜索(包含情感和上下文分析)
const smartResults = smart('今天生日聚会很开心');

API 说明

主要搜索方法

search(text, options)

主要搜索接口,支持多种选项配置。

import { search } from 'emoji-keyword';

const results = search('生日快乐', {
  minScore: 1,           // 最低得分
  maxResults: 50,        // 最大结果数
  sortBy: 'score',       // 排序方式: 'score' | 'matchRatio' | 'alphabetical'
  caseSensitive: false,   // 是否区分大小写
  matchMode: 'semantic', // 匹配模式: 'exact' | 'partial' | 'fuzzy' | 'semantic'
  enableSentimentAnalysis: true,    // 启用情感分析
  enableContextualMatching: true    // 启用上下文匹配
});

fuzzy(text, threshold)

模糊搜索,支持设置相似度阈值。

import { fuzzy } from 'emoji-keyword';

const results = fuzzy('高兴', 0.4);

popular(limit)

获取热门 Emoji 列表。

import { popular } from 'emoji-keyword';

const popularEmojis = popular(10);

byCategory(category)

根据类别搜索 Emoji。

import { byCategory } from 'emoji-keyword';

const foodEmojis = byCategory('美食');

smart(text)

上下文感知搜索,综合分析文本的情感和主题。

import { smart } from 'emoji-keyword';

const results = smart('今天生日聚会很开心,吃了美味的蛋糕');

文本处理方法

replace(text, maxEmojis)

将文本中的关键词替换为 Emoji。

import { replace } from 'emoji-keyword';

const { text, emojis } = replace('我很开心', 5);
// 返回替换后的文本和使用的 Emoji 列表

convert(text, maxEmojis)

将整个文本转换为 Emoji 序列。

import { convert } from 'emoji-keyword';

const emojiString = convert('生日快乐,祝你好运气', 10);

其他方法

clearCache()

清除搜索缓存。

import { clearCache } from 'emoji-keyword';

clearCache();

搜索选项

| 选项 | 类型 | 默认值 | 描述 | |------|------|--------|------| | minScore | number | 1 | 最低得分阈值 | | maxResults | number | 50 | 最大返回结果数 | | sortBy | string | 'score' | 排序方式 | | caseSensitive | boolean | false | 是否区分大小写 | | matchMode | string | 'semantic' | 匹配模式 | | enableSentimentAnalysis | boolean | true | 启用情感分析 | | enableContextualMatching | boolean | true | 启用上下文匹配 |

匹配模式

  • exact: 精确匹配
  • partial: 部分匹配
  • fuzzy: 模糊匹配
  • semantic: 语义匹配(默认)

使用示例

import { search, fuzzy, popular, byCategory, smart, replace, convert } from 'emoji-keyword';

// 基础搜索
console.log(search('开心'));

// 使用不同匹配模式
console.log(search('开心', { matchMode: 'exact' }));
console.log(search('开心', { matchMode: 'partial' }));
console.log(search('开心', { matchMode: 'fuzzy' }));
console.log(search('开心', { matchMode: 'semantic' }));

// 文本处理
console.log(replace('我很开心'));
console.log(convert('生日快乐'));

// 获取特定类别
console.log(byCategory('生日'));
console.log(byCategory('美食'));

// 获取热门 Emoji
console.log(popular(10));

// 智能搜索
console.log(smart('今天生日聚会很开心,吃了美味的蛋糕'));

License

MIT