1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

MArkov script php

Discussion in 'Blogging' started by pharmacyboy, May 30, 2008.

  1. pharmacyboy

    pharmacyboy Registered Member

    Joined:
    May 25, 2008
    Messages:
    64
    Likes Received:
    3
    Can anybody gimme a code of good markov php script ? I need markov function for my own content system.
     
  2. drunkseo

    drunkseo Junior Member

    Joined:
    Mar 24, 2008
    Messages:
    120
    Likes Received:
    43
    Occupation:
    KGB Agent
    Location:
    Florida
    I think this is owned by a member of this forum. I might be mistaken though
     
  3. Billw

    Billw Junior Member

    Joined:
    Jan 28, 2008
    Messages:
    182
    Likes Received:
    191
    You can get it from Scriptillusion, it's only $7
     
  4. pharmacyboy

    pharmacyboy Registered Member

    Joined:
    May 25, 2008
    Messages:
    64
    Likes Received:
    3
    I bought it, but the license is only for one domain. It's useless for me. I need to be able to run it on all domains i have.

    For now i'll stick to the old markov from YACG and MArkov Alternative.
     
  5. unknown_zero

    unknown_zero Jr. VIP Jr. VIP Premium Member

    Joined:
    May 15, 2008
    Messages:
    1,969
    Likes Received:
    574
  6. pharmacyboy

    pharmacyboy Registered Member

    Joined:
    May 25, 2008
    Messages:
    64
    Likes Received:
    3
    buy the source is encoded ?
     
  7. weblaffin

    weblaffin Registered Member

    Joined:
    Feb 20, 2008
    Messages:
    53
    Likes Received:
    1
    anyone have markov php script ?

    thank you!
     
  8. stanus

    stanus Newbie

    Joined:
    Dec 26, 2007
    Messages:
    45
    Likes Received:
    28
    here is a simple php script:

    PHP:
    <?php // MARKOV CHAINS HOOK



        
    $combo "Barack Hussein Obama, Jr. pronounced born August 4, 1961 is the junior United States Senator from Illinois and a leading candidate for the Democratic nomination in the 2008 U.S. presidential election.    Born to a Kenyan father and an American mother, he spent most of his early life in Honolulu, Hawaii. From ages six to ten, he lived in Jakarta, Indonesia with his mother and Indonesian stepfather. He married his wife, Michelle Robinson, in 1992 and has two daughters. A graduate of Columbia University and Harvard Law School, Obama worked as a community organizer, university lecturer, and civil rights lawyer before running for public office and serving in the Illinois Senate from 1997 to 2004. After an unsuccessful bid for a seat in the U.S. House of Representatives in 2000, he announced his campaign for U.S. Senate in 2003.  The following year, while still an Illinois state legislator, Obama delivered the keynote address at the 2004 Democratic National Convention. He was elected to the U.S. Senate in November 2004 with 70% of the vote. As a member of the Democratic minority in the 109th Congress, he co-sponsored bipartisan legislation for controlling conventional weapons and for promoting greater public accountability in the use of federal funds. He also made official trips to Eastern Europe, the Middle East, and Africa. In the current 110th Congress, he has sponsored legislation on lobbying and electoral fraud, climate change, nuclear terrorism, and care for returned U.S. military personnel.    Since announcing his presidential campaign in February 2007, Obama has emphasized ending the Iraq War, increasing energy independence, and providing universal health care as his top three priorities. He has written two bestselling books: a memoir of his youth titled Dreams from My Father, and The Audacity of Hope, a personal commentary on U.S. politics.";
        
    $output "";
        
    $gran=2;
        
    $num=150;
        
    $letters_line=50;


        
    $combo preg_replace('/\s\s+/'' '$combo);
        
    $combo preg_replace('/\n|\r/'''$combo);
        
    $combo strip_tags($combo);
        
    $combo htmlentities($combo);
        
    $combo explode(".",$combo);
        
    shuffle($combo);
        
    $combo implode("."$combo);
        
    $textwords explode(" "$combo);
        
    $loopmax count($textwords) - ($gran 2) - 1;
        
    $frequency_table = array();
        for (
    $j 0$j $loopmax$j++) {
            
    $key_string "";
            
    $end $j $gran;
            for (
    $k $j$k $end$k++) {
                
    $key_string .= $textwords[$k].' ';
            }
            
    $frequency_table[$key_string] = '';
            
    $frequency_table[$key_string] .= $textwords[$j $gran]." ";
            if ((
    $j+$gran) > $loopmax ) {
                break;
            }
        }
        
    $buffer "";
        
    $lastwords = array();
        for (
    $i 0$i $gran$i++) {
            
    $lastwords[] = $textwords[$i];
            
    $buffer .= " ".$textwords[$i];
        }
        for (
    $i 0$i $num$i++) {
            
    $key_string "";
            for (
    $j 0$j $gran$j++) {
                
    $key_string .= $lastwords[$j]." ";
            }
            if (
    $frequency_table[$key_string]) {
                
    $possible explode(" "trim($frequency_table[$key_string]));
                
    mt_srand();
                
    $c count($possible);
                
    $r mt_rand(1$c) - 1;
                
    $nextword $possible[$r];
                
    $buffer .= $nextword";
                if (
    strlen($buffer) >= $letters_line) {
                    
    $output .= $buffer;
                    
    $buffer "";
                }
                for (
    $l 0$l $gran 1$l++) {
                    
    $lastwords[$l] = $lastwords[$l 1];
                }
                
    $lastwords[$gran 1] = $nextword;
            }
            else {
                
    $lastwords array_splice($lastwords0count($lastwords));
                for (
    $l 0$l $gran$l++) {
                    
    $lastwords[] = $textwords[$l];
                    
    $buffer .= ' '.$textwords[$l];
                }
            }
        }
        
    $output trim($output);




    echo 
    $output;


    ?>
     
    • Thanks Thanks x 2
  9. weblaffin

    weblaffin Registered Member

    Joined:
    Feb 20, 2008
    Messages:
    53
    Likes Received:
    1
    thank you very very much stanus, for this code!
     
    • Thanks Thanks x 1
  10. groove

    groove Newbie

    Joined:
    Sep 19, 2008
    Messages:
    10
    Likes Received:
    1
    Is there a markov-script that randoms whole sentences, not words?

    Thanks a lot.
     
  11. BlackMelvyn

    BlackMelvyn Regular Member

    Joined:
    Jul 8, 2008
    Messages:
    202
    Likes Received:
    272
    Home Page:
    the one from yacg can do that, just change the granularity
     
  12. alexabones

    alexabones Newbie

    Joined:
    Aug 4, 2008
    Messages:
    9
    Likes Received:
    2
    Not knowing what a Markov script is, I did a search and came up with this one you may also like to check out.

    hxxp://wiki.tcl.tk/2834

    (do not know if I need to put this free page with xx ?)