What is @microsoft/recognizers-text-number?
@microsoft/recognizers-text-number is a part of the Microsoft Recognizers Text suite, which provides robust text recognition capabilities. This specific package focuses on recognizing and parsing numbers, ordinal numbers, percentages, and more from text in multiple languages.
What are @microsoft/recognizers-text-number's main functionalities?
Number Recognition
This feature allows you to recognize and extract numbers from a given text. In the example, it identifies 'two' and 'three' as numbers.
const { recognizeNumber } = require('@microsoft/recognizers-text-number');
const input = 'I have two apples and three oranges.';
const results = recognizeNumber(input, 'en-us');
console.log(results);
Ordinal Number Recognition
This feature helps in recognizing ordinal numbers from text. In the example, it identifies 'first' as an ordinal number.
const { recognizeOrdinal } = require('@microsoft/recognizers-text-number');
const input = 'This is the first time I am using this package.';
const results = recognizeOrdinal(input, 'en-us');
console.log(results);
Percentage Recognition
This feature allows you to recognize and extract percentage values from text. In the example, it identifies '20%' as a percentage.
const { recognizePercentage } = require('@microsoft/recognizers-text-number');
const input = 'The discount is 20% on all items.';
const results = recognizePercentage(input, 'en-us');
console.log(results);
Other packages similar to @microsoft/recognizers-text-number
compromise
Compromise is a lightweight NLP library that can parse and manipulate text. It offers functionalities like part-of-speech tagging, named entity recognition, and more. While it provides number recognition, it is not as specialized in numerical text recognition as @microsoft/recognizers-text-number.
natural
Natural is another general-purpose NLP library for Node.js. It provides tools for tokenization, stemming, classification, and more. While it can recognize numbers, it does not offer the same level of detail and specialization as @microsoft/recognizers-text-number.