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 🙏

© 2024 – Pkg Stats / Ryan Hefner

trec-eval-wrapper

v1.1.0

Published

Node.js wrapper module for access to `trec_eval`, TREC's information retrieval system evaluation tool

Downloads

1

Readme

version TypeScript definitions on DefinitelyTyped

trec-eval-wrapper

This is a Node.js wrapper library for the Text REtrieval Conference (TREC) evaluation tool. trec_eval is a common tool for the evaluation of information retrieval systems, given the results and a standard set of judged results. This library allows for the programmatic execution of trec_eval in a Node.js environment.

This project does not contain the actual evaluation tool "trec_eval". In order to use this wrapper, please download and install version 9.0 or later (listed as "latest" or "9.0") in the following link: http://trec.nist.gov/trec_eval

This work holds no affiliation to NIST or the TREC community.

Usage

The following examples assume that the trec_eval executable is in your PATH. If not, you must define the full path in the TREC_EVAL_EXEC environment variable.

JavaScript (ECMAScript 5, CommonJS)

var TREC = require('trec-eval')

TREC.evaluate('results_filename.csv', 'groundtruth_filename.csv', {}, function onOutcome(error, outcome) {
  console.log('MAP:', outcome.all.map)
  console.log('bpref:', outcome.all.bpref)
  console.log('P10:', outcome.all.p10)
  // ...
})

TypeScript

import {evaluate} from 'trec-eval'

evaluate('results_filename.csv', 'groundtruth_filename.csv', {
  query_eval_wanted: true,
  complete_rel_info_wanted: true
}, (error, {'301':q301, '302':q302, all}) => {
  if (error) {
    console.error(error.message)
    return
  }
  console.log('MAP (301):', q301.map)
  console.log('MAP (302):', q302.map)
  console.log('MAP (avg):', all.map)
  // ...
})

API

evaluate

interface TRECEvaluationCallback {
  (error:Error, results:TRECEvaluationSet) : any
}

evaluate(testFilename:string, groundtruthFilename:string, options:TRECOptions, callback:TRECEvaluationCallback) : void

evaluate(testFilename:string, groundtruthFilename:string, callback:TRECEvaluationCallback) : void

Perform an evaluation.

  • testFilename: path to the testing IR system's results in CSV
  • groundtruthFilename: path to the judged results in CSV
  • options: a dictionary of options

version

version(callback:(error:Error, version:string) => any) : void

Obtain the version of the underlying trec_eval tool.

Options and Outcome data types

The evaluation options translate to those of the original tool, and are documented in "typings/trec-options.d.ts". The evaluation outcome type aggregates measures by query run id, where "all" refers to the summary of all runs. Some measures are also documented in "typings/trec-evaluation.d.ts".

License

MIT