📖Additional Functions

Table of Contents

isUnit

Syntax

isUnit(word);

Description

Checks if the given word is a unit word.

Parameters

  • word (string): The input word to be checked.

Returns

  • boolean: Returns true if the word is a unit word, otherwise false.

Example

const word = "متر";
console.log(isUnit(word)); // true

getPreviousTag

Syntax

getPreviousTag(word);

Description

Determines the grammatical case of the given word.

Parameters

  • word (string): The input word to be analyzed.

Returns

  • string: Returns the grammatical case of the word: "منصوب", "مجرور", "مرفوع", or an empty string if none of these.

Example

const word = "في";
console.log(getPreviousTag(word)); // "مجرور"

preTashkeelNumber

Syntax

preTashkeelNumber(wordlist);

Description

Vocalizes numbers within the given wordlist based on their grammatical case.

Parameters

  • wordlist (Array): An array of words (strings) to be processed.

Returns

  • vocalizedList (Array): An array of words with numbers vocalized according to their grammatical case.

Example

const wordlist = ["في", "ثلاثة", "أشجار"];
const vocalizedList = preTashkeelNumber(wordlist);
console.log(vocalizedList); // ["في", "ثلاثَة", "أشجار"]

Last updated