dice-coefficient
    TypeScript icon, indicating that this package has built-in type declarations

    2.0.0 • Public • Published

    dice-coefficient

    Build Coverage Downloads Size

    Sørensen–Dice coefficient.

    Install

    This package is ESM only: Node 12+ is needed to use it and it must be imported instead of required.

    npm:

    npm install dice-coefficient

    API

    This package exports the following identifiers: diceCoefficient. There is no default export.

    import {diceCoefficient} from 'dice-coefficient'
    
    diceCoefficient('abc', 'abc') // => 1
    diceCoefficient('abc', 'xyz') // => 0
    diceCoefficient('night', 'nacht') // => 0.25
    diceCoefficient('night', 'nacht') === dice('NiGhT', 'NACHT') // => true

    CLI

    Usage: dice-coefficient [options] <word> <word>
    
    Sørensen–Dice coefficient
    
    Options:
    
      -h, --help           output usage information
      -v, --version        output version number
    
    Usage:
    
    # output edit distance
    $ dice-coefficient night nacht
    # 0.25
    
    # output edit distance from stdin
    $ echo "saturday sunday" | dice-coefficient
    # 0.3333333333333333
    

    Related

    License

    MIT © Titus Wormer

    Install

    npm i dice-coefficient

    DownloadsWeekly Downloads

    567

    Version

    2.0.0

    License

    MIT

    Unpacked Size

    8.46 kB

    Total Files

    6

    Last publish

    Collaborators

    • wooorm
    • zeke