Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@microsoft/recognizers-text-number-with-unit

Package Overview
Dependencies
Maintainers
2
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@microsoft/recognizers-text-number-with-unit - npm Package Compare versions

Comparing version 1.1.4 to 1.2.7

2

dist/types/numberWithUnit/chinese/age.d.ts

@@ -6,3 +6,3 @@ import { CultureInfo } from "@microsoft/recognizers-text-number";

readonly prefixList: ReadonlyMap<string, string>;
readonly ambiguousUnitList: ReadonlyArray<string>;
readonly ambiguousUnitList: readonly string[];
readonly extractType: string;

@@ -9,0 +9,0 @@ constructor(ci?: CultureInfo);

@@ -6,5 +6,5 @@ import { IExtractor, IParser } from "@microsoft/recognizers-text";

export declare abstract class ChineseNumberWithUnitExtractorConfiguration implements INumberWithUnitExtractorConfiguration {
readonly abstract suffixList: ReadonlyMap<string, string>;
readonly abstract prefixList: ReadonlyMap<string, string>;
readonly abstract ambiguousUnitList: ReadonlyArray<string>;
abstract readonly suffixList: ReadonlyMap<string, string>;
abstract readonly prefixList: ReadonlyMap<string, string>;
abstract readonly ambiguousUnitList: readonly string[];
readonly abstract extractType: string;

@@ -17,3 +17,4 @@ readonly cultureInfo: CultureInfo;

readonly compoundUnitConnectorRegex: RegExp;
readonly pmNonUnitRegex: RegExp;
readonly nonUnitRegex: RegExp;
readonly ambiguousUnitNumberMultiplierRegex: RegExp;
constructor(ci: CultureInfo);

@@ -20,0 +21,0 @@ }

@@ -6,3 +6,3 @@ import { CultureInfo } from "@microsoft/recognizers-text-number";

readonly prefixList: ReadonlyMap<string, string>;
readonly ambiguousUnitList: ReadonlyArray<string>;
readonly ambiguousUnitList: readonly string[];
readonly extractType: string;

@@ -9,0 +9,0 @@ constructor(ci?: CultureInfo);

@@ -6,3 +6,3 @@ import { CultureInfo } from "@microsoft/recognizers-text-number";

readonly prefixList: ReadonlyMap<string, string>;
readonly ambiguousUnitList: ReadonlyArray<string>;
readonly ambiguousUnitList: readonly string[];
readonly extractType: string;

@@ -9,0 +9,0 @@ constructor(ci?: CultureInfo);

@@ -6,4 +6,5 @@ import { CultureInfo } from "@microsoft/recognizers-text-number";

readonly prefixList: ReadonlyMap<string, string>;
readonly ambiguousUnitList: ReadonlyArray<string>;
readonly ambiguousUnitList: readonly string[];
readonly extractType: string;
readonly ambiguousUnitNumberMultiplierRegex: RegExp;
constructor(ci?: CultureInfo);

@@ -10,0 +11,0 @@ }

@@ -6,3 +6,3 @@ import { CultureInfo } from "@microsoft/recognizers-text-number";

readonly prefixList: ReadonlyMap<string, string>;
readonly ambiguousUnitList: ReadonlyArray<string>;
readonly ambiguousUnitList: readonly string[];
readonly extractType: string;

@@ -9,0 +9,0 @@ constructor(ci?: CultureInfo);

@@ -6,5 +6,5 @@ import { IExtractor, IParser } from "@microsoft/recognizers-text";

export declare abstract class EnglishNumberWithUnitExtractorConfiguration implements INumberWithUnitExtractorConfiguration {
readonly abstract suffixList: ReadonlyMap<string, string>;
readonly abstract prefixList: ReadonlyMap<string, string>;
readonly abstract ambiguousUnitList: ReadonlyArray<string>;
abstract readonly suffixList: ReadonlyMap<string, string>;
abstract readonly prefixList: ReadonlyMap<string, string>;
abstract readonly ambiguousUnitList: readonly string[];
readonly abstract extractType: string;

@@ -17,3 +17,4 @@ readonly cultureInfo: CultureInfo;

readonly compoundUnitConnectorRegex: RegExp;
readonly pmNonUnitRegex: RegExp;
readonly nonUnitRegex: RegExp;
readonly ambiguousUnitNumberMultiplierRegex: RegExp;
constructor(ci: CultureInfo);

@@ -20,0 +21,0 @@ }

