🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
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
npm
Version published
Weekly downloads
3
50%
Maintainers
1
Weekly downloads
 
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