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