@@ -6,3 +6,3 @@ import { CultureInfo } from "@microsoft/recognizers-text-number";

readonly prefixList: ReadonlyMap<string, string>;
readonly ambiguousUnitList: ReadonlyArray<string>;
readonly ambiguousUnitList: readonly string[];
readonly extractType: string;

@@ -9,0 +9,0 @@ constructor(ci?: CultureInfo);

@@ -6,3 +6,3 @@ import { CultureInfo } from "@microsoft/recognizers-text-number";

readonly prefixList: ReadonlyMap<string, string>;
readonly ambiguousUnitList: ReadonlyArray<string>;
readonly ambiguousUnitList: readonly string[];
readonly extractType: string;

@@ -9,0 +9,0 @@ constructor(ci?: CultureInfo);

@@ -6,4 +6,5 @@ import { CultureInfo } from "@microsoft/recognizers-text-number";

readonly prefixList: ReadonlyMap<string, string>;
readonly ambiguousUnitList: ReadonlyArray<string>;
readonly ambiguousUnitList: readonly string[];
readonly extractType: string;
readonly ambiguousUnitNumberMultiplierRegex: RegExp;
constructor(ci?: CultureInfo);

@@ -10,0 +11,0 @@ }

@@ -6,3 +6,3 @@ import { IExtractor, ExtractResult } from "@microsoft/recognizers-text";

readonly prefixList: ReadonlyMap<string, string>;
readonly ambiguousUnitList: ReadonlyArray<string>;
readonly ambiguousUnitList: readonly string[];
readonly extractType: string;

@@ -15,3 +15,4 @@ readonly cultureInfo: CultureInfo;

readonly compoundUnitConnectorRegex: RegExp;
readonly pmNonUnitRegex: RegExp;
readonly nonUnitRegex: RegExp;
readonly ambiguousUnitNumberMultiplierRegex: RegExp;
}

@@ -25,10 +26,10 @@ export declare class NumberWithUnitExtractor implements IExtractor {

constructor(config: INumberWithUnitExtractorConfiguration);
extract(source: string): Array<ExtractResult>;
extract(source: string): ExtractResult[];
validateUnit(source: string): boolean;
protected preCheckStr(str: string): number;
protected extractSeparateUnits(source: string, numDependResults: Array<ExtractResult>): void;
protected buildRegexFromSet(collection: Array<string>, ignoreCase?: boolean): Set<RegExp>;
protected extractSeparateUnits(source: string, numDependResults: ExtractResult[]): void;
protected buildRegexFromSet(collection: string[], ignoreCase?: boolean): Set<RegExp>;
protected buildSeparateRegexFromSet(ignoreCase?: boolean): RegExp;
protected dinoComparer(x: string, y: string): number;
private isDimensionFallsInTime(dimension, time);
protected stringComparer(stringA: string, stringB: string): number;
private DimensionInsideTime;
}

@@ -39,5 +40,5 @@ export declare class BaseMergedUnitExtractor implements IExtractor {

constructor(config: INumberWithUnitExtractorConfiguration);
extract(source: string): Array<ExtractResult>;
private mergeCompoundUnits(source);
private MergePureNumber(source, result);
extract(source: string): ExtractResult[];
private mergeCompoundUnits;
private MergePureNumber;
}

