โŒStrip Functions

set of utility functions for stripping various characters from Arabic text.

Table of Contents

stripHarakat

Syntax

stripHarakat(text)

Description

Removes harakat (vowel marks) from the given text if it is vocalized except Shadda.

Parameters

  • text (string): The input Arabic text.

Returns

  • (string): The modified text with harakat except Shadda removed.

Example

const text = "ุงู„ุณู‘ูŽู„ูŽุงู…ู ุนูŽู„ูŽูŠู’ูƒูู…ู’";
const strippedHarakat = stripHarakat(text);
console.log(strippedHarakat); // "ุงู„ุณู‘ู„ุงู… ุนู„ูŠูƒู…"

stripLastHaraka

Syntax

stripLastHaraka(text)

Description

Removes the last haraka (vowel mark) from the given text if it is vocalized.

Parameters

  • text (string) The input Arabic text.

Returns

  • string The modified text with the last haraka removed.

Example

const text = "ุงู„ุณู‘ูŽู„ูŽุงู…ู ุนูŽู„ูŽูŠู’ูƒูู…ู’";
const strippedLastHaraka = stripLastHaraka(text);
console.log(strippedLastHaraka); // "ุงู„ุณู‘ูŽู„ูŽุงู…ู ุนูŽู„ูŽูŠู’ูƒูู…"

stripTashkeel

Syntax

stripTashkeel(text)

Description

Removes tashkeel (diacritic marks) from the given text if it is vocalized.

Parameters

  • text (string) The input Arabic text.

Returns

  • string The modified text with tashkeel removed.

Example

const text = "ุงู„ุณู‘ูŽู„ูŽุงู…ู ุนูŽู„ูŽูŠู’ูƒูู…ู’";
const strippedTashkeel = stripTashkeel(text);
console.log(strippedHarakat); // "ุงู„ุณู„ุงู… ุนู„ูŠูƒู…"

stripSmall

Syntax

stripSmall(text)

Description

Removes all Small Alef (ุงู„ุฎู†ุฌุฑูŠุฉ),Small WAW ,Small Yeh Arabic from the given text.

Parameters

  • text (string) The input Arabic text.

Returns

  • string The modified text with small Arabic Small Alef (ุงู„ุฎู†ุฌุฑูŠุฉ),Small WAW ,Small Yeh removed.

Example

const text = "ุงู„ุณู‘ูŽู„ูŽุงู…ู ุนูŽู„ูŽูŠู’ูƒูู…ู’";
const strippedSmall = stripSmall(text); 
console.log(strippedSmall); // "ุงู„ุณู‘ูŽู„ูŽุงู…ู ุนูŽู„ูŽูŠู’ูƒูู…ู’"

stripTatweel

Syntax

stripTatweel(text)

Description

Removes tatweel (elongation character) from the given text.

Parameters

  • text (string) The input Arabic text.

Returns

  • string The modified text with tatweel removed.

Example

const text = "ุงู„ุณู‘ูŽู€ู„ูŽุงู…ู ุนูŽู„ูŽู€ูŠู’ูƒูู…ู’";
const strippedTatweel = stripTatweel(text);
console.log(strippedTatweel); // "ุงู„ุณู‘ูŽู„ูŽุงู…ู ุนูŽู„ูŽูŠู’ูƒูู…ู’"

stripShadda

Syntax

stripShadda(text)

Description

Removes shadda (stress mark) from the given text.

Parameters

  • text (string): The input Arabic text.

Returns

  • string The modified text with shadda removed.

Example

const text = "ุงู„ุณู‘ูŽู„ูŽุงู…ู ุนูŽู„ูŽูŠู’ูƒูู…ู’";
const strippedShadda = stripShadda(text);
console.log(strippedShadda); // "ุงู„ุณูŽู„ูŽุงู…ู ุนูŽู„ูŽูŠู’ูƒูู…ู’"

Last updated