×
Create a new article
Write your page title here:
We currently have 3,189 articles on s23. Type your article name above or create one of the articles listed here!



    s23
    3,189Articles

    Googlism: Difference between revisions

    Content added Content deleted
    imported>mutante
    mNo edit summary
    imported>mutante
    mNo edit summary
    Line 1: Line 1:
    you can now use <pre>[[Googlism:text]]</pre> to do a [[Googlism:googlism]]
    You can use <nowiki>[[Googlism:text]]</nowiki> to do a [[Googlism:googlism]]


    Line 170: Line 170:
    if __name__ == '__main__': main()
    if __name__ == '__main__': main()
    </pre>
    </pre>

    a few automatically created links:
    Google:GooglIsm
    Wikipedia:GooglIsm
    Dictionary:GooglIsm
    UseMod:GooglIsm
    MeatBall:GooglIsm
    C4:GooglIsm
    InfoAnarchy:GooglIsm
    C2:GooglIsm
    ...these should help if you are lucky.. try to make this page better,please.


    [[Category:Searches]]
    [[Category:Searches]]

    Revision as of 23:35, 9 March 2005

    You can use [[Googlism:text]] to do a Googlism:googlism


    also i found this googlism.pl its a Perl proggi for getting goolism's found [here]

    • #!/usr/bin/perl -w

    use strict; use HTML::Entities;

    if( @ARGV < 1 ) {

       die "Insufficient arguments.";
    

    }

    my $term = $ARGV[ 0 ]; $term =~ m/^(.+?)[ ?!.]*$/; $term = $1; $term =~ s/[^wds]//g; $term =~ s/s+/+/g; my $term2 = $term; $term2 =~ s/+/ /g;

    my $command = "curl -m 60 -s "http://www.googlism.com/index.htm?ism="

       . $term
       . "" | egrep -o ""
       . $term2
       . " is .+<br>" > googlism.out";
    

    `$command`;

    open( FIN, "<", "googlism.out" );

    my $num = 0; my @results;

    while( my $line = <FIN> ) {

       $results[ $num ] = $line;
       $num++;
    

    }

    close( FIN );

    if( $num > 0 ) {

       my $result = $results[ int( rand( $num ) ) ];
       $result =~ s/<br>//;
    
       print( decode_entities( $result ) );
    

    } else {

       print( "No results for $term.
    

    " ); }

    and a nice Python googlism script too [here]
    
    • #!/usr/bin/env python

    """ Python and command line access to the wisdom of googlism.com. """

    import getopt import urllib import sys


    __program__ = 'googlism' __version__ = '1.0' __url__ = 'http://www.alcyone.com/software/googlism/' __author__ = 'Erik Max Francis <max@alcyone.com>' __copyright__ = 'Copyright (C) 2004 Erik Max Francis' __license__ = 'GPL'


    AGENT = 'googlism.py/%s' % __version__


    class Opener(urllib.FancyURLopener):

       version = AGENT
       
       def __init__(self, *args):
           urllib.FancyURLopener.__init__(self, *args)
    


    class Googlism(object):

       TYPES = {'who': '1', 'what': '2', 'where': '3', 'when': '4'}
       DEFAULT_BASE_URL = 'http://www.googlism.com/index.htm'
       DEFAULT_TYPE = 'who'
    
       def __init__(self, baseUrl=DEFAULT_BASE_URL):
           self.baseUrl = baseUrl
           self.opener = Opener()
    
       def go(self, query, type=DEFAULT_TYPE):
           url = '%s?ism=%s&type=%s' % (self.baseUrl,
                                        urllib.quote(query),
                                        Googlism.TYPES[type])
           theFile = self.opener.open(url)
           content = theFile.read()
           theFile.close()
           if content.find("doesn't know enough about") >= 0:
               return []
           start = content.find('Googlism for:')
           current = content.find('<br>', start)
           result = []
           while True:
               next = content.find('<br>', current)
               if next < 0:
                   break
               fragment = content[current:next].strip()
               if fragment.find('<tr>') >= 0 or fragment.find('<td>') >= 0:
                   break
               if fragment:
                   result.append(fragment)
               current = next + len('<br>')
           return result
    


    def usage():

       print >> sys.stderr, """
    

    Usage: %(__program__)s [options] <query>

    Options:

     -1 --who       Do a "who" query [default]
     -2 --what      Do a "what" query
     -3 --where     Do a "where" query
     -4 --when      Do a "when" query
     -q --quiet     Don't print anything to stderr for empty results
    

    """ % globals()

    def main():

       _type = Googlism.DEFAULT_TYPE
       _verbose = True
       args = sys.argv[1:]
       if not args:
           usage()
           sys.exit()
       pairs, remainder = getopt.getopt(args, '1234q',
                                        ['who', 'what', 'where', 'when', 'quiet'])
       for option, argument in pairs:
           if option in ('-1', '--who'):
               _type = 'who'
           elif option in ('-2', '--what'):
               _type = 'what'
           elif option in ('-3', '--where'):
               _type = 'where'
           elif option in ('-4', '--when'):
               _type = 'when'
           elif option in ('-q', '--quiet'):
               _verbose = False
       _query = ' '.join(remainder)
       googlism = Googlism()
       result = googlism.go(_query, _type)
       if result:
           for line in result:
               print line
           code = 0
       else:
           if _verbose:
               print >> sys.stderr, "No results were found"
           code = 1
       sys.exit(code)
    

    if __name__ == '__main__': main()

    Cookies help us deliver our services. By using our services, you agree to our use of cookies.
    Cookies help us deliver our services. By using our services, you agree to our use of cookies.