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

module-nlp

v1.0.6

Published

This module provides the natural language understanding functions.

Downloads

3

Readme

module-nlp

npm version

Features

  • Machine Comprehension
  • Textual Entailment
  • Semantic Role Labeling
  • Named Entity Recognition
  • Coreference Resolution

Machine Comprehension

  • machine_comprehension(query)
  • Input:
    console.log(package.machine_comprehension(
      {"passage":"Robotics is an interdisciplinary branch of engineering and science that includes mechanical engineering, electrical engineering, computer science, and others. Robotics deals with the design, construction, operation, and use of robots, as well as computer systems for their control, sensory feedback, and information processing. These technologies are used to develop machines that can substitute for humans. Robots can be used in any situation and for any purpose, but today many are used in dangerous environments (including bomb detection and de-activation), manufacturing processes, or where humans cannot survive. Robots can take on any form but some are made to resemble humans in appearance. This is said to help in the acceptance of a robot in certain replicative behaviors usually performed by people. Such robots attempt to replicate walking, lifting, speech, cognition, and basically anything a human can do.","question":"What do robots that resemble humans attempt to do?"}
      ))
  • Output:
    {
     "best_span": [
       147,
       154
     ],
     "best_span_str": "replicate walking, lifting, speech, cognition",
     "span_end_logits": [
       -6.517852306365967,
       -12.051702499389648,
       -12.485725402832031,
     .....
    }

Textual Entailment

  • textual_entailment(query)
  • Input:
    console.log(package.semantic_role_labeling(
      {"premise":"Two women are wandering along the shore drinking iced tea.","hypothesis":"Two women are sitting on a blanket near some rocks talking about politics."}
    ))
    
  • Output:
    {"label_logits":[-3.6113696098,2.6817588806,1.1695688963],"label_probs":[0.0015127246,0.81814605,0.1803412586],"slug":"MTU0NjQ="}

Semantic Role Labeling

  • semantic_role_labeling(query)
  • Input:
    console.log(package.semantic_role_labeling(
      {"sentence":"However, voters decided that if the stadium was such a good idea someone would build it himself, and rejected it 59% to 41%."}
    ))
    
  • Output:
    {
    "tokens": [
     "However",
     ",",
     "voters",
     "decided",
     "that",
     "if",
     "the",
     "stadium",
     "was",
     "such",
     "a",
     "good",
     "idea",
     "someone"
     ]
    }

Named Entity Recognition

  • named_entity_recognition(query)
  • Input:
    console.log(package.named_entity_recognition(
      {"sentence":"Michael Jordan is a professor at Berkeley."}
      ))
  • Output:
    {
    "logits": [
      [
        0.6069703102111816,
        -1.9964487552642822,
        9.776033401489258,
        -3.4721059799194336,
        -0.1944570243358612,
        -3.486645460128784,
        1.6684856414794922,
        -4.359092712402344,
        3.2526683807373047,
        -2.0060856342315674,
        2.8877902030944824,
        -5.399940490722656,
        -1.498845100402832,
        -5.677943706512451,
        -4.222471714019775,
        1.198972463607788,
        -2.671220064163208
      ],
      [
        0.29961785674095154,
        3.553903102874756
       ]]
     }

Coreference Resolution

  • coreference_resolution(query)
  • Input:
    console.log(package.named_entity_recognition(
      {"document":"We 're not going to skimp on quality , but we are very focused to make next year . The only problem is that some of the fabrics are wearing out - since I was a newbie I skimped on some of the fabric and the poor quality ones are developing holes . For some , an awareness of this exit strategy permeates the enterprise , allowing them to skimp on the niceties they would more or less have to extend toward a person they were likely to meet again ."}
      ))
  • Output:
    {"document":["We","'re","not","going","to","skimp","on","quality",",","but","we","are","very","focused","to","make","next","year",".","The","only","problem","is","that","some","of","the","fabrics","are","wearing","out","-","since","I","was","a","newbie","I","skimped","on","some","of","the","fabric","and","the","poor","quality","ones","are","developing","holes",".","For","some",",","an","awareness","of","this","exit","strategy","permeates","the","enterprise",",","allowing","them","to","skimp","on","the","niceties","they","would","more","or","less","have","to","extend","toward","a","person","they","were","likely","to","meet","again","."],"clusters":[[[0,0],[10,10]],[[33,33]]]}