Chain, Chain, Chain (was Re: zed shaw zed shaw zed shaw)

Okay, I’ve been playing with doing this programatically. I’m not yet
convinced that it’s bug free, but I’ve found some rather long movie
title chains using the non-imdb list posted earlier:

10 ITEMS OR THAN FOR AND OF
THE BANG YOURE OF OF CAN
UNTIL 54 WHERE ARE CAN COUNT ON MYSELF AM
TRYING TO BREAK YOUR OF THE
AND TO OF DEAD AND LOVING CAME
FROM BENEATH THE OF AND BECOMES MAJESTY
MRS AND
TRADE AND THE OF WITH
DIRTY OF OF RUSH
COLD IN THE OF THE
OF AND THE MONSTER FROM FALLS ON
MURDER SPIRIT OF THE AND TEDS
BOGUS TO THE CENTER OF THE GIRLS ARE COME
EASY YOU SEE HIM NOW YOU BOTHER TO
THE AND WATER AND OTHER WHEN
WE JOE HAWK TO CANT TAKE IT WITH LIGHT UP
MY AS A PARTY<3> NINJAS KICK
TO OF TREK IV THE VOYAGE IN
THE OF THE HIGH
IS GIRLS WILL BE JUST WANT TO
HAVE AND FANCY WILLY 2 THE ADVENTURE ALONE<3> NINJAS
KNUCKLE CLOSE AND OF THE CRY
OVER DANNY FOR AN OF TOLD ME
DIE YOUR EYES THE STRONG SURVIVE A CELEBRATION
OF OF WALKED AND
LIKE WITHOUT ONLY LIVE IN THE OR SOMETHING
LIKE HAPPENED AT THE WORLDS OF WISH V THE FACE
OF UPON A TREK THE MOTION
OF MEETS THE WOLF ON IN THE
SCHOOL OF THE OF OF THE
LIVING MAN AND ABOUT AND THE
OTHER EVERY OF THE ON
AS UP IN RIVER ME
WILL OF THUNDER

That’s 175 titles strung together. The <> bracketed words are the
ones which are the last of one title and the first of another. Lot’s
of two-word titles show up in this chain.

By the way, a word about IMDB and data scraping. Quite a few years
ago, as an exercise in learning Java, I decided to write a program
which would look for “six degrees of Kevin Bacon” links between actors
in the IMDB. This was a spare moment project at work. After a few
days, I got an e-mail from IMDB saying that they had detected my
‘robot’ and had disabled access to IMDB from my ip address, which to
them was the proxy server for the company (Object Technology
International). So OTI didn’t have access to IMDB for a few days
while they considered my contrite reply and promise to cease and
desist.


Rick DeNatale

My blog on Ruby
http://talklikeaduck.denhaven2.com/

On Jan 5, 2008 2:33 PM, Rick DeNatale [email protected] wrote:

COLD IN THE OF THE
HAVE AND FANCY WILLY 2 THE ADVENTURE ALONE<3> NINJAS
OTHER EVERY OF THE ON
AS UP IN RIVER ME
WILL OF THUNDER

Saw that one in the theaters. Save your money and wait for the torrent.

TwP

Rick DeNatale wrote:

Okay, I’ve been playing with doing this programatically. I’m not yet
convinced that it’s bug free, but I’ve found some rather long movie
title chains using the non-imdb list posted earlier:

10 ITEMS OR THAN FOR AND OF

WILL OF THUNDER

Why didn’t it find Thunder Road[1]? (And then maybe Road Trip to
Bountiful…)

[1] http://us.imdb.com/title/tt0052293/

Okay, I’ve been playing with doing this programatically. I’m not yet
convinced that it’s bug free, but I’ve found some rather long movie
title chains using the non-imdb list posted earlier:

code!

Why didn’t it find Thunder Road[1]? (And then maybe Road Trip to
Bountiful…)

[1] http://us.imdb.com/title/tt0052293/

This is actually a very interesting question. I think the answer is
probably “Travelling Salesman Problem.”


Giles B.