@@ -44,0 +45,0 @@ export declare class PrefixUnitResult {

@@ -6,3 +6,3 @@ import { CultureInfo } from "@microsoft/recognizers-text-number";

readonly prefixList: ReadonlyMap<string, string>;
readonly ambiguousUnitList: ReadonlyArray<string>;
readonly ambiguousUnitList: readonly string[];
readonly extractType: string;

@@ -9,0 +9,0 @@ constructor(ci?: CultureInfo);

@@ -6,5 +6,5 @@ import { IExtractor, IParser } from "@microsoft/recognizers-text";

export declare abstract class FrenchNumberWithUnitExtractorConfiguration implements INumberWithUnitExtractorConfiguration {
readonly abstract suffixList: ReadonlyMap<string, string>;
readonly abstract prefixList: ReadonlyMap<string, string>;
readonly abstract ambiguousUnitList: ReadonlyArray<string>;
abstract readonly suffixList: ReadonlyMap<string, string>;
abstract readonly prefixList: ReadonlyMap<string, string>;
abstract readonly ambiguousUnitList: readonly string[];
readonly abstract extractType: string;

@@ -17,3 +17,4 @@ readonly cultureInfo: CultureInfo;

readonly compoundUnitConnectorRegex: RegExp;
readonly pmNonUnitRegex: RegExp;
readonly nonUnitRegex: RegExp;
readonly ambiguousUnitNumberMultiplierRegex: RegExp;
constructor(ci: CultureInfo);

@@ -20,0 +21,0 @@ }

@@ -6,3 +6,3 @@ import { CultureInfo } from "@microsoft/recognizers-text-number";

readonly prefixList: ReadonlyMap<string, string>;
readonly ambiguousUnitList: ReadonlyArray<string>;
readonly ambiguousUnitList: readonly string[];
readonly extractType: string;

@@ -9,0 +9,0 @@ constructor(ci?: CultureInfo);

@@ -6,3 +6,3 @@ import { CultureInfo } from "@microsoft/recognizers-text-number";

readonly prefixList: ReadonlyMap<string, string>;
readonly ambiguousUnitList: ReadonlyArray<string>;
readonly ambiguousUnitList: readonly string[];
readonly extractType: string;

@@ -9,0 +9,0 @@ constructor(ci?: CultureInfo);

@@ -6,4 +6,5 @@ import { CultureInfo } from "@microsoft/recognizers-text-number";

readonly prefixList: ReadonlyMap<string, string>;
readonly ambiguousUnitList: ReadonlyArray<string>;
readonly ambiguousUnitList: readonly string[];
readonly extractType: string;
readonly ambiguousUnitNumberMultiplierRegex: RegExp;
constructor(ci?: CultureInfo);

@@ -10,0 +11,0 @@ }

@@ -6,3 +6,3 @@ import { CultureInfo } from "@microsoft/recognizers-text-number";

readonly prefixList: ReadonlyMap<string, string>;
readonly ambiguousUnitList: ReadonlyArray<string>;
readonly ambiguousUnitList: readonly string[];
readonly extractType: string;

@@ -9,0 +9,0 @@ constructor(ci?: CultureInfo);

@@ -6,5 +6,5 @@ import { IExtractor, IParser } from "@microsoft/recognizers-text";

export declare abstract class JapaneseNumberWithUnitExtractorConfiguration implements INumberWithUnitExtractorConfiguration {
readonly abstract suffixList: ReadonlyMap<string, string>;
readonly abstract prefixList: ReadonlyMap<string, string>;
readonly abstract ambiguousUnitList: ReadonlyArray<string>;
abstract readonly suffixList: ReadonlyMap<string, string>;
abstract readonly prefixList: ReadonlyMap<string, string>;
abstract readonly ambiguousUnitList: readonly string[];
readonly abstract extractType: string;

@@ -17,3 +17,4 @@ readonly cultureInfo: CultureInfo;

readonly compoundUnitConnectorRegex: RegExp;
readonly pmNonUnitRegex: RegExp;
readonly nonUnitRegex: RegExp;
readonly ambiguousUnitNumberMultiplierRegex: RegExp;
constructor(ci: CultureInfo);

@@ -20,0 +21,0 @@ }

@@ -6,3 +6,3 @@ import { CultureInfo } from "@microsoft/recognizers-text-number";

readonly prefixList: ReadonlyMap<string, string>;
readonly ambiguousUnitList: ReadonlyArray<string>;
readonly ambiguousUnitList: readonly string[];
readonly extractType: string;

@@ -9,0 +9,0 @@ constructor(ci?: CultureInfo);

