Secret of the movie lines we remember

"Hasta la vista, baby" was uttered by a murderous cyborg played by Arnold Schwarzenegger, but could a computer recognise it as one of cinema's most memorable lines? Yes, according to American researchers.

A team at Cornell University has created a computer programme to find the formula behind some of cinema's most enduring lines, from Dirty Harry's "Do you feel lucky, punk?" to Casablanca's "Here's looking at you, kid."

In its current form, the algorithm may not be a huge help to budding screenwriters looking for their first hit, but its creators believe that eventually it may well come out with a few classic quotes, or at least a successful advertising slogan, on its own.

Computer scientist Cristian Danescu-Niculescu-Mizil initially wanted to study political speeches and news bulletins to pick out the best lines, but when that proved too difficult, the team turned its attention to films to analyse what drove certain lines into popular culture.

For their research paper, titled "You had me at hello: How phrasing affects memorability", they scoured the internet for film scripts and studied 1000 films, highlighting memorable quotes selected by users of the film website imdb.com.

The team then asked people to judge between two quotes, one memorable and the other less so, from films they had not seen. In about 78 per cent of cases, people could detect the more memorable quote.

The researchers found that the more memorable quotes were made up of word combinations unlikely to appear elsewhere in the film. Yet the grammatical structures of the quotes tended to be ordinary.

Other interesting quirks of the memorable quotes included more of a use of the indefinite article ("a") rather than the definite article ("the"), verbs in the past tense and use of pronouns other than "you".

The best quote, according to Danescu-Niculescu-Mizil, was: "Frankly, my dear, I don't give a damn," uttered by Clark Gable as Rhett Butler in Gone with the Wind. Danescu-Niculescu-Mizil said: "That quote ticks a number of boxes. It has the general aspect but also it has an unusual combination of 'my dear' and 'damn'."

He also cited other general quotes such as the opening line of Star Wars: "A long time ago, in a galaxy far, far away."

He said some trends could be detected but there was no overall formula, as "a phrase like 'I'll be back' isn't easily categorised".

He added that generating lines of its own would be "the next step. You know what you want to say, but how do you make it more memorable?