Menu

Checking Borat quotes with Python's difflib: Wikiquote vs the film transcript
πŸ“°

Checking Borat quotes with Python's difflib: Wikiquote vs the film transcript

DEV Community: nlpΒ·Jeremiah SayΒ·9 days ago
#N0bMBa7u
#devtonlp#devto#dev#line#transcript
Long article (1667 words) β€” no AI summary yet.
Reading 0:00
15s threshold

Most movie quote pages copy each other. One site types a line from memory, another copies it, and soon "Very nice!" is followed by words nobody in the film ever said.

For our Borat quotes page we used a simple rule: a film line goes on the page only if two separate texts agree on it. The first is Wikiquote. The second is a transcript of the film. A short Python script decides whether they agree.

Of the 97 Borat lines the script checked, 74 passed. This post covers how it decides, why the other 23 failed, and a mistake the check missed that I found while writing this.

The two witnesses

Witness 1: Wikiquote. We fetch each film's page as wikitext ( action=raw ) and parse it into JSON: one record per line, with the speaker and the film. The wording on our page is copied from this file, never retyped.

Witness 2: a transcript. For Borat (2006) we used the Springfield! Springfield! transcript. For Borat Subsequent Moviefilm (2020) we used the Scraps from the Loft transcript.…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.