Mutashabihat ul Quran

Phrase

Tags

Download Links

About mutashabihat data

Mutashabihat are phrases that repeat, word for word or nearly so, in different ayahs of the Quran. For anyone memorising the Quran they are the classic source of mix-ups: you start one ayah and finish it with the wording of another.

This resource lists those shared phrases and every place each one appears, down to the exact words, so you can highlight them and show similar ayahs side by side.

Example

The phrase وَقَٰتِلُواْ فِي سَبِيلِ ٱللَّهِ ("and fight in the way of Allah") appears 13 times, in 11 ayahs across 5 surahs. Some places use exactly the same words; others are close variations:

Ayah Words Text
2:190 1–4 وَقَٰتِلُواْ فِي سَبِيلِ ٱللَّهِ
2:244 1–4 وَقَٰتِلُواْ فِي سَبِيلِ ٱللَّهِ
2:246 18–21 نُّقَٰتِلۡ فِي سَبِيلِ ٱللَّهِ
3:13 9–12 تُقَٰتِلُ فِي سَبِيلِ ٱللَّهِ
In the Preview tab, pick an ayah to see its shared phrases highlighted.

JSON format

The download is a ZIP archive with two JSON files:

  • phrases.json: every shared phrase, with each place it appears.
  • phrase_verses.json: for each ayah, the ids of the phrases in it.

phrases.json

An object keyed by phrase id. This is phrase 859, shortened to three of its ayahs:

JSON
{
  "859": {
    "surahs": 5,
    "ayahs": 11,
    "count": 13,
    "source": { "key": "2:190", "from": 1, "to": 4 },
    "ayah": {
      "2:190": [[1, 4]],
      "2:244": [[1, 4]],
      "3:13": [[9, 12]]
    }
  }
}
Field Description
surahs How many surahs the phrase appears in
ayahs How many ayahs it appears in
count How many times it appears in total. This can be more than ayahs, because one ayah can contain it twice.
source The ayah and word range the phrase text is taken from. Use it to show the phrase itself.
ayah Every ayah the phrase appears in, keyed by surah:ayah. Each value is a list of [from, to] word ranges, since an ayah can contain the phrase more than once.
Word positions start at 1. [9, 12] means the 9th to the 12th word of the ayah, inclusive.

phrase_verses.json

An object keyed by ayah, listing the ids of the phrases found in it. Use it to look up an ayah quickly.

JSON
{
  "2:190": [859],
  "2:244": [859],
  "3:13": [859, 15990]
}
These files have word positions, not word text. To show the words, use a word-by-word Quran script.

Highlighting phrases in an ayah

  1. Look up the ayah in phrase_verses.json to get its phrase ids.
  2. For each id, read phrases[id].ayah[ayahKey] to get the word ranges in that ayah.
  3. Style the words in those ranges, for example with a colour per phrase.
JavaScript
// phrases and phraseVerses: the two JSON files.
// words: the ayah's words in order, from a word-by-word Quran script.
function highlightedWords(ayahKey, words, phrases, phraseVerses) {
  const colours = ["#fde68a", "#bfdbfe", "#bbf7d0", "#fecaca"];
  const highlight = new Array(words.length).fill(null);

  (phraseVerses[ayahKey] || []).forEach((phraseId, index) => {
    const ranges = phrases[phraseId].ayah[ayahKey] || [];

    ranges.forEach(([from, to]) => {
      for (let position = from; position <= to; position++) {
        highlight[position - 1] = colours[index % colours.length];
      }
    });
  });

  return words.map((word, i) => ({ word, colour: highlight[i] }));
}

// highlightedWords("2:190", words, phrases, phraseVerses)
// → the first four words get a colour; the rest get null.

Show similar ayahs

To list the ayahs that share wording with the one being read, collect the other ayahs of each of its phrases:

JavaScript
function similarAyahs(ayahKey, phrases, phraseVerses) {
  const similar = new Set();

  (phraseVerses[ayahKey] || []).forEach((phraseId) => {
    Object.keys(phrases[phraseId].ayah).forEach((key) => {
      if (key !== ayahKey) similar.add(key);
    });
  });

  return [...similar];
}

// similarAyahs("2:190", phrases, phraseVerses)
// → ["2:244", "2:246", "3:13", "4:74", ...]