@@ -6,3 +6,3 @@ import { IModel, ModelResult, IExtractor, IParser } from "@microsoft/recognizers-text";

Dimension = 2,
Temperature = 3,
Temperature = 3
}

@@ -13,4 +13,4 @@ export declare abstract class AbstractNumberWithUnitModel implements IModel {

constructor(extractorParsersMap: Map<IExtractor, IParser>);
parse(query: string): Array<ModelResult>;
private getResolution(data);
parse(query: string): ModelResult[];
private getResolution;
}

@@ -17,0 +17,0 @@ export declare class AgeModel extends AbstractNumberWithUnitModel {

import { IModel, ModelResult, Recognizer } from "@microsoft/recognizers-text";
export declare enum NumberWithUnitOptions {
None = 0,
None = 0
}
export declare function recognizeCurrency(query: string, culture: string, options?: NumberWithUnitOptions, fallbackToDefaultCulture?: boolean): Array<ModelResult>;
export declare function recognizeTemperature(query: string, culture: string, options?: NumberWithUnitOptions, fallbackToDefaultCulture?: boolean): Array<ModelResult>;
export declare function recognizeDimension(query: string, culture: string, options?: NumberWithUnitOptions, fallbackToDefaultCulture?: boolean): Array<ModelResult>;
export declare function recognizeAge(query: string, culture: string, options?: NumberWithUnitOptions, fallbackToDefaultCulture?: boolean): Array<ModelResult>;
export declare function recognizeCurrency(query: string, culture: string, options?: NumberWithUnitOptions, fallbackToDefaultCulture?: boolean): ModelResult[];
export declare function recognizeTemperature(query: string, culture: string, options?: NumberWithUnitOptions, fallbackToDefaultCulture?: boolean): ModelResult[];
export declare function recognizeDimension(query: string, culture: string, options?: NumberWithUnitOptions, fallbackToDefaultCulture?: boolean): ModelResult[];
export declare function recognizeAge(query: string, culture: string, options?: NumberWithUnitOptions, fallbackToDefaultCulture?: boolean): ModelResult[];
export default class NumberWithUnitRecognizer extends Recognizer<NumberWithUnitOptions> {

@@ -10,0 +10,0 @@ constructor(culture: string, options?: NumberWithUnitOptions, lazyInitialization?: boolean);

@@ -39,3 +39,3 @@ import { IExtractor, ExtractResult, IParser, ParseResult } from "@microsoft/recognizers-text";

parse(extResult: ExtractResult): ParseResult;
private addIfNotContained(keys, newKey);
private addIfNotContained;
}

@@ -47,5 +47,6 @@ export declare class BaseCurrencyParser implements IParser {

parse(extResult: ExtractResult): ParseResult;
private mergeCompoundUnit(compoundResult);
private checkUnitsStringContains(fractionUnitCode, fractionUnitsString);
private resolveText(prs, source, bias);
private mergeCompoundUnit;
private checkUnitsStringContains;
private resolveText;
private createCurrencyResult;
}

@@ -52,0 +53,0 @@ export declare class BaseMergedUnitParser implements IParser {

@@ -6,3 +6,3 @@ import { CultureInfo } from "@microsoft/recognizers-text-number";

readonly prefixList: ReadonlyMap<string, string>;
readonly ambiguousUnitList: ReadonlyArray<string>;
readonly ambiguousUnitList: readonly string[];
readonly extractType: string;

@@ -9,0 +9,0 @@ constructor(ci?: CultureInfo);

@@ -6,5 +6,5 @@ import { IExtractor, IParser } from "@microsoft/recognizers-text";

export declare abstract class PortugueseNumberWithUnitExtractorConfiguration implements INumberWithUnitExtractorConfiguration {
readonly abstract suffixList: ReadonlyMap<string, string>;
readonly abstract prefixList: ReadonlyMap<string, string>;
readonly abstract ambiguousUnitList: ReadonlyArray<string>;
abstract readonly suffixList: ReadonlyMap<string, string>;
abstract readonly prefixList: ReadonlyMap<string, string>;
abstract readonly ambiguousUnitList: readonly string[];
readonly abstract extractType: string;

@@ -17,3 +17,4 @@ readonly cultureInfo: CultureInfo;

readonly compoundUnitConnectorRegex: RegExp;
readonly pmNonUnitRegex: RegExp;
readonly nonUnitRegex: RegExp;
readonly ambiguousUnitNumberMultiplierRegex: RegExp;
constructor(ci: CultureInfo);

@@ -20,0 +21,0 @@ }

@@ -6,3 +6,3 @@ import { CultureInfo } from "@microsoft/recognizers-text-number";

readonly prefixList: ReadonlyMap<string, string>;
readonly ambiguousUnitList: ReadonlyArray<string>;
readonly ambiguousUnitList: readonly string[];
readonly extractType: string;

@@ -9,0 +9,0 @@ constructor(ci?: CultureInfo);

@@ -6,3 +6,3 @@ import { CultureInfo } from "@microsoft/recognizers-text-number";

readonly prefixList: ReadonlyMap<string, string>;
readonly ambiguousUnitList: ReadonlyArray<string>;
readonly ambiguousUnitList: readonly string[];
readonly extractType: string;

@@ -9,0 +9,0 @@ constructor(ci?: CultureInfo);

@@ -6,4 +6,5 @@ import { CultureInfo } from "@microsoft/recognizers-text-number";

readonly prefixList: ReadonlyMap<string, string>;
readonly ambiguousUnitList: ReadonlyArray<string>;
readonly ambiguousUnitList: readonly string[];
readonly extractType: string;
readonly ambiguousUnitNumberMultiplierRegex: RegExp;
constructor(ci?: CultureInfo);

@@ -10,0 +11,0 @@ }

@@ -6,3 +6,3 @@ import { CultureInfo } from "@microsoft/recognizers-text-number";

readonly prefixList: ReadonlyMap<string, string>;
readonly ambiguousUnitList: ReadonlyArray<string>;
readonly ambiguousUnitList: readonly string[];
readonly extractType: string;

@@ -9,0 +9,0 @@ constructor(ci?: CultureInfo);

@@ -6,5 +6,5 @@ import { IExtractor, IParser } from "@microsoft/recognizers-text";

export declare abstract class SpanishNumberWithUnitExtractorConfiguration implements INumberWithUnitExtractorConfiguration {
readonly abstract suffixList: ReadonlyMap<string, string>;
readonly abstract prefixList: ReadonlyMap<string, string>;
readonly abstract ambiguousUnitList: ReadonlyArray<string>;
abstract readonly suffixList: ReadonlyMap<string, string>;
abstract readonly prefixList: ReadonlyMap<string, string>;
abstract readonly ambiguousUnitList: readonly string[];
readonly abstract extractType: string;

@@ -17,3 +17,4 @@ readonly cultureInfo: CultureInfo;

readonly compoundUnitConnectorRegex: RegExp;
readonly pmNonUnitRegex: RegExp;
readonly nonUnitRegex: RegExp;
readonly ambiguousUnitNumberMultiplierRegex: RegExp;
constructor(ci: CultureInfo);

@@ -20,0 +21,0 @@ }

@@ -6,3 +6,3 @@ import { CultureInfo } from "@microsoft/recognizers-text-number";

readonly prefixList: ReadonlyMap<string, string>;
readonly ambiguousUnitList: ReadonlyArray<string>;
readonly ambiguousUnitList: readonly string[];
readonly extractType: string;

@@ -9,0 +9,0 @@ constructor(ci?: CultureInfo);

@@ -6,3 +6,3 @@ import { CultureInfo } from "@microsoft/recognizers-text-number";

readonly prefixList: ReadonlyMap<string, string>;
readonly ambiguousUnitList: ReadonlyArray<string>;
readonly ambiguousUnitList: readonly string[];
readonly extractType: string;

@@ -9,0 +9,0 @@ constructor(ci?: CultureInfo);

@@ -6,4 +6,5 @@ import { CultureInfo } from "@microsoft/recognizers-text-number";

readonly prefixList: ReadonlyMap<string, string>;
readonly ambiguousUnitList: ReadonlyArray<string>;
readonly ambiguousUnitList: readonly string[];
readonly extractType: string;
readonly ambiguousUnitNumberMultiplierRegex: RegExp;
constructor(ci?: CultureInfo);

@@ -10,0 +11,0 @@ }

