Aller au contenu

Verify an AI-quoted passage against the printed page

Check an AI-given quotation, volume and page against the Shamela library: resolve the edition and printed page, read it, tell main text from footnote.

Cette page n’est pas encore traduite — version anglaise affichée.

Sur cette page

An assistant that quotes a classical book from memory can give you a real title, a plausible volume and page, and wording that is close but not exact. The fix is to check the quotation against the book instead of trusting it. This page shows how, with the tools on https://qurangallery.com/mcp/shamela.

If you have the wording, start with shamela_verify_quote: it checks whether the words occur in the library and says where. If you also have a volume and page, or need to read the page around the words, the four steps further down do that, and each step is a tool call whose result decides the next one.

The one-call check: shamela_verify_quote

Give it the Arabic wording (at least three words) and, to narrow the search, a scope or a bookId. With neither, it searches the whole library and says so in searched. If both are given, bookId wins and searched.ignoredScope names the scope that was set aside.

{
	"name": "shamela_verify_quote",
	"arguments": {
		"quote": "إِنَّمَا الْأَعْمَالُ بِالنِّيَّاتِ، وَإِنَّمَا لِكُلِّ امْرِئٍ مَا نَوَى",
		"bookId": 1681,
		"limit": 1
	}
}

The answer has verdict: "found" and one match: docId 1681:10, volume 1, printed page 6, edition ط السلطانية, matchedIn: "body", exact: true, differences: []. The docId goes straight into fetch to read the page.

What “exact” means. The tool ignores diacritics, tatweel, alef forms (أ إ آ ٱ as ا), alef maqsura (ى as ي), punctuation and runs of whitespace when it looks for the words. exact is true only when the page’s characters equal the quotation’s once whitespace and the order of combining marks are set aside. The same sentence typed without diacritics, إنما الأعمال بالنيات وإنما لكل امرئ ما نوى, is still found, but with exact: false and differences such as the page has 30 more diacritic mark(s) than the quotation and punctuation differs. A found quotation with exact: false is real wording in a different spelling, not a miss.

Main text or footnote. matchedIn is body for the author’s text and foot for the editor’s or commentator’s footnote. When it is foot, the answer’s note says the words are the editor’s, not the author’s. When the words are in both, body is reported.

Not found. A sentence that is in none of the eight primary hadith collections, searched with scope: "hadith-primary", returns:

{
	"verdict": "not_found",
	"matches": [],
	"searched": { "scope": "hadith-primary", "normalisation": ["…"] },
	"note": "Not found in the searched scope: the "hadith-primary" scope (…). This says only that no page there carries these words in this order; it does not mean the quotation is false, …"
}

“Not found” is a statement about the scope that was searched. It does not say the quotation is false or that it appears nowhere. Widen the scope, name another book with bookId, or try a shorter distinctive part of the wording.

Input errors. A quote of fewer than three Arabic words, a quote with no Arabic script, an unknown scope and a bad bookId each return a tool error that names the fix. limit is at most 10 (default 5).

The tool reports where words are printed. It does not say whether a passage is authentic, and it is not a ruling.

Before you start: is the page number comparable?

A page number only means something against the printing it came from. Sahih al-Bukhari in the Sultaniyya edition puts the hadith «إنما الأعمال بالنيات» at volume 1, page 6. The edition edited by al-Bugha puts the same hadith at volume 1, page 3. Both are correct for their own printing.

The library also holds books whose page numbers are not a printing’s at all. Of the 8,594 entries, 7,177 are flagged by Shamela as matching a printed edition and 1,417 are not: their numbers are Shamela’s own. A quotation cannot be verified against a printed page in those books, and a citation that uses such a number should not be passed off as the printing’s.

So the first question is always: which edition did the quotation claim?

Step 1. Resolve the edition

{
	"name": "shamela_find",
	"arguments": { "kind": "work", "title": "صحيح البخاري", "edition": "ط السلطانية" }
}

