Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- ===========================================================
- Created by Nevian
- -----------------------------------------------------------
- e-mail: neavian@gmail.com;
- -----------------------------------------------------------
- Copyright (c) Strzhegovsky Gleb
- ===========================================================
- Code is protected by copyrights
- ===========================================================
- File: bred.php
- -----------------------------------------------------------
- Target: Words fun generator v 1.1
- ===========================================================
- */
- error_reporting(E^ALL);
- mb_internal_encoding('UTF-8');
- $input = $_POST['text'];
- $options = intval($_POST['options']);
- $vonny = intval($_POST['vonny']);
- $symbols = array('!', '?', '.', ',');
- $sentences = array( '1' => 'adv, union adverb!',
- '2' => 'union sdv union noun?',
- '3' => 'union union noun union union noun?',
- '4' => 'adv union noun adverb noun'
- );
- $input = str_replace($symbols, '', $input);
- $text = explode(' ',$input);
- $union = array(); // Союз
- $verb = array(); // Глагол
- $adverb = array(); // Наречие
- $adjective = array(); // Прилагательное
- $noun = array(); // Существительное
- if (count($text) > 7) {
- for ($i=0;$i<count($text);$i++) {
- if (strlen($text[$i]) <= 3) {
- $union[] = $text[$i];
- } elseif (preg_match('/(ось|ел|ться|тся|или|лась|ит|ть|ет|али|шь|шься|аем|лся|лись|еем|ели)$/i', $text[$i]) && strlen($text[$i]) > 3) {
- $verb[] = $text[$i];
- } elseif (preg_match('/(ро|нь|но|ко)$/i', $text[$i]) && strlen($text[$i]) > 3) {
- $adverb[] = $text[$i];
- } elseif (preg_match('/(ую|ая|ый|ое|ые|ой)$/i', $text[$i]) && strlen($text[$i]) > 3) {
- $adjective[] = $text[$i];
- } else {
- $noun[] = $text[$i];
- }
- }
- function vonny($text) {
- $input = explode(' ', $text);
- $words = count($input);
- $letters = array("а", "ё", "и", "ю", "о", "е");
- for ($i=0;$i<$words;$i++) {
- $r_word = mt_rand(1,6);
- $input = str_replace($letters[$r_word], '', $input);
- }
- $input = implode(' ', $input);
- return stripslashes($input);
- }
- function register($str='',$to='lower') {
- $lower = array('а','б','в','г','д','е','ё','ж','з','и','й','к','л','м','н','о','п','р','с','т','у','ф','х','ц','ч','ш','щ','ь','ы','ъ','э','ю','я');
- $upper = array('А','Б','В','Г','Д','Е','Ё','Ж','З','И','Й','К','Л','М','Н','О','П','Р','С','Т','У','Ф','Х','Ц','Ч','Ш','Щ','Ь','Ы','Ъ','Э','Ю','Я');
- if ($to == 'lower') {
- $pat = &$upper;
- $rep = &$lower;
- } elseif($to == 'upper') {
- $pat = &$lower;
- $rep = &$upper;
- }
- for($n=0;$n<sizeof($pat);++$n) {
- $str = preg_replace("/".$pat[$n]."/",$rep[$n],$str);
- }
- return $str;
- }
- function orf($text) {
- $text = preg_replace_callback('~(!|\?|\.)(\s*)([a-zа-яё]{1})~isuU', function($match){
- return $match[1].$match[2].mb_strtoupper($match[3], 'utf-8');
- }, $text);
- return $text;
- }
- }
- //Как идея:
- function bredgen($text) {
- //Тут мы считаем колво слово и каким-то хуем составляем предложения по конструкциям из массива, типа так
- $konstrukciya = $sentences[mt_rand(0,count($sentences))];
- $novoe_predlojenie[] = str_replace($konstrukciya, $text[mt_rand(0,count($text))], $text);
- //Код очень сырой, но идею я думаю, ты поймйёшь) И вот с этой функцией ай нид ёр хелп)
- }
- ?>
Add Comment
Please, Sign In to add comment