
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
@apto-space/moving-ngrams
Advanced tools
A utility package for generating all possible n-gram combinations from a sequence of words, useful for search engine query analysis and natural language processing tasks.
A utility package for generating all possible n-gram combinations from a sequence of words, useful for search engine query analysis and natural language processing tasks.
moving-ngrams
helps you analyze text by generating all possible meaningful combinations of consecutive words. This is particularly useful for:
# Using bun
bun add moving-ngrams
# Using npm
npm install moving-ngrams
# Using yarn
yarn add moving-ngrams
import { movingNgrams } from 'moving-ngrams';
// Example 1: Simple phrase analysis
const result = movingNgrams(['hello', 'world']);
console.log(result);
/* Output:
[
[['hello'], ['world']], // Individual words
[['hello', 'world']] // Combined phrase
]
*/
// Example 2: Search query analysis
const searchQuery = movingNgrams(['elon', 'musk', 'san', 'francisco']);
console.log(searchQuery);
/* Output will include all possible combinations like:
- [['elon'], ['musk'], ['san'], ['francisco']]
- [['elon', 'musk'], ['san'], ['francisco']]
- [['elon'], ['musk', 'san'], ['francisco']]
- [['elon'], ['musk'], ['san', 'francisco']]
... and more combinations
*/
When users enter a search query like "Elon Musk San Francisco", the package helps you analyze all possible meaningful combinations:
This is particularly useful for:
When analyzing text content, you can use this to:
function movingNgrams(words: string[]): string[][][]
MIT
This project was created using Bun v1.1.41.
FAQs
A utility package for generating all possible n-gram combinations from a sequence of words, useful for search engine query analysis and natural language processing tasks.
We found that @apto-space/moving-ngrams demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.