📜 ⬆️ ⬇️

How Bulgakov helps to study the distribution of commas - a site for improving literacy

Most of us have passed the Russian language. But, since this was happening at a transitional age, we passed it by. Someone at this time worked, someone took first place in sports competitions, someone played on consoles, and most invested all their available time in communication with the computer.
Social Network Ark. Author Wetzel Eugene
That is why we do not always correctly write, showing himself not with the best hand. Despite the fact that I know how to program, I hardly manage to understand the algorithm for placing commas (it seems that these rules are confusing).

Recently, I decided to learn all the rules and get my hand in practice. To do this, I made a website where you can work out to determine the placements of commas.

The essence of the site is simple. You are presented with a text without a comma. You can place commas at will, and the site will suggest the correct answers. The rules of the Russian language in part of the "comma" are attached.

The site is here
')
I apologize that the site does not shine in all the elegance of the solution, since it was written in one evening and successfully performs its main function.

The placement of commas is like a game in the “miner” and fascinates, especially if Rosenthal's spelling and punctuation reference is next to it.

In the program itself, you can open the "rules of the Russian language" and remind yourself the algorithm.

If you want to display all commas of the text, press the Shift key.

For those interested, give the main part of the site. This script removes commas in the text and displays them when clicked. JQuery is used.

If it is correct - in green, if it is wrong, then in red.

require_once 'db.php'; include 'hypher.php'; $hy_ru = new phpHypher('hyph_ru_RU.conf'); $db = mysql_connect ($config[mysql_host], $config[mysql_user], $config[mysql_password]); mysql_query("SET NAMES utf8"); mysql_select_db($config[base_name],$db); if (!$db) { echo "   SQL :("; exit();} $p = intval($HTTP_GET_VARS['p']); $book = intval($HTTP_GET_VARS['book']); $glava = intval($HTTP_GET_VARS['glava']); if ($glava<=1) $glava=2; $sqlnews4 = "SELECT `text` FROM `1_commit` WHERE id = '$glava'"; $result4 = mysql_query($sqlnews4); @$sql4 = mysql_fetch_array($result4); $text = '<p><h11>'.$sql4['text'].'</p>'; $text = str_replace(", –","@@",$text); $text = str_replace(", ","<span&&class='com'>, </span>",$text); $text = str_replace(" ","<span class='com_wrong'>, </span>",$text); $text = str_replace("&&"," ",$text); $text = str_replace("@@",", –",$text); $text = str_replace("\n","<span class='com_count'>0</span></p><p>",$text); $text = $hy_ru->hyphenate($text,'UTF-8'); echo '<div id="mytext"><span style="float:right;color:lightgray">  .  .</span> '; echo $text; echo '<div><center>'; if ($glava>2) echo '<a class="linknext" href="?glava='.($glava-1).'"><< </a>'; if ($glava<33) echo '<a class="linknext" href="?glava='.($glava+1).'"> >></a>'; echo '</center>'; ?> <div id="show"></div> <div id="show2"> </div> <div id="score"></div> <div id="help"></div> <div id="rules"></div> </body> <script type="text/javascript"> $(document).ready(jsDoFirst); function jsDoFirst() { $('p').each(function(){ cnt_all = $(this).children('.com').length; cnt = $(this).children('.com[id2=1]').length; cnt_sum = cnt_all-cnt; $(this).children('.com_count').html(cnt_sum); }); $('.com_wrong').click(function(){ $(this).css('color','red'); $(this).css('opacity','1'); $(this).attr('id2','1'); $(this).animate({"opacity":"0.2"},5000, function(){}); $('#score').html(': '+$('.com_wrong[id2=1]').length+' | : '+$('.com[id2=1]').length); }); $('.com').click(function(){ $(this).css('color','green'); $(this).css('background-color','white'); $(this).css('opacity','1'); $(this).attr('id2','1'); cnt_all = $(this).parent('p').children('.com').length; cnt = $(this).parent('p').children('.com[id2=1]').length; cnt_sum = cnt_all-cnt; if ((cnt_sum==0)) { rrnd = Math.round(Math.random()*5); $(this).parent('p').children('.com_count').css('color','yellow'); if (rrnd==0) cnt_sum='!'; if (rrnd==1) cnt_sum='!'; if (rrnd==2) cnt_sum='!'; if (rrnd==3) cnt_sum=' !'; if (rrnd==4) cnt_sum=' !'; if (rrnd==5) cnt_sum='!'; } $(this).parent('p').children('.com_count').html(cnt_sum); $('#score').html(': '+$('.com_wrong[id2=1]').length+' | : '+$('.com[id2=1]').length); }); $('#show2').click(function(event){ document.location.href="http://www.wezel.ru/"; }); $('#show').click(function(event){ if ($('.com[id2!=1]').css('opacity')=='0') $('.com[id2!=1]').css('opacity','1'); else $('.com[id2!=1]').css('opacity','0'); }); $(document).keydown(function(event){ if(event.keyCode == 16) { $('.com[id2!=1]').css('opacity','0.9'); } }); $(document).keyup(function(event){ if(event.keyCode == 16) { $('.com[id2!=1]').css('opacity','0.0'); } }); $('#help').click(function(event){ if ($('#rules').css('display')=='none') { $('#rules').load('rules.html').fadeIn(500); $('#help').css('opacity','0.9'); } else { $('#rules').load('rules.html').fadeOut(500); $('#help').css('opacity','0.4'); } }); $('#rules').draggable().resizable(); } </script> 


It's all pretty simple. CSS you can take on my site.

The instruction $ text = $ hy_ru-> hyphenate ($ text, 'UTF-8'); puts hyphenation to make the text look prettier.

I hope someone this site will help master the art of commas. If someone wants to develop an idea and make a literacy service, I will be glad. Exercises on the Russian language on the Internet is extremely small.

At the bottom of the page there are Like buttons from social networks. It is very convenient to place commas from the tablet.

Let's raise the population of Grammar Naz i and reduce the amount of food for them.

The site is optimized for iPhone and can work if there is no connection:
Social Network Ark. Author Wetzel Eugene

Commas are not as difficult as they seem.

Source: https://habr.com/ru/post/143114/


All Articles