🕵️Detection Functions

A set of functions to detect the numbers from text or arrays.

Table of Contents

detectNumberPhrasesPosition

Syntax

detectNumberPhrasesPosition(wordlist);

Description

Finds the start and end positions of number phrases within the given wordlist.

Parameters

  • wordlist (Array): An array of words (strings) to search for number phrases.

Returns

  • phrases (Array): An array of arrays containing the start and end positions of detected number phrases.

Example

const wordlist = ["أربعة", "عشر", "كتب"];
const phrases = detectNumberPhrasesPosition(wordlist);
console.log(phrases); // [[0, 1]]

detectNumbers

Syntax

Description

Detects and tags words within the given wordlist based on their association with numbers.

Parameters

  • wordlist (Array): An array of words (strings) to search for number-associated words.

Returns

  • taglist (Array): An array of tags corresponding to the input words' association with numbers. Tags: "DB" (number begin), "DI" (number inside), "O" (other).

Example

detectNumberWords

Syntax

Description

Detects number words within the given text and calculates the vocalized similarity between the detected number words and their vocalized counterparts.

Parameters

  • text (string): The input text containing number words.

Returns

  • string. Logs the vocalized similarity and related information to the console.

Example

Last updated