Podcast: http://hollywoodgrit.blogspot.com
Blog: http://gilesbowkett.blogspot.com
Portfolio: http://www.gilesgoatboy.org
Tumblelog: http://giles.tumblr.com

There must be a bug somewhere–in IMDB, or in the script.
OK. But why it didn’t find X combination when it did find Y
combination, surely that’s a complex question to answer.


Giles B.

Podcast: http://hollywoodgrit.blogspot.com
Blog: http://gilesbowkett.blogspot.com
Portfolio: http://www.gilesgoatboy.org
Tumblelog: http://giles.tumblr.com

Giles B. wrote:

Why didn’t it find Thunder Road[1]? (And then maybe Road Trip to
Bountiful…)

[1] http://us.imdb.com/title/tt0052293/

This is actually a very interesting question. I think the answer is
probably “Travelling Salesman Problem.”

This is not an optimization problem (not as stated so far, anyway).

There must be a bug somewhere–in IMDB, or in the script.

Giles B. wrote:

OK. But why it didn’t find X combination when it did find Y
combination, surely that’s a complex question to answer.

Actually, what I overlooked is that Rick’s original post said he used a
“non-imdb list”, and I found “Thunder Road” on imdb. Probably his list
just doesn’t include this one.

[some sadly uncited person wrote]

Okay, I’ve been playing with doing this programatically. I’m not
yet convinced that it’s bug free, but I’ve found some rather long
movie title chains using the non-imdb list posted earlier:

I’m surprised no-one’s found a loop yet. Is there one? What’s the
shortest?

Regards,

Jeremy H.

On 2008-01-06, Chris S. [email protected] wrote:

“BREAKER BREAKER\n”, “BUDDY BUDDY\n”, “CHUD II BUD THE CHUD\n”,
“CORRINA CORRINA\n”, “DEATH WISH V THE FACE OF DEATH\n”, “DIE MOMMIE
DIE\n”, “DIE MONSTER DIE\n”, “DREAM A LITTLE DREAM\n”, “EAST IS
EAST\n”, “EYE FOR AN EYE\n”, “GIRLS GIRLS GIRLS\n”, “GIRLS WILL BE
GIRLS\n”, “HIGH SCHOOL HIGH\n”, “JULIA AND JULIA\n”, “JUNGLE 2
JUNGLE\n”, “KRAMER VS KRAMER\n”, “LADYBIRD LADYBIRD\n”, “LIAR LIAR\n”,
“MELINDA AND MELINDA\n”, “MOMENT BY MOMENT\n”, “MURDER AND MURDER\n”,
“NIAGARA NIAGARA\n”, “NIGHTBREED \n”, “SCREAM BLACULA SCREAM\n”,
“SISTER MY SISTER\n”, “SUNDAY BLOODY SUNDAY\n”, “THEGUEST\n”, “THEY
SHOOT HORSES DONT THEY\n”, “TIME AFTER TIME\n”, “TORA TORA TORA\n”,
“WRONGSTAND\n”, “YI YI\n”, “YOU CANT TAKE IT WITH YOU\n”]

D’oh! Neat! Any twofers? (Nitpick: the code should eliminate single
word titles.)

Jeremy H.

On Jan 5, 2008 6:14 PM, Jeremy H. [email protected] wrote:

[some sadly uncited person wrote]

Okay, I’ve been playing with doing this programatically. I’m not
yet convinced that it’s bug free, but I’ve found some rather long
movie title chains using the non-imdb list posted earlier:

I’m surprised no-one’s found a loop yet. Is there one? What’s the
shortest?

The shortest is easy:

