#!/usr/local/bin/ruby # test3.rb -- like test2 but faster # by Filip Pizlo, 2001 # expected output: all words in the input document, in order of appearance # use getwords and Dussel.txt for comparison require 'AVL' dict=AVL::AVL.new File.open(ARGV[0]).read.split(/[^a-zA-Z0-9]+/).each { | word | puts word unless dict.insert word, true }