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

watsonhelper

v1.1.1

Published

Watson utility framework

Downloads

48

Readme

Watson-Helper

Extract phone numbers, emails, date, and any custom pattern from arbitrary text.

Features:

  • Extract multiple phone number formats across different countries.
  • Extract multiple email number formats across multiple domains.
  • Extract any custom information like invoiceno, ticketid, purchaseordernumber, UID etc.
  • Extract date formats of multiple types from natural language conversations.
  • Extract date with respect to specific reference dates.
  • Extract output in user's defined date format.
  • Unit tested.
  • Examples enclosed.

Background - ver 1.0.0

A recent IBM Watson customer was exploring Watson conversation api. For the customer extraction of phone numbers and email was a key usecase. This data needs to be captured during the conversation. Hence to assist the customer I wrote this library. This library now can help customers with similar usecase extract their set of data usually expressed in conversations or personal blogs. I have released the first version that can address 3 key usecases. Few other key usecases are in pipeline.

Background - ver 1.1.0

Date is commonly used in conversation. Now one can easily convert date references like yesterday, today, tomorrow into quantitve value with respect to a reference date as defined by business. One can also extract natural language dates commonly used in conversations. Output date can also be pre-configured in the required format as expected by business without any extra effort.

Examples

Basic example for email,phone and any custom data extraction

Extraction of one or more phone numbers, email or custom data(like invoiceno, ticketid, purchaseordernumber, UID etc ) from a user supplied text.

var helper = require('watsonhelper');
var phonelist = helper.phoneextractor("I am moving to hyderabad and my mobile number is  +919538099898, You can also call me at 08042227967");

var email = helper.emailextractor("I am moving to US and my email id is  [email protected], You can also email me at [email protected]");

var invoiceno = helper.extractor("<Extracting What>", "Your invoice is generated it is inv1105576", <REGEX STRING>);

Examples to extract date from natural language conversation

Extraction of date can now be done from natural language text, or from multiple date formats used in conversation. Business can define a reference date and also provide the expected date format as output.

var watsonhelper = require('watsonhelper');
var refDate1 = new Date('Thu Oct 20 2016 12:20:29 GMT+0530 (India Standard Time)'); //reference date as defined by business
var refDate2 = new Date('20-oct-2016'); //reference date as defined by business
var text1 = 'I have an appointment tomorrow';
var text2 = 'I have an appointment on 23/11/16';
var text3 = 'I have an appointment on 3rd November';
var opformat1 = "dd-mm-yyyy"; //output date format as defined by business
var opformat2 = "dd-mmm-yyyy"; //output date format as defined by business

var date1 = watsonhelper.dateextractor(text1,refDate1,opformat1);
var date2 = watsonhelper.dateextractor(text2,null,opformat2);
var date3 = watsonhelper.dateextractor(text3);

Limitations

This software cannot capture every single combination imaginable. Especially number-to-letter substitution is difficult to detect e.g:

  • O4!4.Ol2;341 (= 0414 012 341)

In my experience very few users write their phone number this way. From a programming point of view it would be possible to cover for edge cases like above, but I have chosen not to.

Issues, bug reports

https://github.com/ShubhradeepNandi/watsonhelper/issues

License

http://www.apache.org/licenses/LICENSE-2.0

Collaborate and Social

https://ibm.biz/BdrUsn