File.readlines(‘MOVIES.LST’).find_all {|line| line.split.first ==
line.split.last}
["\n", “AREMEMBER\n”, “AUTHOR AUTHOR\n”, “BEST OF THE BEST\n”,
“BREAKER BREAKER\n”, “BUDDY BUDDY\n”, “CHUD II BUD THE CHUD\n”,
“CORRINA CORRINA\n”, “DEATH WISH V THE FACE OF DEATH\n”, “DIE MOMMIE
DIE\n”, “DIE MONSTER DIE\n”, “DREAM A LITTLE DREAM\n”, “EAST IS
EAST\n”, “EYE FOR AN EYE\n”, “GIRLS GIRLS GIRLS\n”, “GIRLS WILL BE
GIRLS\n”, “HIGH SCHOOL HIGH\n”, “JULIA AND JULIA\n”, “JUNGLE 2
JUNGLE\n”, “KRAMER VS KRAMER\n”, “LADYBIRD LADYBIRD\n”, “LIAR LIAR\n”,
“MELINDA AND MELINDA\n”, “MOMENT BY MOMENT\n”, “MURDER AND MURDER\n”,
“NIAGARA NIAGARA\n”, “NIGHTBREED \n”, “SCREAM BLACULA SCREAM\n”,
“SISTER MY SISTER\n”, “SUNDAY BLOODY SUNDAY\n”, “THEGUEST\n”, “THEY
SHOOT HORSES DONT THEY\n”, “TIME AFTER TIME\n”, “TORA TORA TORA\n”,
“WRONGSTAND\n”, “YI YI\n”, “YOU CANT TAKE IT WITH YOU\n”]

There must be a bug somewhere–in IMDB, or in the script.

OK. But why it didn’t find X combination when it did find Y
combination, surely that’s a complex question to answer.

Actually, what I overlooked is that Rick’s original post said he used a
“non-imdb list”, and I found “Thunder Road” on imdb. Probably his list
just doesn’t include this one.

Ah, OK. I was wondering. Yeah, Rick was using (I think) the official
list from ITA. I posted it the other day.


Giles B.

Podcast: http://hollywoodgrit.blogspot.com
Blog: http://gilesbowkett.blogspot.com
Portfolio: http://www.gilesgoatboy.org
Tumblelog: http://giles.tumblr.com

On Jan 5, 2008 5:05 PM, Joel VanderWerf [email protected] wrote:

Bountiful…)
Well first of all, because thunder road isn’t on that list.

Second, because it’s the longest title the program found in the time I
gave to run it. As I said the program isn’t of the quality that I’d
prefer to share, but what the heck. It’s a pretty dumb search, and I
have it print a chain only the first time it finds one longer (in
terms of the number of movies) than any it had found before. It’s
full of “the simplest thing that could possibly work” decisions with
the idea of making it work before trying to make it fast.

require ‘net/http’
class Title

@first_words = Hash.new {|h,k| h[k] = []}

def self.register(title)
@first_words[title.first_word] << title if title.first_word
end

def self.process_lines(string)
string.each_line do |line|
self.new(line)
end
end

def self.generate_titles
result = []
@first_words.keys.sort.each do |fw|
all_starting_with(fw).each do |title|
title.chains do | chain |
result << chain
end
end
end
end

def self.all_starting_with(word)
@first_words[word]
end

def print_chain(chain)
puts “#{chain.length}: #{chain.inject(chain.first.first_word) {
|chained_title, title| title.chain_to(chained_title)}}”
end

def chain_to(string)
“#{string.sub(/\s(\S+)$/,’<\1>’)} #{@words[[email protected]].join(’
')}”
end

def self.max_chain?(chain)
@max ||= 0
if chain.length > @max
@max = chain.length
true
else
false
end
end

def chains(chain = [])
root_chain = chain << self
raise “Duplicate title #{print_chain(root_chain)}” unless
root_chain.length == root_chain.uniq.length
print_chain(root_chain) if self.class.max_chain?(root_chain)
result = []
self.class.all_starting_with(self.last_word).each do |title|
unless root_chain.include?(title)
title.chains(root_chain.dup).each do |chain|
result << chain
end
end
end
result
end

def initialize(title_string)
@words = title_string.strip.split
self.class.register(self)
end

def first_word
@words.first
end

def last_word
@words.last
end

def to_s
@words.join(’ ')
end

def inspect
to_s
end
end
_,x =
Net::HTTP.new(“itafullsite.dev.neptuneweb.com”).get("/careers/puzzles/MOVIES.LST")
Title.process_lines(x)
p Title.generate_titles


Rick DeNatale

My blog on Ruby
http://talklikeaduck.denhaven2.com/

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs