# Detection Functions

### Table of Contents

* [detectNumberPhrasesPosition](#detectnumberphrasesposition)
* [detectNumbers](#detectnumbers)
* [detectNumberWords](#detectnumberwords)

### detectNumberPhrasesPosition

**Syntax**

```js
detectNumberPhrasesPosition(wordlist);
```

**Description**&#x20;

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**

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

### detectNumbers

**Syntax**

```js
detectNumbers(wordlist);
```

**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**

```js
const wordlist = ["أربعة", "عشر", "كتب"];
const taglist = detectNumbers(wordlist);
console.log(taglist); // ["DB", "DI", "O"]
```

### detectNumberWords

**Syntax**

```js
detectNumberWords(text);
```

**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**

```js
const text = "أربعة عشر كتب";
console.log(detectNumberWords(text));
// output: 
// -2		أَرْبَعَةَ عَشْر
 //     14  أربعة عشر كتب
// كتب	كتب	true
```