@@ -7,2 +7,6 @@ export declare namespace BaseNumbers {

const PlaceHolderDefault = "\\D|\\b";
const NumberMultiplierRegex = "(K|k|M|G|T|B|b)";
const MultiplierLookupRegex = "(k|m|t|g|b)";
const CurrencyRegex = "(((?<=\\W|^)-\\s*)|(?<=\\b))\\d+\\s*(b|m|t|g)(?=\\b)";
const CommonCurrencySymbol = "(\u00A5|\\$|\u20AC|\u00A3|\u20A9)";
}

@@ -7,2 +7,3 @@ export declare namespace BaseUnits {

const AmbiguousTimeTerm = "pm";
const AmbiguousUnitNumberMultiplierRegex = "(\\s[Kk])";
}

@@ -10,3 +10,3 @@ export declare namespace ChineseNumericWithUnit {

const FractionalUnitNameToCodeMap: ReadonlyMap<string, string>;
const CompoundUnitConnectorRegex = "(?<spacer>又|再)";
const CompoundUnitConnectorRegex = "(?<spacer>\u53C8|\u518D)";
const CurrencyPrefixList: ReadonlyMap<string, string>;

@@ -13,0 +13,0 @@ const CurrencyAmbiguousValues: string[];

@@ -23,2 +23,3 @@ export declare namespace EnglishNumericWithUnit {

const AmbiguousWeightUnitList: string[];
const AmbiguityFiltersDict: ReadonlyMap<string, string>;
}

@@ -22,2 +22,3 @@ export declare namespace FrenchNumericWithUnit {

const AmbiguousWeightUnitList: string[];
const AmbiguityFiltersDict: ReadonlyMap<string, string>;
}

@@ -10,5 +10,5 @@ export declare namespace JapaneseNumericWithUnit {

const FractionalUnitNameToCodeMap: ReadonlyMap<string, string>;
const CompoundUnitConnectorRegex = "(?<spacer>と)";
const CompoundUnitConnectorRegex = "(?<spacer>\u3068)";
const CurrencyPrefixList: ReadonlyMap<string, string>;
const CurrencyAmbiguousValues: string[];
}
export declare namespace PortugueseNumericWithUnit {
const AgeSuffixList: ReadonlyMap<string, string>;
const AmbiguousAgeUnitList: string[];
const AreaSuffixList: ReadonlyMap<string, string>;

@@ -4,0 +5,0 @@ const CurrencySuffixList: ReadonlyMap<string, string>;

export declare namespace SpanishNumericWithUnit {
const AgeSuffixList: ReadonlyMap<string, string>;
const AmbiguousAgeUnitList: string[];
const AreaSuffixList: ReadonlyMap<string, string>;

@@ -9,3 +10,3 @@ const AreaAmbiguousValues: string[];

const AmbiguousCurrencyUnitList: string[];
const DimensionSuffixList: ReadonlyMap<string, string>;
const InformationSuffixList: ReadonlyMap<string, string>;
const AmbiguousDimensionUnitList: string[];

@@ -12,0 +13,0 @@ const LengthSuffixList: ReadonlyMap<string, string>;

{
"name": "@microsoft/recognizers-text-number-with-unit",
"version": "1.1.4",
"version": "1.2.7",
"description": "recognizers-text-number-with-unit provides robust recognition and resolution of numbers with units expressed in multiple languages.",

@@ -26,3 +26,3 @@ "author": "Microsoft Corp.",

"engines": {
"node": ">=6.0.0"
"node": ">=10.3.0"
},

@@ -38,5 +38,5 @@ "scripts": {

"lodash.max": "^4.0.1",
"@microsoft/recognizers-text": "~1.1.4",
"@microsoft/recognizers-text-number": "~1.1.4"
"@microsoft/recognizers-text": "~1.2.7",
"@microsoft/recognizers-text-number": "~1.2.7"
}
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc