How to use the @microsoft/recognizers-text-suite.recognizeNumber function in @microsoft/recognizers-text-suite

To help you get started, we’ve selected a few @microsoft/recognizers-text-suite examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / Recognizers-Text / JavaScript / samples / simple-console / index.js View on Github external
function parseAll(input, culture) {
    return [
        // Number recognizer - This function will find any number from the input
        // E.g "I have two apples" will return "2".
        ...Recognizers.recognizeNumber(input, culture),

        // Ordinal number recognizer - This function will find any ordinal number
        // E.g "eleventh" will return "11".
        ...Recognizers.recognizeOrdinal(input, culture),

        // Percentage recognizer - This function will find any number presented as percentage
        // E.g "one hundred percents" will return "100%"
        ...Recognizers.recognizePercentage(input, culture),

        // Age recognizer - This function will find any age number presented
        // E.g "After ninety five years of age, perspectives change" will return "95 Year"
        ...Recognizers.recognizeAge(input, culture),

        // Currency recognizer - This function will find any currency presented
        // E.g "Interest expense in the 1988 third quarter was $ 75.3 million" will return "75300000 Dollar"
        ...Recognizers.recognizeCurrency(input, culture),
github axa-group / nlp.js / lib / ner / ner-manager.js View on Github external
this.builtins.forEach(name => {
      try {
        const entities = Recognizers[`recognize${name}`](utterance, culture);
        if (name === 'Number') {
          entities.push(
            ...Recognizers.recognizeNumber(utterance, NlpUtil.getCulture('en'))
          );
        }
        for (let i = 0; i < entities.length; i += 1) {
          const entity = entities[i];
          let entityName = entity.typeName;
          const index = entityName.lastIndexOf('.');
          if (index !== -1) {
            entityName = entityName.slice(index + 1);
          }
          if (this.builtinWhitelist[entityName]) {
            const text = utterance.slice(entity.start, entity.end + 1);
            const accuracy = 0.95;
            const edge = {
              start: entity.start,
              end: entity.end,
              len: entity.end - entity.start + 1,
github axa-group / nlp.js / packages / builtin-microsoft / src / builtin-microsoft.js View on Github external
this.settings.builtins.forEach(name => {
      try {
        const entities = Recognizers[`recognize${name}`](utterance, culture);
        if (name === 'Number' && locale !== 'en') {
          entities.push(
            ...Recognizers.recognizeNumber(utterance, getCulture('en'))
          );
        }
        for (let i = 0; i < entities.length; i += 1) {
          const entity = entities[i];
          source.push(entity);
          let entityName = entity.typeName;
          const index = entityName.lastIndexOf('.');
          if (index !== -1) {
            entityName = entityName.slice(index + 1);
          }
          if (this.settings.builtinWhitelist[entityName]) {
            const text = utterance.slice(entity.start, entity.end + 1);
            const accuracy = 0.95;
            const edge = {
              start: entity.start,
              end: entity.end,
github axa-group / nlp.js / lib / ner / ner-recognizer.js View on Github external
this.builtins.forEach(name => {
      try {
        const entities = Recognizers[`recognize${name}`](utterance, culture);
        if (name === 'Number') {
          entities.push(
            ...Recognizers.recognizeNumber(utterance, NlpUtil.getCulture('en'))
          );
        }
        for (let i = 0; i < entities.length; i += 1) {
          const entity = entities[i];
          source.push(entity);
          let entityName = entity.typeName;
          const index = entityName.lastIndexOf('.');
          if (index !== -1) {
            entityName = entityName.slice(index + 1);
          }
          if (this.builtinWhitelist[entityName]) {
            const text = utterance.slice(entity.start, entity.end + 1);
            const accuracy = 0.95;
            const edge = {
              start: entity.start,
              end: entity.end,