You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

keywords-search

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

keywords-search

Extract root domain name from an URL.

0.0.1
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

Search Keywords in String

Search keywords in a string and return a relevancy score.

npm

Installation

npm i --save keywords-search

Usage

import search from 'keywords-search';

search( search: string, subject: string ): {
    // Score of relevancy (between 0 and 100)
    score: number,
    // The minimum score you will get if at least each keyword is contained in the subject string
    minAcceptableScore: number,
    // The list of search string that have been matched
    keywords: {
        keyword: string,
        score: number,
        position: number   
    }[],
};

Usage examples

search("quality data analyst", "quality data analyst");
{
    "keywords": [
        {
            "keyword": "data quality analyst",
            "score": 9,
            "position": 0
        }
    ],
    "score": 100,
    "minAcceptableScore": 3,
}
search("data quality analyst", "quality data analyst");
{
    "keywords": [
        {
            "keyword": "data",
            "score": 0.6,
            "position": 8
        },
        {
            "keyword": "quality",
            "score": 1,
            "position": 0
        },
        {
            "keyword": "analyst",
            "score": 0.35,
            "position": 13
        }
    ],
    "score": 21.67,
    "minAcceptableScore": 3,
}

Keywords

keyword

FAQs

Package last updated on 07 Dec 2022

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.