This returns status: "exact" with match.book_id 1681 and citable: true. Two things can go differently:

  • The edition is not in the library. Asking for ط دار طوق النجاة returns status: "not_found", reason: "edition_not_found" and an available_editions list: al-Bugha, the Saharanpuri-Nadwi edition, al-Ta’sil, the Ata’at al-Ilm entry (whose citable is false) and the Sultaniyya. The quotation cannot be checked against that printing here; say so, and offer the nearest ones.
  • citable is false. Stop. The numbering is not a printing’s.

The title must be the start of the work’s name, and author is a filter, not a search. For a title that two works share, such as al-Mughni, ambiguity says whether the doubt is about the edition or about the work.

Step 2. Resolve the printed page

{
	"name": "shamela_cite",
	"arguments": { "mode": "printed_page", "book_id": 1681, "part": "1", "page": 6 }
}

The result is status: "ok" and page_ids: [9, 10, 11]. One printed page can span several library pages, so read all of them. Reading only the first and concluding the quotation is absent is a false negative.

When the citation is wrong, the status says how:

statusMeaning
page_not_in_partThe volume exists but has no such page. For page 99999 of volume 1 the result carries page_range 2 to 173. The citation belongs to another printing, or was invented
part_not_foundThat volume does not exist. available_parts lists the ones that do
no_printed_paginationThe book has no printed numbering to resolve
book_not_downloadedThe library does not hold that book’s text

Volume labels are not always digits. A printing can have a front-matter part labelled «المقدمة» (the introduction), and its page is cited as, for example, المقدمة/ 5 in the al-Bugha edition.

Step 3. Read the page and check the words

{ "name": "shamela_read", "arguments": { "book_id": 1681, "page_id": 10 } }

The page comes back as three fields. body is the author’s text, foot is the editor’s footnotes and comment is readers’ notes. For page id 10, body contains the hadith in full: «إِنَّمَا الْأَعْمَالُ بِالنِّيَّاتِ، وَإِنَّمَا لِكُلِّ امْرِئٍ مَا نَوَى…», and foot is empty.

Compare the quotation with body and with foot separately. The layer is part of the claim: “Abu Dawud says…” is false when the words are in an editor’s note that quotes someone else (Reading a result).

A search can do steps 2 and 3 in one move when you have the wording but not the page. shamela_search_library takes the quoted phrase and a scope; each passage carries printedPage and matchedIn, and the result carries relaxedToTokens. If relaxedToTokens is true, the exact phrase was not found and the pages shown only share vocabulary with it.

Step 4. Write the citation

{ "name": "shamela_cite", "arguments": { "book_id": 1681, "page_id": 10, "style": "short" } }

This returns البخاري، صحيح البخاري، ج ١، ص ٦. together with components, including auto_numbered: false. The default shamela style gives «صحيح البخاري» (١/ ٦). Other styles are full, bibtex and ris. For a book with Shamela’s own numbering, auto_numbered is true, and every style except short says in the citation that the numbering is Shamela’s.

Reading the outcome

What you findWhat you may say
Words in body of the cited pageThe quotation is printed there, in the author’s text
Words only in footThe quotation is in the editor’s note, not the author’s text
Words on a different page of the same editionThe wording is real and the page reference is wrong
Words in another edition onlyThe reference belongs to a different printing
Words nowhere in the scope you searchedThey are not in those books. This does not prove they appear nowhere
The cited page does not existThe reference is for another printing, or was invented

A search result, including an empty one, is a statement about the scope you searched, not about the whole tradition. Say which books were searched.

What this does and does not establish

It establishes where a passage is printed and in which layer. It does not establish that the passage is authentic, that the attribution inside the passage is sound, or that the assistant read it fairly. Those are judgements for a scholar. See Grounding rules for the contract an assistant should follow when it quotes from these tools.

Modifier cette page sur GitHub