Beefy Boxes and Bandwidth Generously Provided by pair Networks BBQ
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Re: Estimating Vocabulary

by I0 (Priest)
on Mar 27, 2002 at 19:41 UTC ( [id://154854]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Re: Estimating Vocabulary
in thread Estimating Vocabulary

my(@lines, $line); open(FILE, shift) || die; 1 while <FILE>; $line=$.; seek(FILE, 0, $. = 0); rand($line-$.) < $ARGV[0]-@lines && push(@lines,$_) while <FILE>; print @lines, "wc -l could have told you this is $. words\n";

Replies are listed 'Best First'.
Re: Re: Re: Estimating Vocabulary
by belg4mit (Prior) on Mar 27, 2002 at 20:00 UTC
    UPDATE:Excellent!

    WAS: That does not appear to work, I ask for one line and get 13-18 lines... It is also heavily weighted towards the Zs

    --
    perl -pe "s/\b;([st])/'\1/mg"

      Are you sure? It's working for me with only a small bias towards the Zs

      Update: Apparently, the observed bias was mostly an artifact of small sample size
        On a linux 2.4.9 box running perl 5.6.0 perl /tmp/a /usr/share/dict/words 1 yields such things as:

        databases fritter Saracens stammerer when Whitmanize willing writes Wuhan youthfully zigzag Zoroaster Zulu Zulus Zurich wc -l could have told you this is 45424 words
        shrivel topologies wetter Wilkins wristwatch Yeager yellowed zoom zooms Zoroastrian Zulu Zulus Zurich wc -l could have told you this is 45424 words
        valuably wins wriggles Zennist zoning Zoroaster Zulu Zulus Zurich wc -l could have told you this is 45424 words
        knave requisitioning seismology sentimentally tail Telnet Welles Whipple winner workbooks workmen Yates yeas Yokohama zodiac zonally zone Zoroaster Zoroastrian Zulu Zulus Zurich wc -l could have told you this is 45424 words

        --
        perl -pe "s/\b;([st])/'\1/mg"

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://154854]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.