{"id":283895,"date":"2017-03-25T10:40:02","date_gmt":"2017-03-25T07:40:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=283895"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=283895","title":{"rendered":"\u041f\u0440\u043e\u0441\u0442\u0430\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043d\u0430 PYTHON \u0434\u043b\u044f \u0433\u0440\u0430\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0441\u043b\u043e\u0432 \u0438 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u043e\u0432 \u0442\u0435\u043a\u0441\u0442\u0430"},"content":{"rendered":"<h3>\u0417\u0430\u0447\u0435\u043c \u044d\u0442\u043e \u043d\u0443\u0436\u043d\u043e<\/h3>\n<p>  \u041f\u0440\u0438 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430\u0445 \u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u0443\u0434\u043e\u0431\u043d\u043e \u0438\u043c\u0435\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0445\u043e\u0434\u0438\u0442 \u0433\u0440\u0430\u043c\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043e\u0448\u0438\u0431\u043a\u0438, \u043d\u043e \u0438 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u0437\u0430\u043c\u0435\u043d\u044b \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430. \u0412 \u043e\u0442\u043b\u0438\u0447\u0438\u0438 \u043e\u0442 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0445 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043e\u0432 \u0442\u0430\u043a\u0430\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0438\u043c\u0435\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0438 \u0431\u044b\u0441\u0442\u0440\u0443\u044e \u0441\u043c\u0435\u043d\u0443 \u044f\u0437\u044b\u043a\u043e\u0432 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043f\u0440\u0438 \u0438\u0445 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435. \u041d\u0443\u0436\u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0444\u0438\u043b\u044c\u0442\u0440 \u0434\u043b\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043d\u0435\u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u043c\u044b\u0445 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439. \u0412\u0441\u0451 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0435 \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0430 Python, \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 PyEnchant, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0437\u0434\u0435\u0441\u044c[1]. \u041d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u044d\u0442\u0443 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u043b\u043e\u0432\u0430\u0440\u0438 \u0434\u043b\u044f \u0440\u0443\u0441\u0441\u043a\u043e\u0433\u043e \u044f\u0437\u044b\u043a\u0430.<a name=\"habracut\"><\/a><\/p>\n<h3>\u041a\u043e\u0434 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b<\/h3>\n<p>  \u041c\u043e\u0434\u0443\u043b\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0438 \u043f\u0443\u0441\u0442\u043e\u0439 \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u0434\u043b\u044f \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u044f\u0437\u044b\u043a\u0430.<\/p>\n<pre><code class=\"python\"># -*- coding: utf-8 -*- import enchant from enchant.checker import SpellChecker from enchant.tokenize import EmailFilter, URLFilter <\/code><\/pre>\n<p>  \u041f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u0438 \u0432\u044b\u0431\u043e\u0440\u0435 \u044f\u0437\u044b\u043a\u0430 \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443.<\/p>\n<pre><code class=\"python\">def get(event):         t=str(l.get(event.widget.curselection()))         w['key']=0         w['key']=t         lab = tk.Label(root, text=&quot;&quot;, font=&quot;Arial 12&quot;)         lab.grid_remove()         lab = tk.Label(root, text= &quot;\u0412\u044b\u0431\u0440\u0430\u043d \u044f\u0437\u044b\u043a -%s--\u0412\u0432\u043e\u0434: \u043f\u043e\u043b\u044f 1-\u0442\u0435\u043a\u0441\u0442,2-\u0441\u043b\u043e\u0432\u043e. \u0412\u044b\u0432\u043e\u0434 \u043f\u043e\u043b\u0435 3-\u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442&quot;%t, font=&quot;Arial 12&quot;)         lab.grid(row=0, column=0)<\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043f\u0440\u0430\u0432\u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043e\u0434\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430.<\/p>\n<pre><code class=\"python\">def pravopus():         t=w['key']         d = enchant.Dict(t)            tex=txt_0.get(1.0, END).strip()         if len(tex)!=0:                 m=d.check(tex)                 if m:                         txt.insert(END, &quot;\u0421\u043b\u043e\u0432\u043e-%s-\u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\\n&quot;%tex)                 else:                         txt.insert(END, &quot;\u0421\u043b\u043e\u0432\u043e--%s- \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u043d\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u043d\u0443\u0436\u043d\u043e \u0442\u0430\u043a-%s- \\n&quot;%(tex,str(d.suggest(tex))))         elif len(tex)==0:                 txt.insert(END, &quot;\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0441\u043b\u043e\u0432\u043e!!!\\n&quot;) <\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043f\u0440\u0430\u0432\u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0430 \u0442\u0435\u043a\u0441\u0442\u0430 \u0441 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c Email \u0438 URL.<\/p>\n<pre><code class=\"python\">def tokenise():         try:                 t=w['key']                 txt.delete(1.0, END)                 p= enchant.Dict(t)                 d=  SpellChecker(t,filters=[EmailFilter,URLFilter])                 tex=txt_1.get(1.0, END).strip()                 d.set_text(tex)                 k=0                 for err in d:                         k=k+1                         txt.insert(END, &quot;ERROR:&quot;,err.word, p.suggest(err.word))                         txt.insert(END, &quot;\\n&quot;)                 if k==0:                         txt.insert(END, '\u041f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\\n')         except:                 txt.insert(END, &quot;\u041e\u0448\u0438\u0431\u043a\u0430 \u0432\u0432\u043e\u0434\u0430!!!\\n&quot;)                 pass <\/code><\/pre>\n<p>  \u041e\u0447\u0438\u0441\u0442\u043a\u0430 \u043f\u043e\u043b\u0435\u0439 \u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 tkinter.<\/p>\n<pre><code class=\"python\">def clearn():         txt_0.delete(1.0, END)         txt_1.delete(1.0, END)         txt.delete(1.0, END) import tkinter as tk     from tkinter import * root = tk.Tk()        main_menu = Menu(root) root.config(menu=main_menu) file_menu = Menu(main_menu) main_menu.add_cascade(label=&quot;\u041e\u0440\u0444\u043e\u0433\u0440\u0430\u0444\u0438\u044f&quot;, menu=file_menu) file_menu.add_command(label=&quot;\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0431\u043b\u043e\u043a\u0430 \u0442\u0435\u043a\u0441\u0442\u0430&quot;, command=tokenise) file_menu.add_command(label=&quot;\u041e\u0447\u0438\u0441\u0442\u043a\u0430 \u0432\u0441\u0435\u0445 \u043f\u043e\u043b\u0435\u0439&quot;, command=clearn) file_menu.add_command(label=&quot;\u0412\u044b\u0445\u043e\u0434&quot;, command=root.destroy) lab = tk.Label(root, text=&quot;\u0412\u044b\u0431\u0438\u0440\u0438\u0442\u0435 \u044f\u0437\u044b\u043a&quot;, font=&quot;Arial 12&quot;) l = tk.Listbox(root,takefocus=True, width=6,height=5,font=&quot;Arial 12&quot;) txt = tk.Text(root, width=64,height=5,font=&quot;Arial 12&quot;,wrap=WORD) txt_0 = tk.Text(root, width=64,height=1,font=&quot;Arial 12&quot;,wrap=WORD) txt_1 = tk.Text(root, width=64,height=5,font=&quot;Arial 12&quot;,wrap=WORD) but = tk.Button(root,text=&quot;\u041f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0441\u043b\u043e\u0432\u043e&quot;,command=pravopus) lab.grid(row=0, column=0) txt_1.grid(row=1, column=0) txt_0.grid(row=2, column=0) txt.grid(row=3, column=0) l.grid(row=3, column=1) but.grid(row=4, column=0) l.insert(END,'en_AU', 'en_GB', 'en_US', 'de_DE', 'fr_FR', 'ru_RU', 'uk_UA')     l.bind(&quot;&lt;&lt;ListboxSelect&gt;&gt;&quot;, get) root.tk.mainloop() <\/code><\/pre>\n<h3>\u0420\u0430\u0431\u043e\u0442\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b<\/h3>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0440\u0443\u0441\u0441\u043a\u0438\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/8e2\/7fc\/7c0\/8e27fc7c045347b888151d4b890bd2f2.PNG\"\/><\/p>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u0438\u043c \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/765\/1f0\/4c9\/7651f04c91354a3d89e2b87df1672efb.PNG\"\/><\/p>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043d\u0435\u043c\u0435\u0446\u043a\u0438\u043c \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/9f5\/1d3\/fe5\/9f51d3fe559c4951a96683a35fc88360.PNG\"\/><\/p>\n<p>  1. Python \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043e\u0440\u0444\u043e\u0433\u0440\u0430\u0444\u0438\u0438 (windows, linux) \u2014 PyEnchant<br \/>   <a href=\"http:\/\/xn--80afqpaigicolm.xn--p1ai\/python\/python-proverka-orfografii-windows-linux-pyenchant\/\">xn--80afqpaigicolm.xn--p1ai\/python\/python-proverka-orfografii-windows-linux-pyenchant<\/a><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habrahabr.ru\/post\/324832\/\"> https:\/\/habrahabr.ru\/post\/324832\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<h3>\u0417\u0430\u0447\u0435\u043c \u044d\u0442\u043e \u043d\u0443\u0436\u043d\u043e<\/h3>\n<p>  \u041f\u0440\u0438 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430\u0445 \u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u0443\u0434\u043e\u0431\u043d\u043e \u0438\u043c\u0435\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0445\u043e\u0434\u0438\u0442 \u0433\u0440\u0430\u043c\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043e\u0448\u0438\u0431\u043a\u0438, \u043d\u043e \u0438 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u0437\u0430\u043c\u0435\u043d\u044b \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430. \u0412 \u043e\u0442\u043b\u0438\u0447\u0438\u0438 \u043e\u0442 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0445 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043e\u0432 \u0442\u0430\u043a\u0430\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0438\u043c\u0435\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0438 \u0431\u044b\u0441\u0442\u0440\u0443\u044e \u0441\u043c\u0435\u043d\u0443 \u044f\u0437\u044b\u043a\u043e\u0432 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043f\u0440\u0438 \u0438\u0445 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435. \u041d\u0443\u0436\u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0444\u0438\u043b\u044c\u0442\u0440 \u0434\u043b\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043d\u0435\u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u043c\u044b\u0445 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439. \u0412\u0441\u0451 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0435 \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0430 Python, \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 PyEnchant, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0437\u0434\u0435\u0441\u044c[1]. \u041d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u044d\u0442\u0443 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u043b\u043e\u0432\u0430\u0440\u0438 \u0434\u043b\u044f \u0440\u0443\u0441\u0441\u043a\u043e\u0433\u043e \u044f\u0437\u044b\u043a\u0430.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-283895","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/283895","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=283895"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/283895\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=283895"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=283895"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=283895"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}