├── .github └── FUNDING.yml ├── .gitignore ├── CITATION.cff ├── LICENSE ├── MANIFEST.txt ├── Makefile ├── README.md ├── README.rst ├── THANKS.md ├── bin ├── adawat-console.py ├── mishkal-console.py ├── tashkeel_console.py └── thalab-console.py ├── build └── lib │ └── mishkal │ └── __init__.py ├── cgirunner.py ├── core ├── __init__.py ├── adaat.py ├── affix_const.py ├── generate.py ├── myrepr.py └── randtext.py ├── crossdomain.xml ├── customfile.txt ├── data └── randomtext.txt ├── docs ├── AUTHORS.txt ├── COPYING.txt ├── ChangeLog.txt ├── HowTo.odt ├── Ideas.odt ├── README.txt ├── THANKS.txt ├── TODO.txt ├── VERSION.txt ├── html │ └── images │ │ ├── adawatstyle.css │ │ ├── gotashkeel.png │ │ ├── mishkal.png │ │ ├── mishkal_alpha_smpl.png │ │ └── mixkal.jpg └── ideas.txt ├── epydoc.conf ├── exe_setup.py ├── interfaces ├── gui │ ├── ar │ │ ├── about.html │ │ ├── help_body.html │ │ ├── images │ │ │ ├── alef_wasla.png │ │ │ ├── animation.png │ │ │ ├── appicon.ico │ │ │ ├── appicon.png │ │ │ ├── copy.png │ │ │ ├── cut.png │ │ │ ├── damma.png │ │ │ ├── dammatan.png │ │ │ ├── exit.png │ │ │ ├── fatha.png │ │ │ ├── fathatan.png │ │ │ ├── font.png │ │ │ ├── gaf.png │ │ │ ├── help.jpg │ │ │ ├── icon.png │ │ │ ├── ix.ico │ │ │ ├── ixn.ico │ │ │ ├── kasra.png │ │ │ ├── kasratan.png │ │ │ ├── logo.png │ │ │ ├── new.png │ │ │ ├── open.png │ │ │ ├── paste.png │ │ │ ├── peh.png │ │ │ ├── preview.png │ │ │ ├── print.png │ │ │ ├── qutrub.ico │ │ │ ├── save.png │ │ │ ├── shadda.png │ │ │ ├── smallalef.png │ │ │ ├── sukun.png │ │ │ ├── svg │ │ │ │ ├── alef_wasla.svg │ │ │ │ ├── appicon.svg │ │ │ │ ├── copy.svg │ │ │ │ ├── cut.svg │ │ │ │ ├── damma.svg │ │ │ │ ├── dammatan.svg │ │ │ │ ├── exit.svg │ │ │ │ ├── fatha.svg │ │ │ │ ├── fathatan.svg │ │ │ │ ├── font.svg │ │ │ │ ├── gaf.svg │ │ │ │ ├── icon.svg │ │ │ │ ├── kasra.svg │ │ │ │ ├── kasratan.svg │ │ │ │ ├── logo.svg │ │ │ │ ├── new.svg │ │ │ │ ├── open.svg │ │ │ │ ├── paste.svg │ │ │ │ ├── peh.svg │ │ │ │ ├── print.svg │ │ │ │ ├── save.svg │ │ │ │ ├── shadda.svg │ │ │ │ ├── smallalef.svg │ │ │ │ ├── sukun.svg │ │ │ │ ├── tatweel.svg │ │ │ │ ├── zoomin.svg │ │ │ │ ├── zoomout.svg │ │ │ │ ├── zwj.svg │ │ │ │ └── zwnj.svg │ │ │ ├── tatweel.png │ │ │ ├── text-speak.png │ │ │ ├── txt │ │ │ ├── weblogo.ico │ │ │ ├── zoomin.png │ │ │ ├── zoomout.png │ │ │ ├── zwj.png │ │ │ └── zwnj.png │ │ ├── projects.html │ │ └── style.css │ ├── gui │ │ ├── __init__.py │ │ ├── app_rc.py │ │ ├── appgui.py │ │ ├── ar │ │ │ ├── about.html │ │ │ ├── help_body.html │ │ │ ├── images │ │ │ │ ├── alef_wasla.png │ │ │ │ ├── animation.png │ │ │ │ ├── appicon.ico │ │ │ │ ├── appicon.png │ │ │ │ ├── copy.png │ │ │ │ ├── cut.png │ │ │ │ ├── damma.png │ │ │ │ ├── dammatan.png │ │ │ │ ├── exit.png │ │ │ │ ├── fatha.png │ │ │ │ ├── fathatan.png │ │ │ │ ├── font.png │ │ │ │ ├── gaf.png │ │ │ │ ├── help.jpg │ │ │ │ ├── icon.png │ │ │ │ ├── ix.ico │ │ │ │ ├── ixn.ico │ │ │ │ ├── kasra.png │ │ │ │ ├── kasratan.png │ │ │ │ ├── logo.png │ │ │ │ ├── new.png │ │ │ │ ├── open.png │ │ │ │ ├── paste.png │ │ │ │ ├── peh.png │ │ │ │ ├── preview.png │ │ │ │ ├── print.png │ │ │ │ ├── qutrub.ico │ │ │ │ ├── save.png │ │ │ │ ├── shadda.png │ │ │ │ ├── smallalef.png │ │ │ │ ├── sukun.png │ │ │ │ ├── svg │ │ │ │ │ ├── alef_wasla.svg │ │ │ │ │ ├── appicon.svg │ │ │ │ │ ├── copy.svg │ │ │ │ │ ├── cut.svg │ │ │ │ │ ├── damma.svg │ │ │ │ │ ├── dammatan.svg │ │ │ │ │ ├── exit.svg │ │ │ │ │ ├── fatha.svg │ │ │ │ │ ├── fathatan.svg │ │ │ │ │ ├── font.svg │ │ │ │ │ ├── gaf.svg │ │ │ │ │ ├── icon.svg │ │ │ │ │ ├── kasra.svg │ │ │ │ │ ├── kasratan.svg │ │ │ │ │ ├── logo.svg │ │ │ │ │ ├── new.svg │ │ │ │ │ ├── open.svg │ │ │ │ │ ├── paste.svg │ │ │ │ │ ├── peh.svg │ │ │ │ │ ├── print.svg │ │ │ │ │ ├── save.svg │ │ │ │ │ ├── shadda.svg │ │ │ │ │ ├── smallalef.svg │ │ │ │ │ ├── sukun.svg │ │ │ │ │ ├── tatweel.svg │ │ │ │ │ ├── zoomin.svg │ │ │ │ │ ├── zoomout.svg │ │ │ │ │ ├── zwj.svg │ │ │ │ │ └── zwnj.svg │ │ │ │ ├── tatweel.png │ │ │ │ ├── text-speak.png │ │ │ │ ├── txt │ │ │ │ ├── weblogo.ico │ │ │ │ ├── zoomin.png │ │ │ │ ├── zoomout.png │ │ │ │ ├── zwj.png │ │ │ │ └── zwnj.png │ │ │ ├── projects.html │ │ │ └── style.css │ │ ├── customdictionary.py │ │ ├── setting.py │ │ └── spelling.py │ ├── mishkal-gui.py │ └── ~ │ │ └── tmp │ │ └── qalsadiCache │ │ ├── _indexes │ │ ├── 00id.py │ │ └── 01a.py │ │ ├── a_buck │ │ ├── a_stor │ │ ├── id_buck │ │ └── id_stor └── web │ ├── adawaty.py │ ├── config │ ├── __init__.py │ ├── logging.cfg │ └── mishkal_config.py │ ├── lib │ ├── okasha2 │ │ ├── __init__.py │ │ ├── baseWebApp.py │ │ ├── kidTemplate.py │ │ └── utils.py │ ├── paste │ │ ├── __init__.py │ │ ├── __init__.pyo │ │ ├── auth │ │ │ ├── __init__.py │ │ │ ├── auth_tkt.py │ │ │ ├── basic.py │ │ │ ├── cas.py │ │ │ ├── cookie.py │ │ │ ├── digest.py │ │ │ ├── form.py │ │ │ ├── grantip.py │ │ │ ├── multi.py │ │ │ └── open_id.py │ │ ├── cascade.py │ │ ├── cgiapp.py │ │ ├── cgitb_catcher.py │ │ ├── config.py │ │ ├── debug │ │ │ ├── __init__.py │ │ │ ├── debugapp.py │ │ │ ├── doctest_webapp.py │ │ │ ├── fsdiff.py │ │ │ ├── prints.py │ │ │ ├── profile.py │ │ │ ├── testserver.py │ │ │ ├── watchthreads.py │ │ │ └── wdg_validate.py │ │ ├── errordocument.py │ │ ├── evalexception │ │ │ ├── __init__.py │ │ │ ├── evalcontext.py │ │ │ ├── media │ │ │ │ ├── debug.js │ │ │ │ ├── minus.jpg │ │ │ │ └── plus.jpg │ │ │ ├── middleware.py │ │ │ └── mochikit │ │ │ │ ├── MochiKit.js │ │ │ │ └── __package__.js │ │ ├── exceptions │ │ │ ├── __init__.py │ │ │ ├── collector.py │ │ │ ├── errormiddleware.py │ │ │ ├── formatter.py │ │ │ ├── reporter.py │ │ │ └── serial_number_generator.py │ │ ├── fileapp.py │ │ ├── fixture.py │ │ ├── flup_session.py │ │ ├── gzipper.py │ │ ├── httpexceptions.py │ │ ├── httpheaders.py │ │ ├── httpserver.py │ │ ├── lint.py │ │ ├── modpython.py │ │ ├── paste.zip │ │ ├── pony.py │ │ ├── progress.py │ │ ├── proxy.py │ │ ├── recursive.py │ │ ├── registry.py │ │ ├── reloader.py │ │ ├── request.py │ │ ├── response.py │ │ ├── session.py │ │ ├── transaction.py │ │ ├── translogger.py │ │ ├── url.py │ │ ├── urlmap.py │ │ ├── urlparser.py │ │ ├── util │ │ │ ├── PySourceColor.py │ │ │ ├── UserDict24.py │ │ │ ├── __init__.py │ │ │ ├── classinit.py │ │ │ ├── classinstance.py │ │ │ ├── converters.py │ │ │ ├── dateinterval.py │ │ │ ├── datetimeutil.py │ │ │ ├── doctest24.py │ │ │ ├── filemixin.py │ │ │ ├── finddata.py │ │ │ ├── findpackage.py │ │ │ ├── import_string.py │ │ │ ├── intset.py │ │ │ ├── ip4.py │ │ │ ├── killthread.py │ │ │ ├── looper.py │ │ │ ├── mimeparse.py │ │ │ ├── multidict.py │ │ │ ├── quoting.py │ │ │ ├── scgiserver.py │ │ │ ├── string24.py │ │ │ ├── subprocess24.py │ │ │ ├── template.py │ │ │ ├── threadedprint.py │ │ │ └── threadinglocal.py │ │ ├── wsgilib.py │ │ └── wsgiwrappers.py │ └── simplejson │ │ ├── __init__.py │ │ ├── _speedups.c │ │ ├── decoder.py │ │ ├── encoder.py │ │ ├── ordered_dict.py │ │ ├── scanner.py │ │ ├── tests │ │ ├── __init__.py │ │ ├── test_check_circular.py │ │ ├── test_decimal.py │ │ ├── test_decode.py │ │ ├── test_default.py │ │ ├── test_dump.py │ │ ├── test_encode_basestring_ascii.py │ │ ├── test_encode_for_html.py │ │ ├── test_fail.py │ │ ├── test_float.py │ │ ├── test_indent.py │ │ ├── test_pass1.py │ │ ├── test_pass2.py │ │ ├── test_pass3.py │ │ ├── test_recursion.py │ │ ├── test_scanstring.py │ │ ├── test_separators.py │ │ ├── test_speedups.py │ │ └── test_unicode.py │ │ └── tool.py │ ├── mishkal-webserver.py │ ├── mishkal_bottle.py │ ├── mishkal_flask.py │ ├── resources │ ├── errorPages │ │ ├── 400.shtml │ │ ├── 404.shtml │ │ ├── 500.shtml │ │ ├── Index.html │ │ ├── images │ │ │ └── logo.png │ │ └── logo.png │ ├── files │ │ ├── adawat.js │ │ ├── adawat.js~ │ │ ├── adawat.min.js │ │ ├── adawatstyle.css │ │ ├── adawatstyle.css~ │ │ ├── bootstrap-rtl.css │ │ ├── bootstrap-rtl.min.css │ │ ├── cytoscape.min.js │ │ ├── favicon1.png │ │ ├── fonts │ │ │ ├── DroidNaskh-Regular-Colored.ttf │ │ │ ├── DroidNaskh-Regular-Colored.woff │ │ │ ├── KacstOne.eot │ │ │ ├── KacstOne.otf │ │ │ ├── KacstOne.svg │ │ │ ├── KacstOne.ttf │ │ │ ├── KacstOne.woff │ │ │ ├── KacstOneColored.ttf │ │ │ ├── SimpleNaskhi-colores.ttf │ │ │ ├── amiri-quran-colored.eot │ │ │ ├── amiri-quran-colored.ttf │ │ │ └── amiri-quran-colored.woff │ │ ├── images │ │ │ ├── adawat.png │ │ │ ├── ayaspell.png │ │ │ ├── dreamdevdz.jpeg │ │ │ ├── dreamdevdz.png │ │ │ ├── main167-750x402.jpg │ │ │ ├── pyarabic.png │ │ │ ├── qutrub.jpg │ │ │ ├── radif.png │ │ │ └── tashaphyne.png │ │ ├── jquery-1.7.1.min.js │ │ ├── jquery-3.3.1.min.js │ │ ├── jquery.min.js │ │ ├── logo-big.png │ │ ├── logo-icon.png │ │ ├── logo.png │ │ ├── prepare.js │ │ ├── samples │ │ │ ├── gotashkeel.png │ │ │ ├── mishkal.png │ │ │ ├── mishkal_alpha_smpl.png │ │ │ └── mixkal.jpg │ │ └── xzero-rtl │ │ │ ├── css │ │ │ ├── bootstrap-arabic-theme.css │ │ │ ├── bootstrap-arabic-theme.css.map │ │ │ ├── bootstrap-arabic-theme.min.css │ │ │ ├── bootstrap-arabic.css │ │ │ ├── bootstrap-arabic.css.map │ │ │ ├── bootstrap-arabic.min.css │ │ │ └── bootstrap-arabic.reduced.css │ │ │ ├── fonts │ │ │ ├── arcx │ │ │ │ ├── glyphicons-halflings-regular.eot │ │ │ │ ├── glyphicons-halflings-regular.svg │ │ │ │ ├── glyphicons-halflings-regular.ttf │ │ │ │ └── glyphicons-halflings-regular.woff │ │ │ ├── glyphicons-halflings-regular.eot │ │ │ ├── glyphicons-halflings-regular.svg │ │ │ ├── glyphicons-halflings-regular.ttf │ │ │ ├── glyphicons-halflings-regular.woff │ │ │ └── glyphicons-halflings-regular.woff2 │ │ │ └── js │ │ │ ├── bootstrap-arabic.js │ │ │ └── bootstrap-arabic.min.js │ ├── static │ │ ├── carousel.html │ │ ├── contact.html │ │ ├── doc.html │ │ ├── download.html │ │ ├── main.html │ │ └── projects.html │ └── templates │ │ ├── archiv │ │ ├── 500.html │ │ ├── link.html │ │ ├── log.html │ │ ├── main2.html │ │ ├── mainol.html │ │ ├── temp.html │ │ ├── w3layouts-license.txt │ │ └── whoisqutrub.html │ │ ├── carousel.html │ │ ├── contact.html │ │ ├── doc.html │ │ ├── download.html │ │ ├── main.html │ │ ├── main.html~ │ │ ├── main2.html │ │ ├── new.html~ │ │ └── projects.html │ ├── tmp │ └── logging_example.out │ └── views │ ├── contact.html │ ├── doc.html │ ├── download.html │ ├── index.html │ ├── main2.tpl │ └── projects.html ├── logo.png ├── mishkal-console.spec ├── mishkal-gui.spec ├── mishkal-web.spec ├── mishkal.cgi ├── mishkal ├── __init__.py ├── tashkeel.py ├── tashkeel_const.py ├── unknown_const.py ├── unknown_tashkeel.py ├── unkown.py ├── unkown_const.py └── unkown_tashkeel.py ├── mishkalbot.cgi ├── requirements.txt ├── setup.py ├── support ├── spellcheck │ ├── __init__.py │ ├── backup │ ├── spellcheck.py │ ├── spellcheck_const.py │ └── txt └── yaraspell │ ├── __init__.py │ ├── data │ └── spellcheck.sqlite │ ├── spelldb.py │ ├── spelldict.py │ ├── spelltools.py │ └── stem_const.py ├── tests ├── .txt ├── data │ ├── collocations.sqlite │ └── randomtext.txt ├── extractUniqWords.py ├── extractchunks.py ├── harakatpattern.py ├── samples │ ├── 10.txt │ ├── phrases.txt │ ├── phrases2.txt │ ├── semantic.txt │ ├── txt │ └── vocalized │ │ ├── aljazeera.txt │ │ └── rndlines.txt ├── testHarakat.py ├── testUniqWords.sh ├── test_chunk.sh ├── test_foxPhrase.sh ├── test_foxtext.sh ├── test_tashkeelCompare.sh ├── test_tashkeelCompare2.sh ├── test_tashkeelCompare_jazeera.sh ├── test_tashkeelCompare_jazeera_mem.sh ├── test_tashkeel_mem.sh └── tools │ ├── testAnalex.bat │ ├── testNamed2.py │ ├── testNumber.bat │ ├── testNumberVocalized.py │ ├── testSplitClause.py │ ├── test_tashkeel.bat │ ├── test_tashkeel.sh │ ├── test_tashkeelAlecso.sh │ ├── test_tashkeelCompare.bat │ ├── test_tashkeelCompare.sh │ ├── test_tashkeelPhrase.bat │ ├── test_tashkeelPhrase.sh │ ├── testanalex.py │ └── testclause.bat └── tools ├── cleancache ├── cleanpyc ├── mintiq ├── mintiq2 ├── process_files.sh ├── strip_lastmark.sh ├── strip_tashkeel.sh ├── token_convert_to_csv.sh ├── tokenize.sh └── tokenize_uniq.sh /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | patreon: linuxscout 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | tests/* 3 | tmp/* 4 | /interfaces/web/tmp/* 5 | /support/asmai/ 6 | /support/aranasyn/ 7 | /support/archive/ 8 | /interfaces/web/resources/files/fonts.tar.gz 9 | /support/spellcheck/~/* 10 | /support/yaraspell/txt 11 | /support/yaraspell/txt2 12 | /tools/txt 13 | /interfaces/web/resources/templates/main.2.html 14 | / 15 | build/ 16 | dist/ 17 | mishkal.egg-info/ 18 | mypythonenv/ 19 | -------------------------------------------------------------------------------- /CITATION.cff: -------------------------------------------------------------------------------- 1 | abstract: Mishkal is an arabic text vocalization software. 2 | authors: 3 | - family-names: Zerrouki 4 | given-names: Taha 5 | cff-version: 1.0.0 6 | message: If you use this software, please cite it using these metadata. 7 | title: Towards An Open Platform For Arabic Language Processing -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | #/usr/bin/sh 2 | # Build Mishkal Package 3 | default: all 4 | # Clean build files 5 | clean: 6 | 7 | backup: 8 | 9 | #create all files 10 | all: 11 | 12 | # Publish to github 13 | publish: 14 | git push origin master 15 | 16 | date=$(shell date +'%y.%m.%d-%H:%M') 17 | doc: 18 | epydoc -v --config epydoc.conf 19 | # run 20 | server: 21 | python3 interfaces/web/mishkal_bottle.py 22 | flask: 23 | python3 interfaces/web/mishkal_flask.py 24 | gui: 25 | python3 interfaces/gui/mishkal-gui.py 26 | console: 27 | python3 bin/mishkal-console.py 28 | 29 | #build 30 | md2rst: 31 | pandoc -s -r markdown -w rst README.md -o README.rst 32 | md2html: 33 | pandoc -s -r markdown -w html README.md -o README.html 34 | 35 | wheel: 36 | sudo python3 setup.py bdist_wheel 37 | sdist: 38 | sudo python3 setup.py sdist 39 | upload: 40 | echo "use twine upload dist/mishkal-0.1.tar.gz" 41 | install: 42 | sudo python3 setup.py install 43 | 44 | 45 | # tests 46 | test2l:limit=-l 2 47 | test2 test2l: 48 | # test on python 2 49 | python2 bin/mishkal-console.py --progress ${limit} --eval -f tests/samples/phrases.txt >tests/output/test2.csv 50 | test3l:limit=-l 2 51 | test3 test3l: 52 | python3 bin/mishkal-console.py --progress ${limit} --eval -f tests/samples/phrases.txt >tests/output/test3.csv 53 | profile: 54 | python3 -m cProfile -o tests/output/phrases.profile bin/mishkal-console.py --progress --eval -f tests/samples/phrases.txt >tests/output/test3.csv 55 | 56 | 57 | # eval 58 | #~FILE="adab.txt" 59 | #FILE="rndlines.txt" 60 | jazeera:FILE="aljazeera.txt" 61 | jazeera:limit=500 62 | #~ jazeera:profiler=-m cProfile -o output/mishkal.profile 63 | jazeera:profiler=-m cProfile 64 | jazeera: 65 | #~ cd tests;python3 ${profiler} ../bin/mishkal-console.py --cache --progress --eval -l ${limit} -f samples/vocalized/${FILE} >output/compare/rndlines.11.txt 66 | cd tests;python3 ${profiler} ../bin/mishkal-console.py --progress --eval -l ${limit} -f samples/vocalized/${FILE} >output/compare/rndlines.11.txt 67 | echo "make archive" 68 | cd tests;cp output/compare/rndlines.11.txt output/compare/L${date}.txt 69 | echo "save stats" 70 | cd tests;date >> output/compare/file.stats 71 | #~ cd tests;grep "function calls" -2 -h output/compare/rndlines.11.txt | sed 's/^.*function .* in //g;s/:\*.*$//g' | sed 'N;s/\n//g' >> output/compare/file.stats 72 | cd tests;grep "function calls" -h output/compare/rndlines.11.txt > /tmp/lines.tmp 73 | #~ sed "s/^.*function .* in //g;s/:\*.*$$//g" -i /tmp/lines.tmp 74 | #~ sed "N;s/\n//g" -i /tmp/lines.tmp 75 | cd tests;cat /tmp/lines.tmp>> output/compare/file.stats 76 | cd tests;tail -n 3 output/compare/file.stats 77 | 78 | compare:FILE=phrases.txt 79 | compare:limit=10 80 | compare: 81 | cd tests;python3 ../bin/mishkal-console.py --progress --eval -l ${limit} -f samples/${FILE} --compareto samples/${FILE} >output/compare/compare.txt 82 | exe-gui: 83 | pyinstaller mishkal-gui.spec 84 | -------------------------------------------------------------------------------- /THANKS.md: -------------------------------------------------------------------------------- 1 | Acknowledgment 2 | ============== 3 | This is the Thanks file of mishkal project , the acknowledge for the contributors is in the file AUTHORS.md* 4 | 5 | 6 | We gratefully acknowledge the following: 7 | 8 | * DreamDev DZ (DreamDev.dz) 9 | -------------------------------------------------------------------------------- /build/lib/mishkal/__init__.py: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /cgirunner.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | import os.path 3 | import cgitb 4 | cgitb.enable(logdir=os.path.join( 5 | os.path.dirname(__file__), 'tmp/logs'), 6 | display=True, format='html',) 7 | import os, sys 8 | 9 | def run_with_cgi(application): 10 | environ = dict(os.environ.items()) 11 | environ['wsgi.input'] = sys.stdin 12 | environ['wsgi.errors'] = sys.stderr 13 | environ['wsgi.version'] = (1, 0) 14 | environ['wsgi.multithread'] = False 15 | environ['wsgi.multiprocess'] = True 16 | environ['wsgi.run_once'] = True 17 | 18 | if environ.get('HTTPS', 'off') in ('on', '1'): 19 | environ['wsgi.url_scheme'] = 'https' 20 | else: 21 | environ['wsgi.url_scheme'] = 'http' 22 | 23 | headers_set = [] 24 | headers_sent = [] 25 | 26 | def write(data): 27 | if not headers_set: 28 | raise AssertionError("write() before start_response()") 29 | 30 | elif not headers_sent: 31 | # Before the first output, send the stored headers 32 | status, response_headers = headers_sent[:] = headers_set 33 | sys.stdout.write('Status: %s\r\n' % status) 34 | for header in response_headers: 35 | sys.stdout.write('%s: %s\r\n' % header) 36 | sys.stdout.write('\r\n') 37 | 38 | sys.stdout.write(data) 39 | sys.stdout.flush() 40 | 41 | def start_response(status, response_headers, exc_info=None): 42 | if exc_info: 43 | try: 44 | if headers_sent: 45 | # Re-raise original exception if headers sent 46 | raise exc_info[0], exc_info[1], exc_info[2] 47 | finally: 48 | exc_info = None # avoid dangling circular ref 49 | elif headers_set: 50 | raise AssertionError("Headers already set!") 51 | 52 | headers_set[:] = [status, response_headers] 53 | return write 54 | 55 | result = application(environ, start_response) 56 | try: 57 | for data in result: 58 | if data: # don't send headers until body appears 59 | write(data) 60 | if not headers_sent: 61 | write('') # send headers now if body was empty 62 | finally: 63 | if hasattr(result, 'close'): 64 | result.close() 65 | -------------------------------------------------------------------------------- /core/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/core/__init__.py -------------------------------------------------------------------------------- /core/generate.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding=utf-8 -*- 3 | # 4 | import re, string,sys 5 | # from arabic_const import * 6 | sys.path.append('mishkal/lib/'); 7 | from pyarabic.araby import * 8 | pronouns=( 9 | YEH, 10 | KAF, 11 | HEH, 12 | KAF+MEEM, 13 | KAF+NOON, 14 | HEH+ALEF, 15 | HEH+MEEM, 16 | HEH+NOON, 17 | NOON+ALEF, 18 | KAF+MEEM+ALEF, 19 | HEH+MEEM+ALEF, 20 | ); 21 | jonction=(WAW,FEH); 22 | prepositions=(BEH,KAF,LAM); 23 | definition=(u''.join([ALEF,LAM])); 24 | 25 | def generate_allforms(word,has_pronouns=True,has_jonction=True,has_preposition=True,has_definition=True,has_interrog=True): 26 | mylist=[word+FATHA, word+DAMMA, word+KASRA]; 27 | temp=[]; 28 | if has_preposition : 29 | for w in mylist: 30 | if w.endswith(KASRA): 31 | # temp.append(w) 32 | for pr in prepositions: 33 | temp.append(pr+"-"+w); 34 | mylist+=temp; 35 | temp=[]; 36 | if has_jonction : 37 | for w in mylist: 38 | # temp.append(w) 39 | for jo in jonction: 40 | temp.append(jo+"-"+w); 41 | mylist+=temp; 42 | temp=[]; 43 | if has_interrog : 44 | for w in mylist: 45 | # temp.append(w) 46 | temp.append(ALEF_HAMZA_ABOVE+"-"+w); 47 | mylist+=temp; 48 | temp=[]; 49 | 50 | if has_pronouns: 51 | for word in mylist: 52 | for p in pronouns: 53 | if p==YEH and not word.endswith(KASRA): 54 | pass; 55 | else: 56 | # convert ALEF_mAKSURA to YEH 57 | if word.endswith(ALEF_MAKSURA): 58 | temp.append(word[:-1]+ALEF+"-"+p); 59 | elif word.endswith(HAMZA+KASRA): 60 | temp.append(word[:-2]+YEH_HAMZA+KASRA+"-"+p); 61 | elif word.endswith(HAMZA+DAMMA): 62 | temp.append(word[:-2]+WAW_HAMZA+DAMMA+"-"+p) 63 | else: 64 | temp.append(word+"-"+p); 65 | # add alef lam ta3rif 66 | if has_definition: 67 | temp.append(ALEF+LAM+"-"+word) 68 | mylist+=temp; 69 | return mylist; 70 | 71 | 72 | def standardize_form(word): 73 | word=re.sub(u"%s-"%ALEF_MAKSURA,ALEF,word) 74 | word=re.sub(u"%s-"%TEH_MARBUTA,TEH,word) 75 | word=re.sub(u"%s-%s%s"%(LAM,ALEF,LAM),LAM+LAM,word) 76 | word=re.sub(u"-",'', word); 77 | return word; 78 | def generate(word): 79 | genlist=generate_allforms(word); 80 | result_list=[]; 81 | for oneword in genlist: 82 | result_list.append({'affixed':oneword,'standard':standardize_form(oneword)} ) 83 | return result_list; 84 | 85 | -------------------------------------------------------------------------------- /core/myrepr.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: UTF-8 -*- 3 | #------------------------------------------------------------------------------- 4 | # Name: myrepr 5 | # Purpose: Used to custmize repr fucntions 6 | # 7 | # Author: Taha Zerrouki (taha.zerrouki[at]gmail.com) 8 | # 9 | # Created: 31-10-2011 10 | # Copyright: (c) Taha Zerrouki 2011 11 | # Licence: GPL 12 | #------------------------------------------------------------------------------- 13 | 14 | import repr as reprlib 15 | import sys 16 | class MyRepr(reprlib.Repr): 17 | def repr_unicode(self, obj, level): 18 | "Modify unicode display " 19 | return u"u'%s'"%obj; 20 | # return obj.encode('utf8'); 21 | -------------------------------------------------------------------------------- /crossdomain.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /customfile.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
7 | 8 |
9 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 |
27 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/AUTHORS.txt: -------------------------------------------------------------------------------- 1 | Taha Zerrouki 2 | 3 | -------------------------------------------------------------------------------- /docs/HowTo.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/docs/HowTo.odt -------------------------------------------------------------------------------- /docs/Ideas.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/docs/Ideas.odt -------------------------------------------------------------------------------- /docs/README.txt: -------------------------------------------------------------------------------- 1 | Mishkal : Arabic text vocalization system 2 | مشكال لتشكيل النصوص العربية 3 | This program is licensed under the GPL License 4 | Developpers: 5 | Taha Zerrouki: http://tahadz.com 6 | taha dot zerrouki at gmail dot com 7 | 8 | 9 | Site: 10 | ========== 11 | http://tahadz.com 12 | Download 13 | ========== 14 | http://mishkal.sourceforge.net 15 | Source 16 | ============= 17 | http://svn.arabeyes.org 18 | http://github.com/linuxscout/mishkal 19 | 20 | 21 | Usage 22 | ===== 23 | * Windows : 24 | ----------- 25 | Run MishkalGui 26 | 27 | * GUI: Linux 28 | --------------- 29 | - mishkal-gui 30 | *Web server (linux, windows) 31 | ----------- 32 | mishkal-webserver 33 | serving on 0.0.0.0:8080 view at http://127.0.0.1:8080 34 | open in your browser the URL: http://127.0.0.1:8080 35 | 36 | * Console (linux/windows) 37 | ----------------- 38 | Usage: mishkal-console -f filename [OPTIONS] 39 | mishkal-console 'السلام عليكم' [OPTIONS] 40 | 41 | [-f | --file= filename]input file to mishkal-console 42 | [-i | --ignore] ignore the last Mark on output words. 43 | [-r | --reduced] Reduced Tashkeel. 44 | [-s | --strip] Strip tashkeel (remove harakat). 45 | [-h | --help] outputs this usage message 46 | [-v | --version] program version 47 | [-l | --limit] vocalize only a limited number of line 48 | [-x | --syntax] disable syntaxic analysis 49 | [-m | --semantic] disable semantic analysis 50 | [-c | --compare] compare the vocalized text with the program output 51 | [-t | --stat] disable statistic tashkeel 52 | 53 | This program is licensed under the GPL License 54 | 55 | 56 | Files 57 | ===== 58 | file/directory category description 59 | [program] 60 | mishkal-console.py program Mishkal script used on shell command 61 | mishkal-gui.py program launch mishkal GUI interface with QT 62 | mishkal-webserver.py web lauch mishkal web server 63 | 64 | [docs] 65 | docs/ docs documentation 66 | [setup] 67 | exe_setup.py setup prepare setup for windows using py2exe 68 | setup.py setup setup for library and linux package 69 | [mishkal] 70 | aranasyn/ src Arabic syntaxic analyzer 71 | asmai/ src Arabic syntaxic analyzer 72 | core/ src basic tools 73 | gui/ src GUI source 74 | tashkeel/ src Tashkeel module source 75 | [lib] 76 | lib/ lib Libraries 77 | [data] 78 | data/ data databases files 79 | [resouces] 80 | ar/ resources reources for gui arabic 81 | [log] 82 | tmp/ log tomporary fdirectory for web service 83 | [tools] 84 | cleanpyc setup a shell script to remove .pyc files 85 | [test] 86 | output/ test test output 87 | samples/ test sample files 88 | tools/ test script to use mishkal 89 | [web] 90 | files/ web files used for web service 91 | templates/ web Templates used for web service 92 | adawaty.py web a script for web service 93 | cgirunner.py web a script for web service using cgi 94 | crossdomain.xml web Configuration file to allow cross domain json API 95 | index.html web an index file to avoid directory access 96 | mishkal.cgi web A cgi Script used on web service 97 | mishkal-webserver.py web lauch mishkal web server 98 | [apps] 99 | mintiq TTS a shell script to join mishkla with espeak Text to speech 100 | 101 | JSON connection API: 102 | ----------------- 103 | view docs/html/index.html (in arabic) 104 | -------------------------------------------------------------------------------- /docs/THANKS.txt: -------------------------------------------------------------------------------- 1 | Credits 2 | Many thanks to the following individuals who have provided useful feedback and contibutions. 3 | 4 | Abdelwahab Djoudi 5 | Sohaib Afifi. 6 | Assem Chelli 7 | Bassem Jarkas 8 | Ibrahim Bounehasse 9 | Mohamed Attia 10 | Dr. Nada Ghoneim 11 | Waleed Alhassan 12 | Mohamed Chaaban (linuxac.org) 13 | Mos'ab alZu'bi (linuxac.org) 14 | Taha munzir 15 | Walid Ziouche 16 | Fahad Al-Saidi‏ 17 | 18 | -------------------------------------------------------------------------------- /docs/TODO.txt: -------------------------------------------------------------------------------- 1 | - إضافة قاعدة الافعال الناقصة مع التصريف 2 | - العفل المضارع المسبوق بحرف غير مؤثر يكون مرفوعا 3 | - الفعل المسبوق بضمير منصوب منفصل ، لايأتي بعده مفعول 4 | - حرف عطف واسم إشارة تعتبر استئنافا 5 | - إضافة علاقة التبعية 6 | - إضافة حقل محل الإعراب للكلمة * تم 7 | - إضافة البناء للكلمة *تم 8 | - إضافة الضمير والزمن إلى الفعل 9 | - الضمير نوعه ونوعه 10 | - الزمن نوعه بناؤه 11 | - تقليل الحقول: *تم 12 | استخدام ترميز ثنائي من أجل السماح بعدة خيارات 13 | not defined : 0 00000 14 | factor : 1 00001 15 | Rafe3 : 2 00010 16 | Naseb : 4 00100 17 | Jar : 8 01000 18 | Jazem : 16 10000 19 | active : 32 100000 20 | - حقل واحد للحالة الإعرابية 21 | - مبني مرفوع، منصوب، مجرور، مجزوم 22 | - حقل واحد للعدد 23 | - مفرد، مثنى، جمع (نوع الجمع: مؤنث سالم، مذكر سالم، تكسير 24 | - حقل واحد للجنس: مذكر مؤنث 25 | - حقل واحد للقسم: اسم، حرف، فعل 26 | - أقسام الاسم: علم، صفة، 27 | - حقل واحد للعامل: عامل/ عاطل، رافع، ناصب، جار، جازم، 28 | - عرض معلومات أكثر في الموقع، عرض إعراب الكلمة * تم 29 | - استبدال كل العبارات النصية في الكود بمجموعة من الوسوم المعرفة في ملف واحد 30 | - اختيار عينات نصية أفضل. 31 | - مشكلة في تنوين الأسماء المقصورة مثل راع، ووال، وقاض 32 | - قمنا باختصار عددة حالات التنوين، لكنها لم تفلح لأنّ للتنوين عدة أنواع. 33 | - فكرة تلوين الكلمات غير المؤكدة التشكيل بلون مميّز 34 | - إضافة خاصية التحليل الصرفي دون إعراب. 35 | - التشكيل الخفيف والمبسّط والواضح: 36 | - التشكيل الخفيف بإعراب ودون إعراب 37 | - التشكيل الواضح ما وضحت حروفه، وهو مثل تشكيل ما قبل الألف وما قبل التاء، 38 | - التشكيل المبسّط أن يتم توليد التشكيلات دون تحليل صرفي 39 | - نستعمل أنواع التشكيل المبسط والخفيف والواضح في تسهيل النطق 40 | - جرد الكلمات ذات التشكيل الوحيد دون إعراب أو مع الإعراب. 41 | - تشكيل الجملة في خطوتين، الأولى لاكتشاف التراكيب النحوية الواضحة، وفي الثانية لتحليل الأمور الملتبسة. 42 | - إعادة تصميم التحليل الصرفي مما يسمح بتجميع المعلومات حسب إطارها النحوي والدلالي، مثلا ضربَ، ضربُ، ضربِ، تكون مجتمعة في مجموعة واحدة وما يفرقها هو إعرابها. كما تجمع ضرْب وضرَب في إطار واحد باعتبارهما متشاكلتين. 43 | - تغيير حركة هاء الضمير المتصلة بعد مجرور مثل عبدِهِم * تم 44 | - تصحيح التنوين قبل اسم موصول مثل "تنظيم ما أريد" 45 | - تصريف الأسماء الحرفية مثل كلّ، بعض، وهي من كلّ ومن بعض. 46 | - تصحيح الأخطاء الشائعة، وتجاوز التشكل غير الصالح 47 | - 48 | - تحسين ملف السجل وضغطه 49 | - حالات الخطأ الشائع في كتابة الياء المصرية 50 | - معجم الأسماء 51 | - تغيير حركة هاء الضمير المتصلة بعد مجرور مثل عبدِهِ تم * 52 | - تحسين المحلل الصرفي مع الاسماء 53 | - معالجة العطف 54 | - الإضافة اللفظية مثل لاعبو الفريق تم * 55 | - إضافة كلمات شائعة منصوبات مثل جدَّا مؤخرا 56 | - استعمال بيانات خارجية على هيئة XML 57 | - تطوير آلية لتقييم أداء التشكيل 58 | * التشكيل المختزل. تم 59 | اختزال التشكيل مع توليد الاقتراحات 60 | - إضافة خيارات التشكيل 61 | التشكيل المختزل* تم 62 | قياس الأداء * تم 63 | تصحيح تلقائي *تم 64 | توليد الاقتراحات* تم 65 | إزالة التشكيل 66 | إزالة الحركات ما عدا الشّدّة 67 | - معالجة الكلمات المستبعدة وعرض اقتراحاتها 68 | - إعادة التشكيل بعد تعديلات المستخدم 69 | - معالجة التشكيل الجزئي للكلمات والشدة 80% 70 | - معالجة الشدّة 80% 71 | - إعادة ترتيب الأصناف 72 | - المحلل النحوي 73 | - البدل: هذا 74 | - معالجة إعراب الحروف 75 | - المتلازمات اللفظية 76 | - تشكيل المنلازمات 77 | - عرض نصوص عشوائية في الخانة 78 | * سجل المدخلات * تم 79 | - سجل التصحيح 80 | - تصميم جيد 81 | - التصحيح التلقائي. 82 | - واجهة سطح مكتب* تم 83 | - واجهة تطبيق للويب، يمكن استعمالها في مواقع أخرى. 84 | - وضع علامة للحروف الصامنة 85 | = استغلال المترادفات والأضداد في التشكيل من خلال التعويض. 86 | - بناء قاعدة بيانات الأسماء, 87 | -------------------------------------------------------------------------------- /docs/VERSION.txt: -------------------------------------------------------------------------------- 1 | version 0.5 2 | date 2013-05-18 3 | version 0.4 4 | date 2013.02.19 5 | version 0.3 6 | date : 31-12-2012 7 | -------------------------------------------------------------------------------- /docs/html/images/gotashkeel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/docs/html/images/gotashkeel.png -------------------------------------------------------------------------------- /docs/html/images/mishkal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/docs/html/images/mishkal.png -------------------------------------------------------------------------------- /docs/html/images/mishkal_alpha_smpl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/docs/html/images/mishkal_alpha_smpl.png -------------------------------------------------------------------------------- /docs/html/images/mixkal.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/docs/html/images/mixkal.jpg -------------------------------------------------------------------------------- /docs/ideas.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/docs/ideas.txt -------------------------------------------------------------------------------- /epydoc.conf: -------------------------------------------------------------------------------- 1 | [epydoc] # Epydoc section marker (required by ConfigParser) 2 | 3 | # Information about the project. 4 | name: Mishkal Arabic text vocalization software مشكال لتشكيل النصوص العربية 5 | url: https://github.com/linuxscout/mishkal/ 6 | 7 | # The list of modules to document. Modules can be named using 8 | # dotted names, module filenames, or package directory names. 9 | # This option may be repeated. 10 | modules: sys, os.path, re 11 | modules: mishkal/tashkeel/tashkeel.py 12 | 13 | # Write html output to the directory "apidocs" 14 | output: html 15 | target: doc/html/ 16 | 17 | # Include all automatically generated graphs. These graphs are 18 | # generated using Graphviz dot. 19 | graph: all 20 | dotpath: /usr/bin/dot 21 | -------------------------------------------------------------------------------- /interfaces/gui/ar/about.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | مشكال: تشكيل النصوص العربية 5 | 6 | 7 | 8 | 9 |

التشكيل

10 |

تشكيل النصوص العربية أهم مسائل معالجة اللغة العربية، بلوغه يقتضي تجاوز عقبات عديدة، وقد أهمّت هذه المسألة الكثير من الباحثين، وحتى الشركات، لتزاحمنا غوغل بتطبيق تشكيل.

11 | 12 |

تسمية المشروع:

13 |

نريد أن نسمي هذا المشروع “مشكال”، وهو أداة بصرية لصنع الأشكال الملونة المزخرفة، kaleidoscope.

14 | 15 |

من مزايا البرنامج:

16 | 21 | 22 | موقع المشروع 23 | http://tashkeel.qutrub.org
24 | 30 |

دعوة للمساهمة:

31 | 32 |

نرجو من الإخوة المطورين 33 | المساهمة، 34 | في تطوير هذا المشروع، كل بما يستطيع. لا تتردد 35 | 36 | (اتّصل بنا) 37 |

38 | 39 | 40 | -------------------------------------------------------------------------------- /interfaces/gui/ar/help_body.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | مشكال لتشكيل النصوص 7 | 8 |

تشكيل النص

9 | 20 |

-------------------------------------------------------------------------------- /interfaces/gui/ar/images/alef_wasla.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/ar/images/alef_wasla.png -------------------------------------------------------------------------------- /interfaces/gui/ar/images/animation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/ar/images/animation.png -------------------------------------------------------------------------------- /interfaces/gui/ar/images/appicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/ar/images/appicon.ico -------------------------------------------------------------------------------- /interfaces/gui/ar/images/appicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/ar/images/appicon.png -------------------------------------------------------------------------------- /interfaces/gui/ar/images/copy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/ar/images/copy.png -------------------------------------------------------------------------------- /interfaces/gui/ar/images/cut.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/ar/images/cut.png -------------------------------------------------------------------------------- /interfaces/gui/ar/images/damma.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/ar/images/damma.png -------------------------------------------------------------------------------- /interfaces/gui/ar/images/dammatan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/ar/images/dammatan.png -------------------------------------------------------------------------------- /interfaces/gui/ar/images/exit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/ar/images/exit.png -------------------------------------------------------------------------------- /interfaces/gui/ar/images/fatha.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/ar/images/fatha.png -------------------------------------------------------------------------------- /interfaces/gui/ar/images/fathatan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/ar/images/fathatan.png -------------------------------------------------------------------------------- /interfaces/gui/ar/images/font.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/ar/images/font.png -------------------------------------------------------------------------------- /interfaces/gui/ar/images/gaf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/ar/images/gaf.png -------------------------------------------------------------------------------- /interfaces/gui/ar/images/help.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/ar/images/help.jpg -------------------------------------------------------------------------------- /interfaces/gui/ar/images/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/ar/images/icon.png -------------------------------------------------------------------------------- /interfaces/gui/ar/images/ix.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/ar/images/ix.ico -------------------------------------------------------------------------------- /interfaces/gui/ar/images/ixn.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/ar/images/ixn.ico -------------------------------------------------------------------------------- /interfaces/gui/ar/images/kasra.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/ar/images/kasra.png -------------------------------------------------------------------------------- /interfaces/gui/ar/images/kasratan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/ar/images/kasratan.png -------------------------------------------------------------------------------- /interfaces/gui/ar/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/ar/images/logo.png -------------------------------------------------------------------------------- /interfaces/gui/ar/images/new.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/ar/images/new.png -------------------------------------------------------------------------------- /interfaces/gui/ar/images/open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/ar/images/open.png -------------------------------------------------------------------------------- /interfaces/gui/ar/images/paste.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/ar/images/paste.png -------------------------------------------------------------------------------- /interfaces/gui/ar/images/peh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/ar/images/peh.png -------------------------------------------------------------------------------- /interfaces/gui/ar/images/preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/ar/images/preview.png -------------------------------------------------------------------------------- /interfaces/gui/ar/images/print.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/ar/images/print.png -------------------------------------------------------------------------------- /interfaces/gui/ar/images/qutrub.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/ar/images/qutrub.ico -------------------------------------------------------------------------------- /interfaces/gui/ar/images/save.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/ar/images/save.png -------------------------------------------------------------------------------- /interfaces/gui/ar/images/shadda.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/ar/images/shadda.png -------------------------------------------------------------------------------- /interfaces/gui/ar/images/smallalef.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/ar/images/smallalef.png -------------------------------------------------------------------------------- /interfaces/gui/ar/images/sukun.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/ar/images/sukun.png -------------------------------------------------------------------------------- /interfaces/gui/ar/images/tatweel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/ar/images/tatweel.png -------------------------------------------------------------------------------- /interfaces/gui/ar/images/text-speak.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/ar/images/text-speak.png -------------------------------------------------------------------------------- /interfaces/gui/ar/images/txt: -------------------------------------------------------------------------------- 1 | alef_wasla.png 2 | animation.png 3 | appicon.ico 4 | appicon.png 5 | copy.png 6 | cut.png 7 | damma.png 8 | dammatan.png 9 | exit.png 10 | fatha.png 11 | fathatan.png 12 | font.png 13 | gaf.png 14 | help.jpg 15 | icon.png 16 | kasra.png 17 | kasratan.png 18 | logo.png 19 | new.png 20 | open.png 21 | paste.png 22 | peh.png 23 | preview.png 24 | print.png 25 | qutrub.ico 26 | save.png 27 | shadda.png 28 | smallalef.PNG 29 | sukun.png 30 | tatweel.PNG 31 | text-speak.png 32 | Thumbs.db 33 | txt 34 | zoomin.png 35 | zoomout.png 36 | zwj.png 37 | zwnj.png 38 | -------------------------------------------------------------------------------- /interfaces/gui/ar/images/weblogo.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/ar/images/weblogo.ico -------------------------------------------------------------------------------- /interfaces/gui/ar/images/zoomin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/ar/images/zoomin.png -------------------------------------------------------------------------------- /interfaces/gui/ar/images/zoomout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/ar/images/zoomout.png -------------------------------------------------------------------------------- /interfaces/gui/ar/images/zwj.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/ar/images/zwj.png -------------------------------------------------------------------------------- /interfaces/gui/ar/images/zwnj.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/ar/images/zwnj.png -------------------------------------------------------------------------------- /interfaces/gui/ar/projects.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | مشاريع 5 | 6 | 7 | 8 | 9 | 10 |

مشاريع

11 | 12 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /interfaces/gui/ar/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | direction: rtl; 3 | font-family: Traditional Arabic, "Times New Roman"; 4 | font-size: 16pt; 5 | padding: 1cm; 6 | padding-top: 0.25cm; 7 | margin-left: 5%; 8 | margin-right: 5%; 9 | } 10 | 11 | 12 | h1 { 13 | color: rgb(255, 255, 255); 14 | background-color: rgb(204, 0, 0); 15 | width: 839px; 16 | height: 1.5em; 17 | text-align: right; 18 | margin-left: auto; 19 | margin-right: 0px; 20 | } 21 | 22 | p { 23 | text-align: right; 24 | margin-top: 0; 25 | margin-right: 5%; 26 | } 27 | 28 | table { 29 | direction: rtl; 30 | width: 100%; 31 | margin: 0; 32 | } 33 | 34 | td {vertical-align: top;} 35 | th {text-align: right;white-space: nowrap;} 36 | #result { font-size:16pt;} 37 | .result { font-size:16pt;} 38 | img#logo { border: 0px solid;} 39 | -------------------------------------------------------------------------------- /interfaces/gui/gui/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/gui/__init__.py -------------------------------------------------------------------------------- /interfaces/gui/gui/ar/about.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | مشكال: تشكيل النصوص العربية 5 | 6 | 7 | 8 | 9 |

التشكيل

10 |

تشكيل النصوص العربية أهم مسائل معالجة اللغة العربية، بلوغه يقتضي تجاوز عقبات عديدة، وقد أهمّت هذه المسألة الكثير من الباحثين، وحتى الشركات، لتزاحمنا غوغل بتطبيق تشكيل.

11 | 12 |

تسمية المشروع:

13 |

نريد أن نسمي هذا المشروع “مشكال”، وهو أداة بصرية لصنع الأشكال الملونة المزخرفة، kaleidoscope.

14 | 15 |

من مزايا البرنامج:

16 | 21 | 22 | موقع المشروع 23 | http://tashkeel.qutrub.org
24 | 30 |

دعوة للمساهمة:

31 | 32 |

نرجو من الإخوة المطورين 33 | المساهمة، 34 | في تطوير هذا المشروع، كل بما يستطيع. لا تتردد 35 | 36 | (اتّصل بنا) 37 |

38 | 39 | 40 | -------------------------------------------------------------------------------- /interfaces/gui/gui/ar/help_body.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | مشكال لتشكيل النصوص 7 | 8 |

تشكيل النص

9 | 20 |

-------------------------------------------------------------------------------- /interfaces/gui/gui/ar/images/alef_wasla.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/gui/ar/images/alef_wasla.png -------------------------------------------------------------------------------- /interfaces/gui/gui/ar/images/animation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/gui/ar/images/animation.png -------------------------------------------------------------------------------- /interfaces/gui/gui/ar/images/appicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/gui/ar/images/appicon.ico -------------------------------------------------------------------------------- /interfaces/gui/gui/ar/images/appicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/gui/ar/images/appicon.png -------------------------------------------------------------------------------- /interfaces/gui/gui/ar/images/copy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/gui/ar/images/copy.png -------------------------------------------------------------------------------- /interfaces/gui/gui/ar/images/cut.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/gui/ar/images/cut.png -------------------------------------------------------------------------------- /interfaces/gui/gui/ar/images/damma.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/gui/ar/images/damma.png -------------------------------------------------------------------------------- /interfaces/gui/gui/ar/images/dammatan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/gui/ar/images/dammatan.png -------------------------------------------------------------------------------- /interfaces/gui/gui/ar/images/exit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/gui/ar/images/exit.png -------------------------------------------------------------------------------- /interfaces/gui/gui/ar/images/fatha.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/gui/ar/images/fatha.png -------------------------------------------------------------------------------- /interfaces/gui/gui/ar/images/fathatan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/gui/ar/images/fathatan.png -------------------------------------------------------------------------------- /interfaces/gui/gui/ar/images/font.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/gui/ar/images/font.png -------------------------------------------------------------------------------- /interfaces/gui/gui/ar/images/gaf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/gui/ar/images/gaf.png -------------------------------------------------------------------------------- /interfaces/gui/gui/ar/images/help.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/gui/ar/images/help.jpg -------------------------------------------------------------------------------- /interfaces/gui/gui/ar/images/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/gui/ar/images/icon.png -------------------------------------------------------------------------------- /interfaces/gui/gui/ar/images/ix.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/gui/ar/images/ix.ico -------------------------------------------------------------------------------- /interfaces/gui/gui/ar/images/ixn.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/gui/ar/images/ixn.ico -------------------------------------------------------------------------------- /interfaces/gui/gui/ar/images/kasra.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/gui/ar/images/kasra.png -------------------------------------------------------------------------------- /interfaces/gui/gui/ar/images/kasratan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/gui/ar/images/kasratan.png -------------------------------------------------------------------------------- /interfaces/gui/gui/ar/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/gui/ar/images/logo.png -------------------------------------------------------------------------------- /interfaces/gui/gui/ar/images/new.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/gui/ar/images/new.png -------------------------------------------------------------------------------- /interfaces/gui/gui/ar/images/open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/gui/ar/images/open.png -------------------------------------------------------------------------------- /interfaces/gui/gui/ar/images/paste.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/gui/ar/images/paste.png -------------------------------------------------------------------------------- /interfaces/gui/gui/ar/images/peh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/gui/ar/images/peh.png -------------------------------------------------------------------------------- /interfaces/gui/gui/ar/images/preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/gui/ar/images/preview.png -------------------------------------------------------------------------------- /interfaces/gui/gui/ar/images/print.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/gui/ar/images/print.png -------------------------------------------------------------------------------- /interfaces/gui/gui/ar/images/qutrub.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/gui/ar/images/qutrub.ico -------------------------------------------------------------------------------- /interfaces/gui/gui/ar/images/save.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/gui/ar/images/save.png -------------------------------------------------------------------------------- /interfaces/gui/gui/ar/images/shadda.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/gui/ar/images/shadda.png -------------------------------------------------------------------------------- /interfaces/gui/gui/ar/images/smallalef.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/gui/ar/images/smallalef.png -------------------------------------------------------------------------------- /interfaces/gui/gui/ar/images/sukun.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/gui/ar/images/sukun.png -------------------------------------------------------------------------------- /interfaces/gui/gui/ar/images/tatweel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/gui/ar/images/tatweel.png -------------------------------------------------------------------------------- /interfaces/gui/gui/ar/images/text-speak.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/gui/ar/images/text-speak.png -------------------------------------------------------------------------------- /interfaces/gui/gui/ar/images/txt: -------------------------------------------------------------------------------- 1 | alef_wasla.png 2 | animation.png 3 | appicon.ico 4 | appicon.png 5 | copy.png 6 | cut.png 7 | damma.png 8 | dammatan.png 9 | exit.png 10 | fatha.png 11 | fathatan.png 12 | font.png 13 | gaf.png 14 | help.jpg 15 | icon.png 16 | kasra.png 17 | kasratan.png 18 | logo.png 19 | new.png 20 | open.png 21 | paste.png 22 | peh.png 23 | preview.png 24 | print.png 25 | qutrub.ico 26 | save.png 27 | shadda.png 28 | smallalef.PNG 29 | sukun.png 30 | tatweel.PNG 31 | text-speak.png 32 | Thumbs.db 33 | txt 34 | zoomin.png 35 | zoomout.png 36 | zwj.png 37 | zwnj.png 38 | -------------------------------------------------------------------------------- /interfaces/gui/gui/ar/images/weblogo.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/gui/ar/images/weblogo.ico -------------------------------------------------------------------------------- /interfaces/gui/gui/ar/images/zoomin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/gui/ar/images/zoomin.png -------------------------------------------------------------------------------- /interfaces/gui/gui/ar/images/zoomout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/gui/ar/images/zoomout.png -------------------------------------------------------------------------------- /interfaces/gui/gui/ar/images/zwj.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/gui/ar/images/zwj.png -------------------------------------------------------------------------------- /interfaces/gui/gui/ar/images/zwnj.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/gui/ar/images/zwnj.png -------------------------------------------------------------------------------- /interfaces/gui/gui/ar/projects.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | مشاريع 5 | 6 | 7 | 8 | 9 | 10 |

مشاريع

11 | 12 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /interfaces/gui/gui/ar/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | direction: rtl; 3 | font-family: Traditional Arabic, "Times New Roman"; 4 | font-size: 16pt; 5 | padding: 1cm; 6 | padding-top: 0.25cm; 7 | margin-left: 5%; 8 | margin-right: 5%; 9 | } 10 | 11 | 12 | h1 { 13 | color: rgb(255, 255, 255); 14 | background-color: rgb(204, 0, 0); 15 | width: 839px; 16 | height: 1.5em; 17 | text-align: right; 18 | margin-left: auto; 19 | margin-right: 0px; 20 | } 21 | 22 | p { 23 | text-align: right; 24 | margin-top: 0; 25 | margin-right: 5%; 26 | } 27 | 28 | table { 29 | direction: rtl; 30 | width: 100%; 31 | margin: 0; 32 | } 33 | 34 | td {vertical-align: top;} 35 | th {text-align: right;white-space: nowrap;} 36 | #result { font-size:16pt;} 37 | .result { font-size:16pt;} 38 | img#logo { border: 0px solid;} 39 | -------------------------------------------------------------------------------- /interfaces/gui/gui/customdictionary.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | import re 5 | import sys 6 | sys.path.append('../lib/') 7 | import pyarabic.araby as araby 8 | from io import open 9 | class CustomizedDictionary: 10 | """ 11 | Class of customized words added by users for unrecognized word""" 12 | def __init__(self): 13 | self.filename = "/tmp/customfile.txt"; 14 | self.dictio = {} 15 | self.cdfile = False 16 | try: 17 | #~if os.path.exists(self.filename): 18 | self.cdfile = open(self.filename, "a+", encoding="utf8") 19 | except: 20 | print("loading: Can't open custom dictionary") 21 | if self.cdfile: 22 | line = self.cdfile.readline() 23 | #line = (self.cdfile.readline()).decode('utf8') 24 | while line: 25 | items = line.strip("\n").split("\t"); 26 | if len(items)>=2: 27 | self.dictio[items[0]] = items[1].split(":") 28 | line = (self.cdfile.readline()).decode('utf8') 29 | self.cdfile.close() 30 | 31 | 32 | 33 | 34 | def lookup(self, word): 35 | """ 36 | look up for a vocalization given by user for unrecongnized words 37 | @return: vocalized word 38 | @rtype: list of unicode 39 | """ 40 | word = araby.strip_tashkeel(word) 41 | if word in self.dictio: 42 | return self.dictio[word] 43 | else: 44 | return [word, ] 45 | def add(self, word): 46 | """ 47 | add a new vocalization given by user for unrecongnized word 48 | @return: vocalized word 49 | @rtype: none 50 | """ 51 | word_nm = araby.strip_tashkeel(word) 52 | if word_nm not in self.dictio: 53 | self.dictio[word_nm] = [word, ] 54 | else: 55 | if word not in self.dictio[word_nm]: 56 | self.dictio[word_nm].append(word) 57 | try: 58 | self.cdfile = open(self.filename, "a+") 59 | text = u"%s\t%s\n"%(word_nm, u':'.join(self.dictio[word_nm])) 60 | self.cdfile.write(text.encode('utf8')) 61 | self.cdfile.close() 62 | except: 63 | print("updating:can't update cutom dictionary'") 64 | 65 | def __del__(self,): 66 | """ 67 | When the object is deleted, update dictionnary 68 | """ 69 | print("deleting custom dictionary") 70 | try: 71 | self.cdfile = open(self.filename, "w", encoding="utf8") 72 | for word_nm in self.dictio: 73 | text = u"%s\t%s\n"%(word_nm, u':'.join(self.dictio[word_nm])) 74 | self.cdfile.write(text) 75 | #self.cdfile.write(text.encode('utf8')) 76 | self.cdfile.close() 77 | except: 78 | print("closing: Can't open dictionary file for update'") 79 | #~for word_nm in self.dictio: 80 | #~text = u"%s\t%s"%(word_nm, u':'.join(self.dictio[word_nm])) 81 | #~self.cdfile.write(text) 82 | #~self.cdfile.close() 83 | if __name__ == '__main__': 84 | cd = CustomizedDictionary() 85 | cd.add(u"سَلامٌ") 86 | cd.add(u"سلامٍ") 87 | cd.add(u"سلامً") 88 | cd.add(u"سُلام") 89 | cd.add(u"عبيِرٌ") 90 | print(cd.lookup(u'سلام')) 91 | -------------------------------------------------------------------------------- /interfaces/gui/mishkal-gui.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | import sys 4 | import os 5 | import PyQt5.QtGui 6 | import PyQt5.QtWidgets 7 | PWD = os.path.join(os.path.dirname(sys.argv[0])) 8 | sys.path.append(os.path.join(PWD, '../../support/')) 9 | sys.path.append(os.path.join(PWD, '../../mishkal')) 10 | sys.path.append(os.path.join(PWD, '../../')) 11 | 12 | from gui.appgui import * 13 | app = PyQt5.QtWidgets.QApplication(sys.argv) 14 | 15 | widget = PyQt5.QtWidgets.QMainWindow() 16 | ##widget.resize(250, 150) 17 | widget.layoutDirection='RightToLeft'; 18 | widget.setWindowTitle('simple') 19 | widget.show() 20 | 21 | w= Ui_MainWindow(); 22 | w.setupUi(widget); 23 | ##w.show(); 24 | sys.exit(app.exec_()) 25 | -------------------------------------------------------------------------------- /interfaces/gui/~/tmp/qalsadiCache/_indexes/00id.py: -------------------------------------------------------------------------------- 1 | # id 2 | # UniqueHashIndex 3 | 4 | # inserted automatically 5 | import os 6 | import marshal 7 | 8 | import struct 9 | import shutil 10 | 11 | from hashlib import md5 12 | 13 | # custom db code start 14 | # db_custom 15 | 16 | 17 | # custom index code start 18 | # ind_custom 19 | 20 | 21 | # source of classes in index.classes_code 22 | # classes_code 23 | 24 | 25 | # index code start 26 | 27 | class UniqueHashIndex(IU_UniqueHashIndex): 28 | """ 29 | That class is designed to be used in custom indexes. It's designed to be **id** index. 30 | """ 31 | pass 32 | -------------------------------------------------------------------------------- /interfaces/gui/~/tmp/qalsadiCache/_indexes/01a.py: -------------------------------------------------------------------------------- 1 | # a 2 | # WithAIndex 3 | 4 | # inserted automatically 5 | import os 6 | import marshal 7 | 8 | import struct 9 | import shutil 10 | 11 | from hashlib import md5 12 | 13 | # custom db code start 14 | # db_custom 15 | 16 | 17 | # custom index code start 18 | # ind_custom 19 | 20 | 21 | # source of classes in index.classes_code 22 | # classes_code 23 | 24 | 25 | # index code start 26 | 27 | class WithAIndex(HashIndex): 28 | 29 | def __init__(self, *args, **kwargs): 30 | kwargs['key_format'] = '32s' 31 | #~ kwargs['hash_lim'] = 4 * 1024 32 | super(WithAIndex, self).__init__(*args, **kwargs) 33 | 34 | def make_key_value(self, data): 35 | a_val = data.get("a") 36 | if a_val: 37 | if not isinstance(a_val,unicode): 38 | a_val = unicode(a_val) 39 | return md5(a_val.encode('utf8')).hexdigest(), {} 40 | return None 41 | 42 | def make_key(self, key): 43 | if not isinstance(key, unicode): 44 | key = unicode(key) 45 | return md5(key.encode('utf8')).hexdigest() 46 | -------------------------------------------------------------------------------- /interfaces/gui/~/tmp/qalsadiCache/a_buck: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/~/tmp/qalsadiCache/a_buck -------------------------------------------------------------------------------- /interfaces/gui/~/tmp/qalsadiCache/a_stor: -------------------------------------------------------------------------------- 1 | 0.4.2||||| -------------------------------------------------------------------------------- /interfaces/gui/~/tmp/qalsadiCache/id_buck: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/gui/~/tmp/qalsadiCache/id_buck -------------------------------------------------------------------------------- /interfaces/gui/~/tmp/qalsadiCache/id_stor: -------------------------------------------------------------------------------- 1 | 0.4.2||||| -------------------------------------------------------------------------------- /interfaces/web/config/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/web/config/__init__.py -------------------------------------------------------------------------------- /interfaces/web/config/logging.cfg: -------------------------------------------------------------------------------- 1 | [loggers] 2 | keys=root 3 | [logger_root] 4 | handlers=file 5 | level=INFO 6 | 7 | [formatters] 8 | keys=simple 9 | 10 | [formatter_simple] 11 | format=%(asctime)s %(levelname)s %(name)s %(threadName)s : %(message)s 12 | 13 | [handlers] 14 | keys=file 15 | 16 | [handler_file] 17 | class=FileHandler 18 | formatter=simple 19 | level=INFO 20 | args=("demo.log",) 21 | -------------------------------------------------------------------------------- /interfaces/web/config/mishkal_config.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # 4 | # mishkal_config.py 5 | # 6 | OFFLINE = True 7 | # ~ OFFLINE = False # hosted localy 8 | 9 | # in developement True in production False 10 | #MODE_DEBUG = True 11 | MODE_DEBUG = False 12 | 13 | if OFFLINE: 14 | # URL HOST 15 | # For Testing 16 | URL_HOST_PATH = "http://127.0.0.1/mishkal" 17 | DIR_HOST_PATH = "/var/www/html/mishkal" 18 | 19 | #Database config directory 20 | DB_BASE_PATH = "/var/www/html/mishkal/" 21 | # Logging file 22 | LOGGING_CFG_FILE = DIR_HOST_PATH +"/web/config/logging.cfg" 23 | LOGGING_FILE = DIR_HOST_PATH +"/web/logs/demo.log" 24 | else: 25 | # For Production 26 | URL_HOST_PATH = "https://example.com/mishkal" 27 | DIR_HOST_PATH = "~/public_html/cgi-bin" 28 | #Database config directory 29 | DB_BASE_PATH = "/var/www/html/mishkal/" 30 | MY 31 | 32 | # Logging file 33 | LOGGING_CFG_FILE = DIR_HOST_PATH +"/mishkal/web/config/logging.cfg" 34 | LOGGING_FILE = DIR_HOST_PATH +"/mishkal/web/logs/demo.log" 35 | 36 | def main(args): 37 | return 0 38 | 39 | if __name__ == '__main__': 40 | import sys 41 | sys.exit(main(sys.argv)) 42 | -------------------------------------------------------------------------------- /interfaces/web/lib/okasha2/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/web/lib/okasha2/__init__.py -------------------------------------------------------------------------------- /interfaces/web/lib/okasha2/kidTemplate.py: -------------------------------------------------------------------------------- 1 | # -*- coding: UTF-8 -*- 2 | """ 3 | Okasha - a very simple WSGI webframe work 4 | Copyright © 2009, Muayyad Alsadi 5 | 6 | Released under terms of Waqf Public License. 7 | This program is free software; you can redistribute it and/or modify 8 | it under the terms of the latest version Waqf Public License as 9 | published by Ojuba.org. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 14 | 15 | The Latest version of the license can be found on 16 | "http://waqf.ojuba.org/license" 17 | 18 | """ 19 | import sys, os, os.path 20 | import kid 21 | #from utils import ObjectsCache # kid has its own cache 22 | 23 | def kidTemplate(rq, o, bfn=None, **kw): 24 | d=rq.webapp._templatesDir 25 | if not os.path.isdir(d): raise fileNotFoundException() 26 | if not bfn: bfn='root.kid' 27 | fn=os.path.join(d, bfn) 28 | try: tmp=kid.load_template(file=fn) 29 | except kid.template_util.TemplateNotFound: raise fileNotFoundException() 30 | except: 31 | rq.webapp._logger.debug('template error fn=[%s]' % fn) 32 | raise 33 | # FIXME: check for valid template 34 | o.update(kw) 35 | s=tmp.Template(**o).serialize() 36 | return s 37 | 38 | -------------------------------------------------------------------------------- /interfaces/web/lib/paste/__init__.py: -------------------------------------------------------------------------------- 1 | # (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) 2 | # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php 3 | try: 4 | import pkg_resources 5 | pkg_resources.declare_namespace(__name__) 6 | except ImportError: 7 | # don't prevent use of paste if pkg_resources isn't installed 8 | from pkgutil import extend_path 9 | __path__ = extend_path(__path__, __name__) 10 | 11 | try: 12 | import modulefinder 13 | except ImportError: 14 | pass 15 | else: 16 | for p in __path__: 17 | modulefinder.AddPackagePath(__name__, p) 18 | -------------------------------------------------------------------------------- /interfaces/web/lib/paste/__init__.pyo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/web/lib/paste/__init__.pyo -------------------------------------------------------------------------------- /interfaces/web/lib/paste/auth/__init__.py: -------------------------------------------------------------------------------- 1 | # (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) 2 | # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php 3 | """ 4 | Package for authentication/identification of requests. 5 | 6 | The objective of this package is to provide single-focused middleware 7 | components that implement a particular specification. Integration of 8 | the components into a usable system is up to a higher-level framework. 9 | """ 10 | -------------------------------------------------------------------------------- /interfaces/web/lib/paste/auth/multi.py: -------------------------------------------------------------------------------- 1 | # (c) 2005 Clark C. Evans 2 | # This module is part of the Python Paste Project and is released under 3 | # the MIT License: http://www.opensource.org/licenses/mit-license.php 4 | # This code was written with funding by http://prometheusresearch.com 5 | """ 6 | Authentication via Multiple Methods 7 | 8 | In some environments, the choice of authentication method to be used 9 | depends upon the environment and is not "fixed". This middleware allows 10 | N authentication methods to be registered along with a goodness function 11 | which determines which method should be used. The following example 12 | demonstrates how to use both form and digest authentication in a server 13 | stack; by default it uses form-based authentication unless 14 | ``*authmeth=digest`` is specified as a query argument. 15 | 16 | >>> from paste.auth import form, cookie, digest, multi 17 | >>> from paste.wsgilib import dump_environ 18 | >>> from paste.httpserver import serve 19 | >>> 20 | >>> multi = multi.MultiHandler(dump_environ) 21 | >>> def authfunc(environ, realm, user): 22 | ... return digest.digest_password(realm, user, user) 23 | >>> multi.add_method('digest', digest.middleware, "Test Realm", authfunc) 24 | >>> multi.set_query_argument('digest') 25 | >>> 26 | >>> def authfunc(environ, username, password): 27 | ... return username == password 28 | >>> multi.add_method('form', form.middleware, authfunc) 29 | >>> multi.set_default('form') 30 | >>> serve(cookie.middleware(multi)) 31 | serving on... 32 | 33 | """ 34 | 35 | class MultiHandler(object): 36 | """ 37 | Multiple Authentication Handler 38 | 39 | This middleware provides two othogonal facilities: 40 | 41 | - a manner to register any number of authentication middlewares 42 | 43 | - a mechanism to register predicates which cause one of the 44 | registered middlewares to be used depending upon the request 45 | 46 | If none of the predicates returns True, then the application is 47 | invoked directly without middleware 48 | """ 49 | def __init__(self, application): 50 | self.application = application 51 | self.default = application 52 | self.binding = {} 53 | self.predicate = [] 54 | def add_method(self, name, factory, *args, **kwargs): 55 | self.binding[name] = factory(self.application, *args, **kwargs) 56 | def add_predicate(self, name, checker): 57 | self.predicate.append((checker, self.binding[name])) 58 | def set_default(self, name): 59 | """ set default authentication method """ 60 | self.default = self.binding[name] 61 | def set_query_argument(self, name, key = '*authmeth', value = None): 62 | """ choose authentication method based on a query argument """ 63 | lookfor = "%s=%s" % (key, value or name) 64 | self.add_predicate(name, 65 | lambda environ: lookfor in environ.get('QUERY_STRING','')) 66 | def __call__(self, environ, start_response): 67 | for (checker, binding) in self.predicate: 68 | if checker(environ): 69 | return binding(environ, start_response) 70 | return self.default(environ, start_response) 71 | 72 | middleware = MultiHandler 73 | 74 | __all__ = ['MultiHandler'] 75 | 76 | if "__main__" == __name__: 77 | import doctest 78 | doctest.testmod(optionflags=doctest.ELLIPSIS) 79 | 80 | -------------------------------------------------------------------------------- /interfaces/web/lib/paste/debug/__init__.py: -------------------------------------------------------------------------------- 1 | # (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) 2 | # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php 3 | """ 4 | Package for debugging and development tools 5 | """ 6 | -------------------------------------------------------------------------------- /interfaces/web/lib/paste/debug/debugapp.py: -------------------------------------------------------------------------------- 1 | # (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) 2 | # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php 3 | # (c) 2005 Clark C. Evans 4 | # This module is part of the Python Paste Project and is released under 5 | # the MIT License: http://www.opensource.org/licenses/mit-license.php 6 | # This code was written with funding by http://prometheusresearch.com 7 | """ 8 | Various Applications for Debugging/Testing Purposes 9 | """ 10 | 11 | import time 12 | __all__ = ['SimpleApplication', 'SlowConsumer'] 13 | 14 | 15 | class SimpleApplication(object): 16 | """ 17 | Produces a simple web page 18 | """ 19 | def __call__(self, environ, start_response): 20 | body = "simple" 21 | start_response("200 OK", [('Content-Type', 'text/html'), 22 | ('Content-Length', str(len(body)))]) 23 | return [body] 24 | 25 | class SlowConsumer(object): 26 | """ 27 | Consumes an upload slowly... 28 | 29 | NOTE: This should use the iterator form of ``wsgi.input``, 30 | but it isn't implemented in paste.httpserver. 31 | """ 32 | def __init__(self, chunk_size = 4096, delay = 1, progress = True): 33 | self.chunk_size = chunk_size 34 | self.delay = delay 35 | self.progress = True 36 | 37 | def __call__(self, environ, start_response): 38 | size = 0 39 | total = environ.get('CONTENT_LENGTH') 40 | if total: 41 | remaining = int(total) 42 | while remaining > 0: 43 | if self.progress: 44 | print "%s of %s remaining" % (remaining, total) 45 | if remaining > 4096: 46 | chunk = environ['wsgi.input'].read(4096) 47 | else: 48 | chunk = environ['wsgi.input'].read(remaining) 49 | if not chunk: 50 | break 51 | size += len(chunk) 52 | remaining -= len(chunk) 53 | if self.delay: 54 | time.sleep(self.delay) 55 | body = "%d bytes" % size 56 | else: 57 | body = ('\n' 58 | '
\n' 59 | '\n' 60 | '\n' 61 | '
\n') 62 | print "bingles" 63 | start_response("200 OK", [('Content-Type', 'text/html'), 64 | ('Content-Length', len(body))]) 65 | return [body] 66 | 67 | def make_test_app(global_conf): 68 | return SimpleApplication() 69 | 70 | make_test_app.__doc__ = SimpleApplication.__doc__ 71 | 72 | def make_slow_app(global_conf, chunk_size=4096, delay=1, progress=True): 73 | from paste.deploy.converters import asbool 74 | return SlowConsumer( 75 | chunk_size=int(chunk_size), 76 | delay=int(delay), 77 | progress=asbool(progress)) 78 | 79 | make_slow_app.__doc__ = SlowConsumer.__doc__ 80 | -------------------------------------------------------------------------------- /interfaces/web/lib/paste/debug/testserver.py: -------------------------------------------------------------------------------- 1 | # (c) 2005 Clark C. Evans 2 | # This module is part of the Python Paste Project and is released under 3 | # the MIT License: http://www.opensource.org/licenses/mit-license.php 4 | # This code was written with funding by http://prometheusresearch.com 5 | """ 6 | WSGI Test Server 7 | 8 | This builds upon paste.util.baseserver to customize it for regressions 9 | where using raw_interactive won't do. 10 | 11 | 12 | """ 13 | import time 14 | from paste.httpserver import * 15 | 16 | class WSGIRegressionServer(WSGIServer): 17 | """ 18 | A threaded WSGIServer for use in regression testing. To use this 19 | module, call serve(application, regression=True), and then call 20 | server.accept() to let it handle one request. When finished, use 21 | server.stop() to shutdown the server. Note that all pending requests 22 | are processed before the server shuts down. 23 | """ 24 | defaulttimeout = 10 25 | def __init__ (self, *args, **kwargs): 26 | WSGIServer.__init__(self, *args, **kwargs) 27 | self.stopping = [] 28 | self.pending = [] 29 | self.timeout = self.defaulttimeout 30 | # this is a local connection, be quick 31 | self.socket.settimeout(2) 32 | def serve_forever(self): 33 | from threading import Thread 34 | thread = Thread(target=self.serve_pending) 35 | thread.start() 36 | def reset_expires(self): 37 | if self.timeout: 38 | self.expires = time.time() + self.timeout 39 | def close_request(self, *args, **kwargs): 40 | WSGIServer.close_request(self, *args, **kwargs) 41 | self.pending.pop() 42 | self.reset_expires() 43 | def serve_pending(self): 44 | self.reset_expires() 45 | while not self.stopping or self.pending: 46 | now = time.time() 47 | if now > self.expires and self.timeout: 48 | # note regression test doesn't handle exceptions in 49 | # threads very well; so we just print and exit 50 | print "\nWARNING: WSGIRegressionServer timeout exceeded\n" 51 | break 52 | if self.pending: 53 | self.handle_request() 54 | time.sleep(.1) 55 | def stop(self): 56 | """ stop the server (called from tester's thread) """ 57 | self.stopping.append(True) 58 | def accept(self, count = 1): 59 | """ accept another request (called from tester's thread) """ 60 | assert not self.stopping 61 | [self.pending.append(True) for x in range(count)] 62 | 63 | def serve(application, host=None, port=None, handler=None): 64 | server = WSGIRegressionServer(application, host, port, handler) 65 | print "serving on %s:%s" % server.server_address 66 | server.serve_forever() 67 | return server 68 | 69 | if __name__ == '__main__': 70 | import urllib 71 | from paste.wsgilib import dump_environ 72 | server = serve(dump_environ) 73 | baseuri = ("http://%s:%s" % server.server_address) 74 | 75 | def fetch(path): 76 | # tell the server to humor exactly one more request 77 | server.accept(1) 78 | # not needed; but this is what you do if the server 79 | # may not respond in a resonable time period 80 | import socket 81 | socket.setdefaulttimeout(5) 82 | # build a uri, fetch and return 83 | return urllib.urlopen(baseuri + path).read() 84 | 85 | assert "PATH_INFO: /foo" in fetch("/foo") 86 | assert "PATH_INFO: /womble" in fetch("/womble") 87 | 88 | # ok, let's make one more final request... 89 | server.accept(1) 90 | # and then schedule a stop() 91 | server.stop() 92 | # and then... fetch it... 93 | urllib.urlopen(baseuri) 94 | -------------------------------------------------------------------------------- /interfaces/web/lib/paste/evalexception/__init__.py: -------------------------------------------------------------------------------- 1 | # (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) 2 | # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php 3 | """ 4 | An exception handler for interactive debugging 5 | """ 6 | from paste.evalexception.middleware import EvalException 7 | 8 | -------------------------------------------------------------------------------- /interfaces/web/lib/paste/evalexception/evalcontext.py: -------------------------------------------------------------------------------- 1 | # (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) 2 | # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php 3 | from cStringIO import StringIO 4 | import traceback 5 | import threading 6 | import pdb 7 | import sys 8 | 9 | exec_lock = threading.Lock() 10 | 11 | class EvalContext(object): 12 | 13 | """ 14 | Class that represents a interactive interface. It has its own 15 | namespace. Use eval_context.exec_expr(expr) to run commands; the 16 | output of those commands is returned, as are print statements. 17 | 18 | This is essentially what doctest does, and is taken directly from 19 | doctest. 20 | """ 21 | 22 | def __init__(self, namespace, globs): 23 | self.namespace = namespace 24 | self.globs = globs 25 | 26 | def exec_expr(self, s): 27 | out = StringIO() 28 | exec_lock.acquire() 29 | save_stdout = sys.stdout 30 | try: 31 | debugger = _OutputRedirectingPdb(save_stdout) 32 | debugger.reset() 33 | pdb.set_trace = debugger.set_trace 34 | sys.stdout = out 35 | try: 36 | code = compile(s, '', "single", 0, 1) 37 | exec code in self.namespace, self.globs 38 | debugger.set_continue() 39 | except KeyboardInterrupt: 40 | raise 41 | except: 42 | traceback.print_exc(file=out) 43 | debugger.set_continue() 44 | finally: 45 | sys.stdout = save_stdout 46 | exec_lock.release() 47 | return out.getvalue() 48 | 49 | # From doctest 50 | class _OutputRedirectingPdb(pdb.Pdb): 51 | """ 52 | A specialized version of the python debugger that redirects stdout 53 | to a given stream when interacting with the user. Stdout is *not* 54 | redirected when traced code is executed. 55 | """ 56 | def __init__(self, out): 57 | self.__out = out 58 | pdb.Pdb.__init__(self) 59 | 60 | def trace_dispatch(self, *args): 61 | # Redirect stdout to the given stream. 62 | save_stdout = sys.stdout 63 | sys.stdout = self.__out 64 | # Call Pdb's trace dispatch method. 65 | try: 66 | return pdb.Pdb.trace_dispatch(self, *args) 67 | finally: 68 | sys.stdout = save_stdout 69 | -------------------------------------------------------------------------------- /interfaces/web/lib/paste/evalexception/media/minus.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/web/lib/paste/evalexception/media/minus.jpg -------------------------------------------------------------------------------- /interfaces/web/lib/paste/evalexception/media/plus.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/web/lib/paste/evalexception/media/plus.jpg -------------------------------------------------------------------------------- /interfaces/web/lib/paste/evalexception/mochikit/__package__.js: -------------------------------------------------------------------------------- 1 | dojo.hostenv.conditionalLoadModule({"common": ["MochiKit.MochiKit"]}); 2 | dojo.hostenv.moduleLoaded("MochiKit.*"); 3 | -------------------------------------------------------------------------------- /interfaces/web/lib/paste/exceptions/__init__.py: -------------------------------------------------------------------------------- 1 | # (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) 2 | # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php 3 | """ 4 | Package for catching exceptions and displaying annotated exception 5 | reports 6 | """ 7 | -------------------------------------------------------------------------------- /interfaces/web/lib/paste/paste.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/web/lib/paste/paste.zip -------------------------------------------------------------------------------- /interfaces/web/lib/paste/pony.py: -------------------------------------------------------------------------------- 1 | # (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) 2 | # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php 3 | """ 4 | We have a pony and/or a unicorn. 5 | """ 6 | from paste.request import construct_url 7 | 8 | PONY = """ 9 | eJyFkkFuxCAMRfdzCisbJxK2D5D2JpbMrlI3XXQZDt9PCG0ySgcWIMT79rcN0XClUJlZRB9jVmci 10 | FmV19khjgRFl0RzrKmqzvY8lRUWFlXvCrD7UbAQR/17NUvGhypAF9og16vWtkC8DzUayS6pN3/dR 11 | ki0OnpzKjUBFpmlC7zVFRNL1rwoq6PWXXQSnIm9WoTzlM2//ke21o5g/l1ckRhiPbkDZXsKIR7l1 12 | 36hF9uMhnRiVjI8UgYjlsIKCrXXpcA9iX5y7zMmtG0fUpW61Ssttipf6cp3WARfkMVoYFryi2a+w 13 | o/2dhW0OXfcMTnmh53oR9egzPs+qkpY9IKxdUVRP5wHO7UDAuI6moA2N+/z4vtc2k8B+AIBimVU= 14 | """ 15 | 16 | UNICORN = """ 17 | eJyVVD1vhDAM3e9XeAtIxB5P6qlDx0OMXVBzSpZOHdsxP762E0JAnMgZ8Zn37OePAPC60eV1Dl5b 18 | SS7fB6DmQNGhtegpNlPIQS8HmkYGdSqNqDF9wcMYus4TuBYGsZwIPqXfEoNir5K+R3mbzhlR4JMW 19 | eGpikPpn9wHl2sDgEH1270guZwzKDRf3nTztMvfI5r3fJqEmNxdCyISBcWjNgjPG8Egg2hgT3mJi 20 | KBwNvmPB1hbWJ3TwBfMlqdTzxNyDE2H8zOD5HA4KkqJGPVY/TwnxmPA82kdSJNj7zs+R0d1pB+JO 21 | xn2DKgsdxAfFS2pfTSD0Fb6Uzv7dCQSvE5JmZQEQ90vNjBU1GPuGQpCPS8cGo+dQgjIKqxnJTXbw 22 | ucFzPFVIJXtzk6BXKGPnYsKzvFmGx7A0j6Zqvlvk5rETXbMWTGWj0RFc8QNPYVfhJfMMniCPazWJ 23 | lGtPZecIGJWW6oL2hpbWRZEkChe8eg5Wb7xx/MBZBFjxeZPEss+mRQ3Uhc8WQv684seSRO7i3nb4 24 | 7HlKUg8sraz47LmXyh8S0somADvoUpoHjGWl+rUkF0H+EIf/gbyyMg58BBk6L634/fkHUCodMw== 25 | """ 26 | 27 | 28 | class PonyMiddleware(object): 29 | 30 | def __init__(self, application): 31 | self.application = application 32 | 33 | def __call__(self, environ, start_response): 34 | path_info = environ.get('PATH_INFO', '') 35 | if path_info == '/pony': 36 | url = construct_url(environ, with_query_string=False) 37 | if 'horn' in environ.get('QUERY_STRING', ''): 38 | data = UNICORN 39 | link = 'remove horn!' 40 | else: 41 | data = PONY 42 | url += '?horn' 43 | link = 'add horn!' 44 | msg = data.decode('base64').decode('zlib') 45 | msg = '
%s\n%s
' % ( 46 | msg, url, link) 47 | start_response('200 OK', [('content-type', 'text/html')]) 48 | return [msg] 49 | else: 50 | return self.application(environ, start_response) 51 | 52 | def make_pony(app, global_conf): 53 | """ 54 | Adds pony power to any application, at /pony 55 | """ 56 | return PonyMiddleware(app) 57 | 58 | -------------------------------------------------------------------------------- /interfaces/web/lib/paste/util/PySourceColor.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/web/lib/paste/util/PySourceColor.py -------------------------------------------------------------------------------- /interfaces/web/lib/paste/util/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | Package for miscellaneous routines that do not depend on other parts 3 | of Paste 4 | """ 5 | -------------------------------------------------------------------------------- /interfaces/web/lib/paste/util/classinit.py: -------------------------------------------------------------------------------- 1 | # (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) 2 | # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php 3 | 4 | class ClassInitMeta(type): 5 | 6 | def __new__(meta, class_name, bases, new_attrs): 7 | cls = type.__new__(meta, class_name, bases, new_attrs) 8 | if (new_attrs.has_key('__classinit__') 9 | and not isinstance(cls.__classinit__, staticmethod)): 10 | setattr(cls, '__classinit__', 11 | staticmethod(cls.__classinit__.im_func)) 12 | if hasattr(cls, '__classinit__'): 13 | cls.__classinit__(cls, new_attrs) 14 | return cls 15 | 16 | def build_properties(cls, new_attrs): 17 | """ 18 | Given a class and a new set of attributes (as passed in by 19 | __classinit__), create or modify properties based on functions 20 | with special names ending in __get, __set, and __del. 21 | """ 22 | for name, value in new_attrs.items(): 23 | if (name.endswith('__get') or name.endswith('__set') 24 | or name.endswith('__del')): 25 | base = name[:-5] 26 | if hasattr(cls, base): 27 | old_prop = getattr(cls, base) 28 | if not isinstance(old_prop, property): 29 | raise ValueError( 30 | "Attribute %s is a %s, not a property; function %s is named like a property" 31 | % (base, type(old_prop), name)) 32 | attrs = {'fget': old_prop.fget, 33 | 'fset': old_prop.fset, 34 | 'fdel': old_prop.fdel, 35 | 'doc': old_prop.__doc__} 36 | else: 37 | attrs = {} 38 | attrs['f' + name[-3:]] = value 39 | if name.endswith('__get') and value.__doc__: 40 | attrs['doc'] = value.__doc__ 41 | new_prop = property(**attrs) 42 | setattr(cls, base, new_prop) 43 | -------------------------------------------------------------------------------- /interfaces/web/lib/paste/util/classinstance.py: -------------------------------------------------------------------------------- 1 | # (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) 2 | # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php 3 | 4 | class classinstancemethod(object): 5 | """ 6 | Acts like a class method when called from a class, like an 7 | instance method when called by an instance. The method should 8 | take two arguments, 'self' and 'cls'; one of these will be None 9 | depending on how the method was called. 10 | """ 11 | 12 | def __init__(self, func): 13 | self.func = func 14 | self.__doc__ = func.__doc__ 15 | 16 | def __get__(self, obj, type=None): 17 | return _methodwrapper(self.func, obj=obj, type=type) 18 | 19 | class _methodwrapper(object): 20 | 21 | def __init__(self, func, obj, type): 22 | self.func = func 23 | self.obj = obj 24 | self.type = type 25 | 26 | def __call__(self, *args, **kw): 27 | assert not kw.has_key('self') and not kw.has_key('cls'), ( 28 | "You cannot use 'self' or 'cls' arguments to a " 29 | "classinstancemethod") 30 | return self.func(*((self.obj, self.type) + args), **kw) 31 | 32 | def __repr__(self): 33 | if self.obj is None: 34 | return ('' 35 | % (self.type.__name__, self.func.func_name)) 36 | else: 37 | return ('' 38 | % (self.type.__name__, self.func.func_name, self.obj)) 39 | -------------------------------------------------------------------------------- /interfaces/web/lib/paste/util/converters.py: -------------------------------------------------------------------------------- 1 | # (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) 2 | # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php 3 | def asbool(obj): 4 | if isinstance(obj, (str, unicode)): 5 | obj = obj.strip().lower() 6 | if obj in ['true', 'yes', 'on', 'y', 't', '1']: 7 | return True 8 | elif obj in ['false', 'no', 'off', 'n', 'f', '0']: 9 | return False 10 | else: 11 | raise ValueError( 12 | "String is not true/false: %r" % obj) 13 | return bool(obj) 14 | 15 | def aslist(obj, sep=None, strip=True): 16 | if isinstance(obj, (str, unicode)): 17 | lst = obj.split(sep) 18 | if strip: 19 | lst = [v.strip() for v in lst] 20 | return lst 21 | elif isinstance(obj, (list, tuple)): 22 | return obj 23 | elif obj is None: 24 | return [] 25 | else: 26 | return [obj] 27 | -------------------------------------------------------------------------------- /interfaces/web/lib/paste/util/dateinterval.py: -------------------------------------------------------------------------------- 1 | """ 2 | DateInterval.py 3 | 4 | Convert interval strings (in the form of 1w2d, etc) to 5 | seconds, and back again. Is not exactly about months or 6 | years (leap years in particular). 7 | 8 | Accepts (y)ear, (b)month, (w)eek, (d)ay, (h)our, (m)inute, (s)econd. 9 | 10 | Exports only timeEncode and timeDecode functions. 11 | """ 12 | 13 | import re 14 | 15 | __all__ = ['interval_decode', 'interval_encode'] 16 | 17 | second = 1 18 | minute = second*60 19 | hour = minute*60 20 | day = hour*24 21 | week = day*7 22 | month = day*30 23 | year = day*365 24 | timeValues = { 25 | 'y': year, 26 | 'b': month, 27 | 'w': week, 28 | 'd': day, 29 | 'h': hour, 30 | 'm': minute, 31 | 's': second, 32 | } 33 | timeOrdered = timeValues.items() 34 | timeOrdered.sort(lambda a, b: -cmp(a[1], b[1])) 35 | 36 | def interval_encode(seconds, include_sign=False): 37 | """Encodes a number of seconds (representing a time interval) 38 | into a form like 1h2d3s. 39 | 40 | >>> interval_encode(10) 41 | '10s' 42 | >>> interval_encode(493939) 43 | '5d17h12m19s' 44 | """ 45 | s = '' 46 | orig = seconds 47 | seconds = abs(seconds) 48 | for char, amount in timeOrdered: 49 | if seconds >= amount: 50 | i, seconds = divmod(seconds, amount) 51 | s += '%i%s' % (i, char) 52 | if orig < 0: 53 | s = '-' + s 54 | elif not orig: 55 | return '0' 56 | elif include_sign: 57 | s = '+' + s 58 | return s 59 | 60 | _timeRE = re.compile(r'[0-9]+[a-zA-Z]') 61 | def interval_decode(s): 62 | """Decodes a number in the format 1h4d3m (1 hour, 3 days, 3 minutes) 63 | into a number of seconds 64 | 65 | >>> interval_decode('40s') 66 | 40 67 | >>> interval_decode('10000s') 68 | 10000 69 | >>> interval_decode('3d1w45s') 70 | 864045 71 | """ 72 | time = 0 73 | sign = 1 74 | s = s.strip() 75 | if s.startswith('-'): 76 | s = s[1:] 77 | sign = -1 78 | elif s.startswith('+'): 79 | s = s[1:] 80 | for match in allMatches(s, _timeRE): 81 | char = match.group(0)[-1].lower() 82 | if not timeValues.has_key(char): 83 | # @@: should signal error 84 | continue 85 | time += int(match.group(0)[:-1]) * timeValues[char] 86 | return time 87 | 88 | # @@-sgd 2002-12-23 - this function does not belong in this module, find a better place. 89 | def allMatches(source, regex): 90 | """Return a list of matches for regex in source 91 | """ 92 | pos = 0 93 | end = len(source) 94 | rv = [] 95 | match = regex.search(source, pos) 96 | while match: 97 | rv.append(match) 98 | match = regex.search(source, match.end() ) 99 | return rv 100 | 101 | if __name__ == '__main__': 102 | import doctest 103 | doctest.testmod() 104 | -------------------------------------------------------------------------------- /interfaces/web/lib/paste/util/filemixin.py: -------------------------------------------------------------------------------- 1 | # (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) 2 | # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php 3 | 4 | class FileMixin(object): 5 | 6 | """ 7 | Used to provide auxiliary methods to objects simulating files. 8 | Objects must implement write, and read if they are input files. 9 | Also they should implement close. 10 | 11 | Other methods you may wish to override: 12 | * flush() 13 | * seek(offset[, whence]) 14 | * tell() 15 | * truncate([size]) 16 | 17 | Attributes you may wish to provide: 18 | * closed 19 | * encoding (you should also respect that in write()) 20 | * mode 21 | * newlines (hard to support) 22 | * softspace 23 | """ 24 | 25 | def flush(self): 26 | pass 27 | 28 | def next(self): 29 | return self.readline() 30 | 31 | def readline(self, size=None): 32 | # @@: This is a lame implementation; but a buffer would probably 33 | # be necessary for a better implementation 34 | output = [] 35 | while 1: 36 | next = self.read(1) 37 | if not next: 38 | return ''.join(output) 39 | output.append(next) 40 | if size and size > 0 and len(output) >= size: 41 | return ''.join(output) 42 | if next == '\n': 43 | # @@: also \r? 44 | return ''.join(output) 45 | 46 | def xreadlines(self): 47 | return self 48 | 49 | def writelines(self, lines): 50 | for line in lines: 51 | self.write(line) 52 | 53 | 54 | -------------------------------------------------------------------------------- /interfaces/web/lib/paste/util/findpackage.py: -------------------------------------------------------------------------------- 1 | # (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) 2 | # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php 3 | 4 | import sys 5 | import os 6 | 7 | def find_package(dir): 8 | """ 9 | Given a directory, finds the equivalent package name. If it 10 | is directly in sys.path, returns ''. 11 | """ 12 | dir = os.path.abspath(dir) 13 | orig_dir = dir 14 | path = map(os.path.abspath, sys.path) 15 | packages = [] 16 | last_dir = None 17 | while 1: 18 | if dir in path: 19 | return '.'.join(packages) 20 | packages.insert(0, os.path.basename(dir)) 21 | dir = os.path.dirname(dir) 22 | if last_dir == dir: 23 | raise ValueError( 24 | "%s is not under any path found in sys.path" % orig_dir) 25 | last_dir = dir 26 | 27 | -------------------------------------------------------------------------------- /interfaces/web/lib/paste/util/import_string.py: -------------------------------------------------------------------------------- 1 | # (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) 2 | # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php 3 | 4 | """ 5 | 'imports' a string -- converts a string to a Python object, importing 6 | any necessary modules and evaluating the expression. Everything 7 | before the : in an import expression is the module path; everything 8 | after is an expression to be evaluated in the namespace of that 9 | module. 10 | 11 | Alternately, if no : is present, then import the modules and get the 12 | attributes as necessary. Arbitrary expressions are not allowed in 13 | that case. 14 | """ 15 | 16 | def eval_import(s): 17 | """ 18 | Import a module, or import an object from a module. 19 | 20 | A module name like ``foo.bar:baz()`` can be used, where 21 | ``foo.bar`` is the module, and ``baz()`` is an expression 22 | evaluated in the context of that module. Note this is not safe on 23 | arbitrary strings because of the eval. 24 | """ 25 | if ':' not in s: 26 | return simple_import(s) 27 | module_name, expr = s.split(':', 1) 28 | module = import_module(module_name) 29 | obj = eval(expr, module.__dict__) 30 | return obj 31 | 32 | def simple_import(s): 33 | """ 34 | Import a module, or import an object from a module. 35 | 36 | A name like ``foo.bar.baz`` can be a module ``foo.bar.baz`` or a 37 | module ``foo.bar`` with an object ``baz`` in it, or a module 38 | ``foo`` with an object ``bar`` with an attribute ``baz``. 39 | """ 40 | parts = s.split('.') 41 | module = import_module(parts[0]) 42 | name = parts[0] 43 | parts = parts[1:] 44 | last_import_error = None 45 | while parts: 46 | name += '.' + parts[0] 47 | try: 48 | module = import_module(name) 49 | parts = parts[1:] 50 | except ImportError, e: 51 | last_import_error = e 52 | break 53 | obj = module 54 | while parts: 55 | try: 56 | obj = getattr(module, parts[0]) 57 | except AttributeError: 58 | raise ImportError( 59 | "Cannot find %s in module %r (stopped importing modules with error %s)" % (parts[0], module, last_import_error)) 60 | parts = parts[1:] 61 | return obj 62 | 63 | def import_module(s): 64 | """ 65 | Import a module. 66 | """ 67 | mod = __import__(s) 68 | parts = s.split('.') 69 | for part in parts[1:]: 70 | mod = getattr(mod, part) 71 | return mod 72 | 73 | def try_import_module(module_name): 74 | """ 75 | Imports a module, but catches import errors. Only catches errors 76 | when that module doesn't exist; if that module itself has an 77 | import error it will still get raised. Returns None if the module 78 | doesn't exist. 79 | """ 80 | try: 81 | return import_module(module_name) 82 | except ImportError, e: 83 | if not getattr(e, 'args', None): 84 | raise 85 | desc = e.args[0] 86 | if not desc.startswith('No module named '): 87 | raise 88 | desc = desc[len('No module named '):] 89 | # If you import foo.bar.baz, the bad import could be any 90 | # of foo.bar.baz, bar.baz, or baz; we'll test them all: 91 | parts = module_name.split('.') 92 | for i in range(len(parts)): 93 | if desc == '.'.join(parts[i:]): 94 | return None 95 | raise 96 | -------------------------------------------------------------------------------- /interfaces/web/lib/paste/util/killthread.py: -------------------------------------------------------------------------------- 1 | """ 2 | Kill a thread, from http://sebulba.wikispaces.com/recipe+thread2 3 | """ 4 | import types 5 | try: 6 | import ctypes 7 | except ImportError: 8 | raise ImportError( 9 | "You cannot use paste.util.killthread without ctypes installed") 10 | if not hasattr(ctypes, 'pythonapi'): 11 | raise ImportError( 12 | "You cannot use paste.util.killthread without ctypes.pythonapi") 13 | 14 | def async_raise(tid, exctype): 15 | """raises the exception, performs cleanup if needed. 16 | 17 | tid is the value given by thread.get_ident() (an integer). 18 | Raise SystemExit to kill a thread.""" 19 | if not isinstance(exctype, (types.ClassType, type)): 20 | raise TypeError("Only types can be raised (not instances)") 21 | if not isinstance(tid, int): 22 | raise TypeError("tid must be an integer") 23 | res = ctypes.pythonapi.PyThreadState_SetAsyncExc(tid, ctypes.py_object(exctype)) 24 | if res == 0: 25 | raise ValueError("invalid thread id") 26 | elif res != 1: 27 | # """if it returns a number greater than one, you're in trouble, 28 | # and you should call it again with exc=NULL to revert the effect""" 29 | ctypes.pythonapi.PyThreadState_SetAsyncExc(tid, 0) 30 | raise SystemError("PyThreadState_SetAsyncExc failed") 31 | -------------------------------------------------------------------------------- /interfaces/web/lib/paste/util/quoting.py: -------------------------------------------------------------------------------- 1 | # (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) 2 | # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php 3 | 4 | import cgi 5 | import htmlentitydefs 6 | import urllib 7 | import re 8 | 9 | __all__ = ['html_quote', 'html_unquote', 'url_quote', 'url_unquote', 10 | 'strip_html'] 11 | 12 | default_encoding = 'UTF-8' 13 | 14 | def html_quote(v, encoding=None): 15 | r""" 16 | Quote the value (turned to a string) as HTML. This quotes <, >, 17 | and quotes: 18 | 19 | >>> html_quote(1) 20 | '1' 21 | >>> html_quote(None) 22 | '' 23 | >>> html_quote('') 24 | '<hey!>' 25 | >>> html_quote(u'\u1029') 26 | '\xe1\x80\xa9' 27 | """ 28 | encoding = encoding or default_encoding 29 | if v is None: 30 | return '' 31 | elif isinstance(v, str): 32 | return cgi.escape(v, 1) 33 | elif isinstance(v, unicode): 34 | return cgi.escape(v.encode(encoding), 1) 35 | else: 36 | return cgi.escape(unicode(v).encode(encoding), 1) 37 | 38 | _unquote_re = re.compile(r'&([a-zA-Z]+);') 39 | def _entity_subber(match, name2c=htmlentitydefs.name2codepoint): 40 | code = name2c.get(match.group(1)) 41 | if code: 42 | return unichr(code) 43 | else: 44 | return match.group(0) 45 | 46 | def html_unquote(s, encoding=None): 47 | r""" 48 | Decode the value. 49 | 50 | >>> html_unquote('<hey you>') 51 | u'' 52 | >>> html_unquote('') 53 | u'' 54 | >>> html_unquote('&blahblah;') 55 | u'&blahblah;' 56 | >>> html_unquote('\xe1\x80\xa9') 57 | u'\u1029' 58 | """ 59 | if isinstance(s, str): 60 | s = s.decode(encoding or default_encoding) 61 | return _unquote_re.sub(_entity_subber, s) 62 | 63 | def strip_html(s): 64 | # should this use html_unquote? 65 | s = re.sub('<.*?>', '', s) 66 | s = html_unquote(s) 67 | return s 68 | 69 | def no_quote(s): 70 | """ 71 | Quoting that doesn't do anything 72 | """ 73 | return s 74 | 75 | url_quote = urllib.quote 76 | url_unquote = urllib.unquote 77 | 78 | if __name__ == '__main__': 79 | import doctest 80 | doctest.testmod() 81 | -------------------------------------------------------------------------------- /interfaces/web/lib/paste/util/threadinglocal.py: -------------------------------------------------------------------------------- 1 | # (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) 2 | # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php 3 | """ 4 | Implementation of thread-local storage, for Python versions that don't 5 | have thread local storage natively. 6 | """ 7 | 8 | try: 9 | import threading 10 | except ImportError: 11 | # No threads, so "thread local" means process-global 12 | class local(object): 13 | pass 14 | else: 15 | try: 16 | local = threading.local 17 | except AttributeError: 18 | # Added in 2.4, but now we'll have to define it ourselves 19 | import thread 20 | class local(object): 21 | 22 | def __init__(self): 23 | self.__dict__['__objs'] = {} 24 | 25 | def __getattr__(self, attr, g=thread.get_ident): 26 | try: 27 | return self.__dict__['__objs'][g()][attr] 28 | except KeyError: 29 | raise AttributeError( 30 | "No variable %s defined for the thread %s" 31 | % (attr, g())) 32 | 33 | def __setattr__(self, attr, value, g=thread.get_ident): 34 | self.__dict__['__objs'].setdefault(g(), {})[attr] = value 35 | 36 | def __delattr__(self, attr, g=thread.get_ident): 37 | try: 38 | del self.__dict__['__objs'][g()][attr] 39 | except KeyError: 40 | raise AttributeError( 41 | "No variable %s defined for thread %s" 42 | % (attr, g())) 43 | 44 | -------------------------------------------------------------------------------- /interfaces/web/lib/simplejson/scanner.py: -------------------------------------------------------------------------------- 1 | """JSON token scanner 2 | """ 3 | import re 4 | def _import_c_make_scanner(): 5 | try: 6 | from simplejson._speedups import make_scanner 7 | return make_scanner 8 | except ImportError: 9 | return None 10 | c_make_scanner = _import_c_make_scanner() 11 | 12 | __all__ = ['make_scanner'] 13 | 14 | NUMBER_RE = re.compile( 15 | r'(-?(?:0|[1-9]\d*))(\.\d+)?([eE][-+]?\d+)?', 16 | (re.VERBOSE | re.MULTILINE | re.DOTALL)) 17 | 18 | def py_make_scanner(context): 19 | parse_object = context.parse_object 20 | parse_array = context.parse_array 21 | parse_string = context.parse_string 22 | match_number = NUMBER_RE.match 23 | encoding = context.encoding 24 | strict = context.strict 25 | parse_float = context.parse_float 26 | parse_int = context.parse_int 27 | parse_constant = context.parse_constant 28 | object_hook = context.object_hook 29 | object_pairs_hook = context.object_pairs_hook 30 | memo = context.memo 31 | 32 | def _scan_once(string, idx): 33 | try: 34 | nextchar = string[idx] 35 | except IndexError: 36 | raise StopIteration 37 | 38 | if nextchar == '"': 39 | return parse_string(string, idx + 1, encoding, strict) 40 | elif nextchar == '{': 41 | return parse_object((string, idx + 1), encoding, strict, 42 | _scan_once, object_hook, object_pairs_hook, memo) 43 | elif nextchar == '[': 44 | return parse_array((string, idx + 1), _scan_once) 45 | elif nextchar == 'n' and string[idx:idx + 4] == 'null': 46 | return None, idx + 4 47 | elif nextchar == 't' and string[idx:idx + 4] == 'true': 48 | return True, idx + 4 49 | elif nextchar == 'f' and string[idx:idx + 5] == 'false': 50 | return False, idx + 5 51 | 52 | m = match_number(string, idx) 53 | if m is not None: 54 | integer, frac, exp = m.groups() 55 | if frac or exp: 56 | res = parse_float(integer + (frac or '') + (exp or '')) 57 | else: 58 | res = parse_int(integer) 59 | return res, m.end() 60 | elif nextchar == 'N' and string[idx:idx + 3] == 'NaN': 61 | return parse_constant('NaN'), idx + 3 62 | elif nextchar == 'I' and string[idx:idx + 8] == 'Infinity': 63 | return parse_constant('Infinity'), idx + 8 64 | elif nextchar == '-' and string[idx:idx + 9] == '-Infinity': 65 | return parse_constant('-Infinity'), idx + 9 66 | else: 67 | raise StopIteration 68 | 69 | def scan_once(string, idx): 70 | try: 71 | return _scan_once(string, idx) 72 | finally: 73 | memo.clear() 74 | 75 | return scan_once 76 | 77 | make_scanner = c_make_scanner or py_make_scanner 78 | -------------------------------------------------------------------------------- /interfaces/web/lib/simplejson/tests/__init__.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import doctest 3 | 4 | 5 | class OptionalExtensionTestSuite(unittest.TestSuite): 6 | def run(self, result): 7 | import simplejson 8 | run = unittest.TestSuite.run 9 | run(self, result) 10 | simplejson._toggle_speedups(False) 11 | run(self, result) 12 | simplejson._toggle_speedups(True) 13 | return result 14 | 15 | 16 | def additional_tests(suite=None): 17 | import simplejson 18 | import simplejson.encoder 19 | import simplejson.decoder 20 | if suite is None: 21 | suite = unittest.TestSuite() 22 | for mod in (simplejson, simplejson.encoder, simplejson.decoder): 23 | suite.addTest(doctest.DocTestSuite(mod)) 24 | suite.addTest(doctest.DocFileSuite('../../index.rst')) 25 | return suite 26 | 27 | 28 | def all_tests_suite(): 29 | suite = unittest.TestLoader().loadTestsFromNames([ 30 | 'simplejson.tests.test_check_circular', 31 | 'simplejson.tests.test_decode', 32 | 'simplejson.tests.test_default', 33 | 'simplejson.tests.test_dump', 34 | 'simplejson.tests.test_encode_basestring_ascii', 35 | 'simplejson.tests.test_encode_for_html', 36 | 'simplejson.tests.test_fail', 37 | 'simplejson.tests.test_float', 38 | 'simplejson.tests.test_indent', 39 | 'simplejson.tests.test_pass1', 40 | 'simplejson.tests.test_pass2', 41 | 'simplejson.tests.test_pass3', 42 | 'simplejson.tests.test_recursion', 43 | 'simplejson.tests.test_scanstring', 44 | 'simplejson.tests.test_separators', 45 | 'simplejson.tests.test_speedups', 46 | 'simplejson.tests.test_unicode', 47 | 'simplejson.tests.test_decimal', 48 | ]) 49 | suite = additional_tests(suite) 50 | return OptionalExtensionTestSuite([suite]) 51 | 52 | 53 | def main(): 54 | runner = unittest.TextTestRunner() 55 | suite = all_tests_suite() 56 | runner.run(suite) 57 | 58 | 59 | if __name__ == '__main__': 60 | import os 61 | import sys 62 | sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))) 63 | main() 64 | -------------------------------------------------------------------------------- /interfaces/web/lib/simplejson/tests/test_check_circular.py: -------------------------------------------------------------------------------- 1 | from unittest import TestCase 2 | import simplejson as json 3 | 4 | def default_iterable(obj): 5 | return list(obj) 6 | 7 | class TestCheckCircular(TestCase): 8 | def test_circular_dict(self): 9 | dct = {} 10 | dct['a'] = dct 11 | self.assertRaises(ValueError, json.dumps, dct) 12 | 13 | def test_circular_list(self): 14 | lst = [] 15 | lst.append(lst) 16 | self.assertRaises(ValueError, json.dumps, lst) 17 | 18 | def test_circular_composite(self): 19 | dct2 = {} 20 | dct2['a'] = [] 21 | dct2['a'].append(dct2) 22 | self.assertRaises(ValueError, json.dumps, dct2) 23 | 24 | def test_circular_default(self): 25 | json.dumps([set()], default=default_iterable) 26 | self.assertRaises(TypeError, json.dumps, [set()]) 27 | 28 | def test_circular_off_default(self): 29 | json.dumps([set()], default=default_iterable, check_circular=False) 30 | self.assertRaises(TypeError, json.dumps, [set()], check_circular=False) 31 | -------------------------------------------------------------------------------- /interfaces/web/lib/simplejson/tests/test_decimal.py: -------------------------------------------------------------------------------- 1 | from decimal import Decimal 2 | from unittest import TestCase 3 | 4 | import simplejson as json 5 | 6 | class TestDecimal(TestCase): 7 | NUMS = "1.0", "10.00", "1.1", "1234567890.1234567890", "500" 8 | def test_decimal_encode(self): 9 | for d in map(Decimal, self.NUMS): 10 | self.assertEquals(json.dumps(d, use_decimal=True), str(d)) 11 | 12 | def test_decimal_decode(self): 13 | for s in self.NUMS: 14 | self.assertEquals(json.loads(s, parse_float=Decimal), Decimal(s)) 15 | 16 | def test_decimal_roundtrip(self): 17 | for d in map(Decimal, self.NUMS): 18 | # The type might not be the same (int and Decimal) but they 19 | # should still compare equal. 20 | self.assertEquals( 21 | json.loads( 22 | json.dumps(d, use_decimal=True), parse_float=Decimal), 23 | d) 24 | self.assertEquals( 25 | json.loads( 26 | json.dumps([d], use_decimal=True), parse_float=Decimal), 27 | [d]) 28 | 29 | def test_decimal_defaults(self): 30 | d = Decimal(1) 31 | # use_decimal=False is the default 32 | self.assertRaises(TypeError, json.dumps, d, use_decimal=False) 33 | self.assertRaises(TypeError, json.dumps, d) -------------------------------------------------------------------------------- /interfaces/web/lib/simplejson/tests/test_decode.py: -------------------------------------------------------------------------------- 1 | import decimal 2 | from unittest import TestCase 3 | from StringIO import StringIO 4 | 5 | import simplejson as json 6 | from simplejson import OrderedDict 7 | 8 | class TestDecode(TestCase): 9 | if not hasattr(TestCase, 'assertIs'): 10 | def assertIs(self, a, b): 11 | self.assertTrue(a is b, '%r is %r' % (a, b)) 12 | 13 | def test_decimal(self): 14 | rval = json.loads('1.1', parse_float=decimal.Decimal) 15 | self.assertTrue(isinstance(rval, decimal.Decimal)) 16 | self.assertEquals(rval, decimal.Decimal('1.1')) 17 | 18 | def test_float(self): 19 | rval = json.loads('1', parse_int=float) 20 | self.assertTrue(isinstance(rval, float)) 21 | self.assertEquals(rval, 1.0) 22 | 23 | def test_decoder_optimizations(self): 24 | # Several optimizations were made that skip over calls to 25 | # the whitespace regex, so this test is designed to try and 26 | # exercise the uncommon cases. The array cases are already covered. 27 | rval = json.loads('{ "key" : "value" , "k":"v" }') 28 | self.assertEquals(rval, {"key":"value", "k":"v"}) 29 | 30 | def test_empty_objects(self): 31 | s = '{}' 32 | self.assertEqual(json.loads(s), eval(s)) 33 | s = '[]' 34 | self.assertEqual(json.loads(s), eval(s)) 35 | s = '""' 36 | self.assertEqual(json.loads(s), eval(s)) 37 | 38 | def test_object_pairs_hook(self): 39 | s = '{"xkd":1, "kcw":2, "art":3, "hxm":4, "qrt":5, "pad":6, "hoy":7}' 40 | p = [("xkd", 1), ("kcw", 2), ("art", 3), ("hxm", 4), 41 | ("qrt", 5), ("pad", 6), ("hoy", 7)] 42 | self.assertEqual(json.loads(s), eval(s)) 43 | self.assertEqual(json.loads(s, object_pairs_hook=lambda x: x), p) 44 | self.assertEqual(json.load(StringIO(s), 45 | object_pairs_hook=lambda x: x), p) 46 | od = json.loads(s, object_pairs_hook=OrderedDict) 47 | self.assertEqual(od, OrderedDict(p)) 48 | self.assertEqual(type(od), OrderedDict) 49 | # the object_pairs_hook takes priority over the object_hook 50 | self.assertEqual(json.loads(s, 51 | object_pairs_hook=OrderedDict, 52 | object_hook=lambda x: None), 53 | OrderedDict(p)) 54 | 55 | def check_keys_reuse(self, source, loads): 56 | rval = loads(source) 57 | (a, b), (c, d) = sorted(rval[0]), sorted(rval[1]) 58 | self.assertIs(a, c) 59 | self.assertIs(b, d) 60 | 61 | def test_keys_reuse_str(self): 62 | s = u'[{"a_key": 1, "b_\xe9": 2}, {"a_key": 3, "b_\xe9": 4}]'.encode('utf8') 63 | self.check_keys_reuse(s, json.loads) 64 | 65 | def test_keys_reuse_unicode(self): 66 | s = u'[{"a_key": 1, "b_\xe9": 2}, {"a_key": 3, "b_\xe9": 4}]' 67 | self.check_keys_reuse(s, json.loads) 68 | 69 | def test_empty_strings(self): 70 | self.assertEqual(json.loads('""'), "") 71 | self.assertEqual(json.loads(u'""'), u"") 72 | self.assertEqual(json.loads('[""]'), [""]) 73 | self.assertEqual(json.loads(u'[""]'), [u""]) 74 | -------------------------------------------------------------------------------- /interfaces/web/lib/simplejson/tests/test_default.py: -------------------------------------------------------------------------------- 1 | from unittest import TestCase 2 | 3 | import simplejson as json 4 | 5 | class TestDefault(TestCase): 6 | def test_default(self): 7 | self.assertEquals( 8 | json.dumps(type, default=repr), 9 | json.dumps(repr(type))) 10 | -------------------------------------------------------------------------------- /interfaces/web/lib/simplejson/tests/test_dump.py: -------------------------------------------------------------------------------- 1 | from unittest import TestCase 2 | from cStringIO import StringIO 3 | 4 | import simplejson as json 5 | 6 | class TestDump(TestCase): 7 | def test_dump(self): 8 | sio = StringIO() 9 | json.dump({}, sio) 10 | self.assertEquals(sio.getvalue(), '{}') 11 | 12 | def test_dumps(self): 13 | self.assertEquals(json.dumps({}), '{}') 14 | 15 | def test_encode_truefalse(self): 16 | self.assertEquals(json.dumps( 17 | {True: False, False: True}, sort_keys=True), 18 | '{"false": true, "true": false}') 19 | self.assertEquals(json.dumps( 20 | {2: 3.0, 4.0: 5L, False: 1, 6L: True, "7": 0}, sort_keys=True), 21 | '{"false": 1, "2": 3.0, "4.0": 5, "6": true, "7": 0}') 22 | 23 | def test_ordered_dict(self): 24 | # http://bugs.python.org/issue6105 25 | items = [('one', 1), ('two', 2), ('three', 3), ('four', 4), ('five', 5)] 26 | s = json.dumps(json.OrderedDict(items)) 27 | self.assertEqual(s, '{"one": 1, "two": 2, "three": 3, "four": 4, "five": 5}') -------------------------------------------------------------------------------- /interfaces/web/lib/simplejson/tests/test_encode_basestring_ascii.py: -------------------------------------------------------------------------------- 1 | from unittest import TestCase 2 | 3 | import simplejson.encoder 4 | 5 | CASES = [ 6 | (u'/\\"\ucafe\ubabe\uab98\ufcde\ubcda\uef4a\x08\x0c\n\r\t`1~!@#$%^&*()_+-=[]{}|;:\',./<>?', '"/\\\\\\"\\ucafe\\ubabe\\uab98\\ufcde\\ubcda\\uef4a\\b\\f\\n\\r\\t`1~!@#$%^&*()_+-=[]{}|;:\',./<>?"'), 7 | (u'\u0123\u4567\u89ab\ucdef\uabcd\uef4a', '"\\u0123\\u4567\\u89ab\\ucdef\\uabcd\\uef4a"'), 8 | (u'controls', '"controls"'), 9 | (u'\x08\x0c\n\r\t', '"\\b\\f\\n\\r\\t"'), 10 | (u'{"object with 1 member":["array with 1 element"]}', '"{\\"object with 1 member\\":[\\"array with 1 element\\"]}"'), 11 | (u' s p a c e d ', '" s p a c e d "'), 12 | (u'\U0001d120', '"\\ud834\\udd20"'), 13 | (u'\u03b1\u03a9', '"\\u03b1\\u03a9"'), 14 | ('\xce\xb1\xce\xa9', '"\\u03b1\\u03a9"'), 15 | (u'\u03b1\u03a9', '"\\u03b1\\u03a9"'), 16 | ('\xce\xb1\xce\xa9', '"\\u03b1\\u03a9"'), 17 | (u'\u03b1\u03a9', '"\\u03b1\\u03a9"'), 18 | (u'\u03b1\u03a9', '"\\u03b1\\u03a9"'), 19 | (u"`1~!@#$%^&*()_+-={':[,]}|;.?", '"`1~!@#$%^&*()_+-={\':[,]}|;.?"'), 20 | (u'\x08\x0c\n\r\t', '"\\b\\f\\n\\r\\t"'), 21 | (u'\u0123\u4567\u89ab\ucdef\uabcd\uef4a', '"\\u0123\\u4567\\u89ab\\ucdef\\uabcd\\uef4a"'), 22 | ] 23 | 24 | class TestEncodeBaseStringAscii(TestCase): 25 | def test_py_encode_basestring_ascii(self): 26 | self._test_encode_basestring_ascii(simplejson.encoder.py_encode_basestring_ascii) 27 | 28 | def test_c_encode_basestring_ascii(self): 29 | if not simplejson.encoder.c_encode_basestring_ascii: 30 | return 31 | self._test_encode_basestring_ascii(simplejson.encoder.c_encode_basestring_ascii) 32 | 33 | def _test_encode_basestring_ascii(self, encode_basestring_ascii): 34 | fname = encode_basestring_ascii.__name__ 35 | for input_string, expect in CASES: 36 | result = encode_basestring_ascii(input_string) 37 | #self.assertEquals(result, expect, 38 | # '{0!r} != {1!r} for {2}({3!r})'.format( 39 | # result, expect, fname, input_string)) 40 | self.assertEquals(result, expect, 41 | '%r != %r for %s(%r)' % (result, expect, fname, input_string)) 42 | -------------------------------------------------------------------------------- /interfaces/web/lib/simplejson/tests/test_encode_for_html.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | 3 | import simplejson.decoder 4 | import simplejson.encoder 5 | 6 | 7 | class TestEncodeForHTML(unittest.TestCase): 8 | 9 | def setUp(self): 10 | self.decoder = simplejson.decoder.JSONDecoder() 11 | self.encoder = simplejson.encoder.JSONEncoderForHTML() 12 | 13 | def test_basic_encode(self): 14 | self.assertEqual(r'"\u0026"', self.encoder.encode('&')) 15 | self.assertEqual(r'"\u003c"', self.encoder.encode('<')) 16 | self.assertEqual(r'"\u003e"', self.encoder.encode('>')) 17 | 18 | def test_basic_roundtrip(self): 19 | for char in '&<>': 20 | self.assertEqual( 21 | char, self.decoder.decode( 22 | self.encoder.encode(char))) 23 | 24 | def test_prevent_script_breakout(self): 25 | bad_string = '' 26 | self.assertEqual( 27 | r'"\u003c/script\u003e\u003cscript\u003e' 28 | r'alert(\"gotcha\")\u003c/script\u003e"', 29 | self.encoder.encode(bad_string)) 30 | self.assertEqual( 31 | bad_string, self.decoder.decode( 32 | self.encoder.encode(bad_string))) 33 | -------------------------------------------------------------------------------- /interfaces/web/lib/simplejson/tests/test_float.py: -------------------------------------------------------------------------------- 1 | import math 2 | from unittest import TestCase 3 | 4 | import simplejson as json 5 | 6 | class TestFloat(TestCase): 7 | def test_floats(self): 8 | for num in [1617161771.7650001, math.pi, math.pi**100, 9 | math.pi**-100, 3.1]: 10 | self.assertEquals(float(json.dumps(num)), num) 11 | self.assertEquals(json.loads(json.dumps(num)), num) 12 | self.assertEquals(json.loads(unicode(json.dumps(num))), num) 13 | 14 | def test_ints(self): 15 | for num in [1, 1L, 1<<32, 1<<64]: 16 | self.assertEquals(json.dumps(num), str(num)) 17 | self.assertEquals(int(json.dumps(num)), num) 18 | self.assertEquals(json.loads(json.dumps(num)), num) 19 | self.assertEquals(json.loads(unicode(json.dumps(num))), num) 20 | -------------------------------------------------------------------------------- /interfaces/web/lib/simplejson/tests/test_indent.py: -------------------------------------------------------------------------------- 1 | from unittest import TestCase 2 | 3 | import simplejson as json 4 | import textwrap 5 | 6 | class TestIndent(TestCase): 7 | def test_indent(self): 8 | h = [['blorpie'], ['whoops'], [], 'd-shtaeou', 'd-nthiouh', 9 | 'i-vhbjkhnth', 10 | {'nifty': 87}, {'field': 'yes', 'morefield': False} ] 11 | 12 | expect = textwrap.dedent("""\ 13 | [ 14 | \t[ 15 | \t\t"blorpie" 16 | \t], 17 | \t[ 18 | \t\t"whoops" 19 | \t], 20 | \t[], 21 | \t"d-shtaeou", 22 | \t"d-nthiouh", 23 | \t"i-vhbjkhnth", 24 | \t{ 25 | \t\t"nifty": 87 26 | \t}, 27 | \t{ 28 | \t\t"field": "yes", 29 | \t\t"morefield": false 30 | \t} 31 | ]""") 32 | 33 | 34 | d1 = json.dumps(h) 35 | d2 = json.dumps(h, indent='\t', sort_keys=True, separators=(',', ': ')) 36 | d3 = json.dumps(h, indent=' ', sort_keys=True, separators=(',', ': ')) 37 | d4 = json.dumps(h, indent=2, sort_keys=True, separators=(',', ': ')) 38 | 39 | h1 = json.loads(d1) 40 | h2 = json.loads(d2) 41 | h3 = json.loads(d3) 42 | h4 = json.loads(d4) 43 | 44 | self.assertEquals(h1, h) 45 | self.assertEquals(h2, h) 46 | self.assertEquals(h3, h) 47 | self.assertEquals(h4, h) 48 | self.assertEquals(d3, expect.replace('\t', ' ')) 49 | self.assertEquals(d4, expect.replace('\t', ' ')) 50 | # NOTE: Python 2.4 textwrap.dedent converts tabs to spaces, 51 | # so the following is expected to fail. Python 2.4 is not a 52 | # supported platform in simplejson 2.1.0+. 53 | self.assertEquals(d2, expect) 54 | -------------------------------------------------------------------------------- /interfaces/web/lib/simplejson/tests/test_pass1.py: -------------------------------------------------------------------------------- 1 | from unittest import TestCase 2 | 3 | import simplejson as json 4 | 5 | # from http://json.org/JSON_checker/test/pass1.json 6 | JSON = r''' 7 | [ 8 | "JSON Test Pattern pass1", 9 | {"object with 1 member":["array with 1 element"]}, 10 | {}, 11 | [], 12 | -42, 13 | true, 14 | false, 15 | null, 16 | { 17 | "integer": 1234567890, 18 | "real": -9876.543210, 19 | "e": 0.123456789e-12, 20 | "E": 1.234567890E+34, 21 | "": 23456789012E666, 22 | "zero": 0, 23 | "one": 1, 24 | "space": " ", 25 | "quote": "\"", 26 | "backslash": "\\", 27 | "controls": "\b\f\n\r\t", 28 | "slash": "/ & \/", 29 | "alpha": "abcdefghijklmnopqrstuvwyz", 30 | "ALPHA": "ABCDEFGHIJKLMNOPQRSTUVWYZ", 31 | "digit": "0123456789", 32 | "special": "`1~!@#$%^&*()_+-={':[,]}|;.?", 33 | "hex": "\u0123\u4567\u89AB\uCDEF\uabcd\uef4A", 34 | "true": true, 35 | "false": false, 36 | "null": null, 37 | "array":[ ], 38 | "object":{ }, 39 | "address": "50 St. James Street", 40 | "url": "http://www.JSON.org/", 41 | "comment": "// /* */": " ", 43 | " s p a c e d " :[1,2 , 3 44 | 45 | , 46 | 47 | 4 , 5 , 6 ,7 ], 48 | "compact": [1,2,3,4,5,6,7], 49 | "jsontext": "{\"object with 1 member\":[\"array with 1 element\"]}", 50 | "quotes": "" \u0022 %22 0x22 034 "", 51 | "\/\\\"\uCAFE\uBABE\uAB98\uFCDE\ubcda\uef4A\b\f\n\r\t`1~!@#$%^&*()_+-=[]{}|;:',./<>?" 52 | : "A key can be any string" 53 | }, 54 | 0.5 ,98.6 55 | , 56 | 99.44 57 | , 58 | 59 | 1066 60 | 61 | 62 | ,"rosebud"] 63 | ''' 64 | 65 | class TestPass1(TestCase): 66 | def test_parse(self): 67 | # test in/out equivalence and parsing 68 | res = json.loads(JSON) 69 | out = json.dumps(res) 70 | self.assertEquals(res, json.loads(out)) 71 | try: 72 | json.dumps(res, allow_nan=False) 73 | except ValueError: 74 | pass 75 | else: 76 | self.fail("23456789012E666 should be out of range") 77 | -------------------------------------------------------------------------------- /interfaces/web/lib/simplejson/tests/test_pass2.py: -------------------------------------------------------------------------------- 1 | from unittest import TestCase 2 | import simplejson as json 3 | 4 | # from http://json.org/JSON_checker/test/pass2.json 5 | JSON = r''' 6 | [[[[[[[[[[[[[[[[[[["Not too deep"]]]]]]]]]]]]]]]]]]] 7 | ''' 8 | 9 | class TestPass2(TestCase): 10 | def test_parse(self): 11 | # test in/out equivalence and parsing 12 | res = json.loads(JSON) 13 | out = json.dumps(res) 14 | self.assertEquals(res, json.loads(out)) 15 | -------------------------------------------------------------------------------- /interfaces/web/lib/simplejson/tests/test_pass3.py: -------------------------------------------------------------------------------- 1 | from unittest import TestCase 2 | 3 | import simplejson as json 4 | 5 | # from http://json.org/JSON_checker/test/pass3.json 6 | JSON = r''' 7 | { 8 | "JSON Test Pattern pass3": { 9 | "The outermost value": "must be an object or array.", 10 | "In this test": "It is an object." 11 | } 12 | } 13 | ''' 14 | 15 | class TestPass3(TestCase): 16 | def test_parse(self): 17 | # test in/out equivalence and parsing 18 | res = json.loads(JSON) 19 | out = json.dumps(res) 20 | self.assertEquals(res, json.loads(out)) 21 | -------------------------------------------------------------------------------- /interfaces/web/lib/simplejson/tests/test_recursion.py: -------------------------------------------------------------------------------- 1 | from unittest import TestCase 2 | 3 | import simplejson as json 4 | 5 | class JSONTestObject: 6 | pass 7 | 8 | 9 | class RecursiveJSONEncoder(json.JSONEncoder): 10 | recurse = False 11 | def default(self, o): 12 | if o is JSONTestObject: 13 | if self.recurse: 14 | return [JSONTestObject] 15 | else: 16 | return 'JSONTestObject' 17 | return json.JSONEncoder.default(o) 18 | 19 | 20 | class TestRecursion(TestCase): 21 | def test_listrecursion(self): 22 | x = [] 23 | x.append(x) 24 | try: 25 | json.dumps(x) 26 | except ValueError: 27 | pass 28 | else: 29 | self.fail("didn't raise ValueError on list recursion") 30 | x = [] 31 | y = [x] 32 | x.append(y) 33 | try: 34 | json.dumps(x) 35 | except ValueError: 36 | pass 37 | else: 38 | self.fail("didn't raise ValueError on alternating list recursion") 39 | y = [] 40 | x = [y, y] 41 | # ensure that the marker is cleared 42 | json.dumps(x) 43 | 44 | def test_dictrecursion(self): 45 | x = {} 46 | x["test"] = x 47 | try: 48 | json.dumps(x) 49 | except ValueError: 50 | pass 51 | else: 52 | self.fail("didn't raise ValueError on dict recursion") 53 | x = {} 54 | y = {"a": x, "b": x} 55 | # ensure that the marker is cleared 56 | json.dumps(x) 57 | 58 | def test_defaultrecursion(self): 59 | enc = RecursiveJSONEncoder() 60 | self.assertEquals(enc.encode(JSONTestObject), '"JSONTestObject"') 61 | enc.recurse = True 62 | try: 63 | enc.encode(JSONTestObject) 64 | except ValueError: 65 | pass 66 | else: 67 | self.fail("didn't raise ValueError on default recursion") 68 | -------------------------------------------------------------------------------- /interfaces/web/lib/simplejson/tests/test_separators.py: -------------------------------------------------------------------------------- 1 | import textwrap 2 | from unittest import TestCase 3 | 4 | import simplejson as json 5 | 6 | 7 | class TestSeparators(TestCase): 8 | def test_separators(self): 9 | h = [['blorpie'], ['whoops'], [], 'd-shtaeou', 'd-nthiouh', 'i-vhbjkhnth', 10 | {'nifty': 87}, {'field': 'yes', 'morefield': False} ] 11 | 12 | expect = textwrap.dedent("""\ 13 | [ 14 | [ 15 | "blorpie" 16 | ] , 17 | [ 18 | "whoops" 19 | ] , 20 | [] , 21 | "d-shtaeou" , 22 | "d-nthiouh" , 23 | "i-vhbjkhnth" , 24 | { 25 | "nifty" : 87 26 | } , 27 | { 28 | "field" : "yes" , 29 | "morefield" : false 30 | } 31 | ]""") 32 | 33 | 34 | d1 = json.dumps(h) 35 | d2 = json.dumps(h, indent=' ', sort_keys=True, separators=(' ,', ' : ')) 36 | 37 | h1 = json.loads(d1) 38 | h2 = json.loads(d2) 39 | 40 | self.assertEquals(h1, h) 41 | self.assertEquals(h2, h) 42 | self.assertEquals(d2, expect) 43 | -------------------------------------------------------------------------------- /interfaces/web/lib/simplejson/tests/test_speedups.py: -------------------------------------------------------------------------------- 1 | import decimal 2 | from unittest import TestCase 3 | 4 | from simplejson import decoder, encoder, scanner 5 | 6 | def has_speedups(): 7 | return encoder.c_make_encoder is not None 8 | 9 | class TestDecode(TestCase): 10 | def test_make_scanner(self): 11 | if not has_speedups(): 12 | return 13 | self.assertRaises(AttributeError, scanner.c_make_scanner, 1) 14 | 15 | def test_make_encoder(self): 16 | if not has_speedups(): 17 | return 18 | self.assertRaises(TypeError, encoder.c_make_encoder, 19 | None, 20 | "\xCD\x7D\x3D\x4E\x12\x4C\xF9\x79\xD7\x52\xBA\x82\xF2\x27\x4A\x7D\xA0\xCA\x75", 21 | None) 22 | -------------------------------------------------------------------------------- /interfaces/web/lib/simplejson/tool.py: -------------------------------------------------------------------------------- 1 | r"""Command-line tool to validate and pretty-print JSON 2 | 3 | Usage:: 4 | 5 | $ echo '{"json":"obj"}' | python -m simplejson.tool 6 | { 7 | "json": "obj" 8 | } 9 | $ echo '{ 1.2:3.4}' | python -m simplejson.tool 10 | Expecting property name: line 1 column 2 (char 2) 11 | 12 | """ 13 | import sys 14 | import simplejson as json 15 | 16 | def main(): 17 | if len(sys.argv) == 1: 18 | infile = sys.stdin 19 | outfile = sys.stdout 20 | elif len(sys.argv) == 2: 21 | infile = open(sys.argv[1], 'rb') 22 | outfile = sys.stdout 23 | elif len(sys.argv) == 3: 24 | infile = open(sys.argv[1], 'rb') 25 | outfile = open(sys.argv[2], 'wb') 26 | else: 27 | raise SystemExit(sys.argv[0] + " [infile [outfile]]") 28 | try: 29 | obj = json.load(infile, 30 | object_pairs_hook=json.OrderedDict, 31 | use_decimal=True) 32 | except ValueError, e: 33 | raise SystemExit(e) 34 | json.dump(obj, outfile, sort_keys=True, indent=' ', use_decimal=True) 35 | outfile.write('\n') 36 | 37 | 38 | if __name__ == '__main__': 39 | main() 40 | -------------------------------------------------------------------------------- /interfaces/web/mishkal-webserver.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/python 2 | # -*- coding: UTF-8 -*- 3 | from __future__ import (absolute_import, division, 4 | print_function, unicode_literals) 5 | import sys 6 | import os.path 7 | import re 8 | from glob import glob 9 | sys.path.append(os.path.join(os.path.dirname(sys.argv[0]), '../../support/')) 10 | #sys.path.append(os.path.join(os.path.dirname(sys.argv[0]), '../../mishkal/lib/')) 11 | sys.path.append(os.path.join(os.path.dirname(sys.argv[0]), '../../mishkal')) 12 | sys.path.append(os.path.join(os.path.dirname(sys.argv[0]), './lib')) 13 | sys.path.append(os.path.join(os.path.dirname(sys.argv[0]), '../../')) 14 | from okasha2.baseWebApp import * 15 | from okasha2.utils import fromFs, toFs 16 | 17 | from adawaty import * 18 | 19 | def test(): 20 | # this requires python-paste package 21 | import logging 22 | from paste import httpserver 23 | 24 | d=fromFs(os.path.dirname(sys.argv[0])) 25 | LOG_FILENAME = os.path.join(d,u'tmp','logging_example.out') 26 | logging.basicConfig(filename=LOG_FILENAME,level=logging.INFO,) 27 | myLogger=logging.getLogger('MyTestWebApp') 28 | h=logging.StreamHandler() # in production use WatchedFileHandler or RotatingFileHandler 29 | h.setFormatter(logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")) 30 | myLogger.addHandler(h) 31 | myLogger.setLevel(logging.INFO) # in production use logging.INFO 32 | d=fromFs(os.path.dirname(sys.argv[0])) 33 | app=webApp( 34 | os.path.join(d,u'resources/templates'), 35 | staticBaseDir={u'/_files/':os.path.join(d,u'resources/files')}, 36 | logger=myLogger 37 | ); 38 | # for options see http://pythonpaste.org/modules/httpserver.html 39 | try: 40 | httpserver.serve(app, host='0.0.0.0', port='8080') 41 | except: 42 | httpserver.serve(app, host='0.0.0.0', port='8081') 43 | 44 | if __name__ == '__main__': 45 | test(); 46 | -------------------------------------------------------------------------------- /interfaces/web/resources/errorPages/400.shtml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | مشاريع للغة العربية 5 | 6 | 7 | 8 | 9 | 10 |
11 | مشكال: تشكيل النصوص العربية 12 |

13 | مشكال النصوص العربية 14 |

15 |
16 |

400 Bad Request

17 |

خطأ في الطلب

18 |
19 |

يمكنك العودة إلى 20 | الصفحة الرئيسية 21 |

22 |

يرجى الاتصال بمسؤول الموقع

23 |

أترك تعليقا

24 |
25 | 36 | 37 | blog comments powered by Disqus 38 | 39 | 40 | 41 | 46 | 47 | 48 | 49 |
50 | 51 | 52 | -------------------------------------------------------------------------------- /interfaces/web/resources/errorPages/404.shtml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | مشاريع للغة العربية 5 | 6 | 7 | 8 | 9 | 10 |
11 | مشكال: تشكيل النصوص العربية 12 |

13 | مشكال النصوص العربية 14 |

15 |
16 |

صفحة الخطأ 404

17 |

صفحة غير موجودة

18 |
19 |

يمكنك العودة إلى 20 | الصفحة الرئيسية 21 |

22 |

يرجى الاتصال بمسؤول الموقع

23 |

أترك تعليقا

24 |
25 | 36 | 37 | blog comments powered by Disqus 38 | 39 | 40 | 41 | 46 | 47 | 48 | 49 |
50 | 51 | 52 | -------------------------------------------------------------------------------- /interfaces/web/resources/errorPages/500.shtml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | مشكال النصوص العربية 5 | 6 | 7 | 8 | 9 | 10 |
11 | مشكال: تشكيل النصوص العربية 12 |
13 |

اعتذار وتوضيح

14 | 15 |

يؤسفنا أنّ إصلاح الموقع قد تأخر، ولفائدة زوارنا الكرام، نريد توضيح ما يلي:

16 |
17 |
    18 |
  1. مشكال برنامج مفتوح المصدر برنامج حر.
  2. 19 |
  3. لا نية لنا في إغلاق هذه الخدمة، والتوقف مؤقت، بسبب مشاكل تقنية
  4. 20 |
  5. البرنامج متوفر في عدة صيغ من بينها برنامج خادم الويب، الذي يمكنك من استعماله كموقع على جهازك الخاص
  6. 21 |
  7. الإصدارات الحديثة متوفرة للتحميل
  8. 22 |
  9. الأسباب التقنية هي ضغط الحمل على الخادم واستهلاك الموارد
  10. 23 |
  11. نرحب بكل مساعدة ممكنة
  12. 24 |
25 |
26 |

تحميل

27 |
28 |

يمكنك تحميل نسخة سطح المكتب حتى نصلح الموقع

29 |

تحميل

30 | 31 | 46 |

يرجى الاتصال بمسؤول الموقع

47 |

أترك تعليقا

48 |
49 | 60 | 61 | blog comments powered by Disqus 62 | 63 | 64 | 65 | 70 | 71 | 72 | 73 |
74 | 75 | 76 | -------------------------------------------------------------------------------- /interfaces/web/resources/errorPages/Index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | مشكال النصوص العربية 5 | 6 | 7 | 8 | 9 | 10 |
11 | مشكال: تشكيل النصوص العربية 12 |
13 |

اعتذار وتوضيح

14 | 15 |

يؤسفنا أنّ إصلاح الموقع قد تأخر، ولفائدة زوارنا الكرام، نريد توضيح ما يلي:

16 |
17 |
    18 |
  1. مشكال برنامج مفتوح المصدر برنامج حر.
  2. 19 |
  3. لا نية لنا في إغلاق هذه الخدمة، والتوقف مؤقت، بسبب مشاكل تقنية
  4. 20 |
  5. < البرنامج متوفر في عدة صيغ من بينها برنامج خادم الويب، الذي يمكنك من استعماله كموقع على جهازك الخاص
  6. 21 |
  7. الإصدارات الحديثة متوفرة للتحميل
  8. 22 |
  9. الأسباب التقنية هي ضغط الحمل على الخادم واستهلاك الموارد
  10. 23 |
  11. نرحب بكل مساعدة ممكنة
  12. 24 |
25 |
26 |

تحميل

27 |
28 |

يمكنك تحميل نسخة سطح المكتب حتى نصلح الموقع

29 |

تحميل

30 | 31 | 46 |

يرجى الاتصال بمسؤول الموقع

47 |

أترك تعليقا

48 |
49 | 60 | 61 | blog comments powered by Disqus 62 | 63 | 64 | 65 | 70 | 71 | 72 | 73 |
74 | 75 | 76 | -------------------------------------------------------------------------------- /interfaces/web/resources/errorPages/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/web/resources/errorPages/images/logo.png -------------------------------------------------------------------------------- /interfaces/web/resources/errorPages/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/web/resources/errorPages/logo.png -------------------------------------------------------------------------------- /interfaces/web/resources/files/favicon1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/web/resources/files/favicon1.png -------------------------------------------------------------------------------- /interfaces/web/resources/files/fonts/DroidNaskh-Regular-Colored.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/web/resources/files/fonts/DroidNaskh-Regular-Colored.ttf -------------------------------------------------------------------------------- /interfaces/web/resources/files/fonts/DroidNaskh-Regular-Colored.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/web/resources/files/fonts/DroidNaskh-Regular-Colored.woff -------------------------------------------------------------------------------- /interfaces/web/resources/files/fonts/KacstOne.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/web/resources/files/fonts/KacstOne.eot -------------------------------------------------------------------------------- /interfaces/web/resources/files/fonts/KacstOne.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/web/resources/files/fonts/KacstOne.otf -------------------------------------------------------------------------------- /interfaces/web/resources/files/fonts/KacstOne.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/web/resources/files/fonts/KacstOne.ttf -------------------------------------------------------------------------------- /interfaces/web/resources/files/fonts/KacstOne.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/web/resources/files/fonts/KacstOne.woff -------------------------------------------------------------------------------- /interfaces/web/resources/files/fonts/KacstOneColored.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/web/resources/files/fonts/KacstOneColored.ttf -------------------------------------------------------------------------------- /interfaces/web/resources/files/fonts/SimpleNaskhi-colores.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/web/resources/files/fonts/SimpleNaskhi-colores.ttf -------------------------------------------------------------------------------- /interfaces/web/resources/files/fonts/amiri-quran-colored.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/web/resources/files/fonts/amiri-quran-colored.eot -------------------------------------------------------------------------------- /interfaces/web/resources/files/fonts/amiri-quran-colored.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/web/resources/files/fonts/amiri-quran-colored.ttf -------------------------------------------------------------------------------- /interfaces/web/resources/files/fonts/amiri-quran-colored.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/web/resources/files/fonts/amiri-quran-colored.woff -------------------------------------------------------------------------------- /interfaces/web/resources/files/images/adawat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/web/resources/files/images/adawat.png -------------------------------------------------------------------------------- /interfaces/web/resources/files/images/ayaspell.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/web/resources/files/images/ayaspell.png -------------------------------------------------------------------------------- /interfaces/web/resources/files/images/dreamdevdz.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/web/resources/files/images/dreamdevdz.jpeg -------------------------------------------------------------------------------- /interfaces/web/resources/files/images/dreamdevdz.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/web/resources/files/images/dreamdevdz.png -------------------------------------------------------------------------------- /interfaces/web/resources/files/images/main167-750x402.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/web/resources/files/images/main167-750x402.jpg -------------------------------------------------------------------------------- /interfaces/web/resources/files/images/pyarabic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/web/resources/files/images/pyarabic.png -------------------------------------------------------------------------------- /interfaces/web/resources/files/images/qutrub.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/web/resources/files/images/qutrub.jpg -------------------------------------------------------------------------------- /interfaces/web/resources/files/images/radif.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/web/resources/files/images/radif.png -------------------------------------------------------------------------------- /interfaces/web/resources/files/images/tashaphyne.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/web/resources/files/images/tashaphyne.png -------------------------------------------------------------------------------- /interfaces/web/resources/files/logo-big.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/web/resources/files/logo-big.png -------------------------------------------------------------------------------- /interfaces/web/resources/files/logo-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/web/resources/files/logo-icon.png -------------------------------------------------------------------------------- /interfaces/web/resources/files/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/web/resources/files/logo.png -------------------------------------------------------------------------------- /interfaces/web/resources/files/samples/gotashkeel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/web/resources/files/samples/gotashkeel.png -------------------------------------------------------------------------------- /interfaces/web/resources/files/samples/mishkal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/web/resources/files/samples/mishkal.png -------------------------------------------------------------------------------- /interfaces/web/resources/files/samples/mishkal_alpha_smpl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/web/resources/files/samples/mishkal_alpha_smpl.png -------------------------------------------------------------------------------- /interfaces/web/resources/files/samples/mixkal.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/web/resources/files/samples/mixkal.jpg -------------------------------------------------------------------------------- /interfaces/web/resources/files/xzero-rtl/fonts/arcx/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/web/resources/files/xzero-rtl/fonts/arcx/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /interfaces/web/resources/files/xzero-rtl/fonts/arcx/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/web/resources/files/xzero-rtl/fonts/arcx/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /interfaces/web/resources/files/xzero-rtl/fonts/arcx/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/web/resources/files/xzero-rtl/fonts/arcx/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /interfaces/web/resources/files/xzero-rtl/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/web/resources/files/xzero-rtl/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /interfaces/web/resources/files/xzero-rtl/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/web/resources/files/xzero-rtl/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /interfaces/web/resources/files/xzero-rtl/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/web/resources/files/xzero-rtl/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /interfaces/web/resources/files/xzero-rtl/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/web/resources/files/xzero-rtl/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /interfaces/web/resources/static/carousel.html: -------------------------------------------------------------------------------- 1 | 39 | -------------------------------------------------------------------------------- /interfaces/web/resources/static/contact.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | مشكال النصوص العربية 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 57 |
%(header)s 58 | 59 |

المطورون

60 | 61 |
    62 |
  • برمجة: طه زروقي (taha.zerrouki at gmail dot com) 63 |
  • 64 |
65 | 66 |

أترك تعليقا

67 | 68 |
blog comments powered by Disqus 82 | 83 |

للاتصال بنا

%(footer)s 86 | 87 | 88 | -------------------------------------------------------------------------------- /interfaces/web/resources/static/download.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | مشكال النصوص العربية 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 57 |
%(header)s 58 | 59 |

تحميل

60 | 61 | %(footer)s 76 | 77 | 78 | -------------------------------------------------------------------------------- /interfaces/web/resources/templates/archiv/500.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | مشكال النصوص العربية 5 | 6 | 7 | 8 | 9 | 10 | مشكال: تشكيل النصوص العربية 11 |
12 | 13 | 14 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /interfaces/web/resources/templates/archiv/link.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | مشكال النصوص العربية 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | %(header)s 23 | 24 |

روابط

25 | 26 |

موارد

27 | 46 | 47 | 57 | 58 |

إطار الويب

59 | 65 | %(footer)s 66 | 67 | 68 | -------------------------------------------------------------------------------- /interfaces/web/resources/templates/archiv/log.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/web/resources/templates/archiv/log.html -------------------------------------------------------------------------------- /interfaces/web/resources/templates/archiv/w3layouts-license.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/interfaces/web/resources/templates/archiv/w3layouts-license.txt -------------------------------------------------------------------------------- /interfaces/web/resources/templates/archiv/whoisqutrub.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | قطرب: برنامج تصريف الأفعال 5 | 6 | 7 | 8 | 9 | %(header)s 10 | 11 |

من هو قُطْرُب؟

12 | 13 |

قطرب

14 | 15 |

من ويكيبيديا، الموسوعة الحرة

16 | 17 |

18 | قطرب 19 | هو أبو علي محمد بن المستنيربن أحمد البصري، أحد من اختلف إلى سيبويه وتعلم منه، وكان يدلج إليه، وإذا خرج رآه على 20 | بابه غدوة وعشية، فقال له: ماأنت إلا قطرب ليل! فلقب به. واشتهر بمثلثات قطرب. وأول من ألف رسالة في أبنية الأفعال. 21 |

22 |

23 | توفي قطرب ببغداد سنة 206 هـ 24 |

25 | 26 |

ما معنى قُطْرُب

27 |

28 | قال ابن دريد: 29 |

30 |
31 |

32 | قطرب وقطروب ذكر الغيلان. قال: ولغة أزدية يسمون الكلاب الصغار 33 | القطارب. وقال ثعلب: القطرب دويبة كثيرة الحركة وهو الصرار. قال: يروى عن 34 | النبي صلى الله عليه وسلم: إن أحدكم جيفة ليل قطرب نهار! أي لايقوم بالليل 35 | لخير ولاصلاة ويتحرك بالنهار كهذه الدويبة. 36 |

37 |
38 |

39 | هذا وقد غلب هذا الاسم عليه واشتهر به، وكان من كبار أئمة اللغة في 40 | عصره. 41 |

42 | 43 |

مثلثات قطرب

44 |

45 | وهو أول من وضع المثلث في اللغة العربية، وتبعه غيره كالبطليوسي والخطيب والبلنسي. واشتغل معلمًا لأولاد الأمير أبي دلف العجلي وممن شرح مثلثات قطرب ضياء الدين أبو العز المغيث بن علوي البغدادي اللغوي الحنبلي المتوفى سنة 583 هـ. 46 |

47 | 48 |

مؤلفاته

49 |
    50 |
  1. معاني القرآن الكريم
  2. 51 |
  3. كتاب النوادر
  4. 52 |
  5. كتاب الأزمنة
  6. 53 |
  7. كتاب الأضداد
  8. 54 |
  9. خلق الإنسان
  10. 55 |
  11. غريب الحديث
  12. 56 |
  13. كتاب العلل في النحو
  14. 57 |
  15. كتاب الاشتقاق
  16. 58 |
  17. كتاب القوافي
  18. 59 |
  19. كتاب الأصول
  20. 60 |
  21. كتاب الصفات
  22. 61 |
  23. خلق الفرس
  24. 62 |
  25. الرد على الملحدين
  26. 63 |
  27. كتاب الأصوات
  28. 64 |
  29. كتاب الفرق
  30. 65 |
66 |

وغيرها

67 | 68 | %(footer)s 69 | -------------------------------------------------------------------------------- /interfaces/web/resources/templates/carousel.html: -------------------------------------------------------------------------------- 1 | 39 | -------------------------------------------------------------------------------- /interfaces/web/resources/templates/download.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | مشكال النصوص العربية 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 57 |
%(header)s 58 | 59 |

تحميل

60 | 61 | %(footer)s 76 | 77 | 78 | -------------------------------------------------------------------------------- /interfaces/web/views/contact.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | مشكال النصوص العربية 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 57 |
%(header)s 58 | 59 |

المطورون

60 | 61 |
    62 |
  • برمجة: طه زروقي (taha.zerrouki at gmail dot com) 63 |
  • 64 |
65 | 66 |

أترك تعليقا

67 | 68 |
blog comments powered by Disqus 82 | 83 |

للاتصال بنا

%(footer)s 86 | 87 | 88 | -------------------------------------------------------------------------------- /interfaces/web/views/download.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | مشكال النصوص العربية 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 57 |
%(header)s 58 | 59 |

تحميل

60 | 61 | %(footer)s 76 | 77 | 78 | -------------------------------------------------------------------------------- /logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/logo.png -------------------------------------------------------------------------------- /mishkal-console.spec: -------------------------------------------------------------------------------- 1 | # -*- mode: python ; coding: utf-8 -*- 2 | 3 | 4 | block_cipher = None 5 | 6 | 7 | a = Analysis(['bin\mishkal-console.py'], 8 | pathex=['D:\\projects\\mishkal'], 9 | binaries=[], 10 | datas=[("data/*","data"), 11 | ("maskouk/data/*","maskouk/data"), 12 | 13 | ], 14 | hiddenimports=[], 15 | hookspath=[], 16 | hooksconfig={}, 17 | runtime_hooks=[], 18 | excludes=[], 19 | win_no_prefer_redirects=False, 20 | win_private_assemblies=False, 21 | cipher=block_cipher, 22 | noarchive=False) 23 | pyz = PYZ(a.pure, a.zipped_data, 24 | cipher=block_cipher) 25 | 26 | exe = EXE(pyz, 27 | a.scripts, 28 | [], 29 | exclude_binaries=True, 30 | name='mishkal-console', 31 | debug=True, 32 | bootloader_ignore_signals=False, 33 | strip=False, 34 | upx=True, 35 | console=True, 36 | disable_windowed_traceback=False, 37 | target_arch=None, 38 | codesign_identity=None, 39 | entitlements_file=None ) 40 | coll = COLLECT(exe, 41 | a.binaries, 42 | a.zipfiles, 43 | a.datas, 44 | strip=False, 45 | upx=True, 46 | upx_exclude=[], 47 | name='mishkal-console') 48 | -------------------------------------------------------------------------------- /mishkal-gui.spec: -------------------------------------------------------------------------------- 1 | # -*- mode: python ; coding: utf-8 -*- 2 | 3 | 4 | block_cipher = None 5 | 6 | 7 | a = Analysis(['interfaces\\gui\\mishkal-gui.py', "interfaces\\web\\mishkal_bottle.py"], 8 | pathex=['D:\\projects\\mishkal'], 9 | binaries=[], 10 | datas=[("data/*","data"), 11 | ("maskouk/data/*","maskouk/data"), 12 | # for gui interfaces 13 | ("interfaces/gui/ar/*","gui/ar/"), 14 | ("interfaces/gui/ar/images/*","gui/ar/images"), 15 | # ~ ("arramooz-pysqlite/data/*","data"), 16 | # ~ ("maskouk/data/*","maskouk/data"), 17 | # ~ ("maskouk/data/*","data"), 18 | 19 | 20 | 21 | 22 | ], 23 | hiddenimports=[], 24 | hookspath=[], 25 | hooksconfig={}, 26 | runtime_hooks=[], 27 | excludes=[], 28 | win_no_prefer_redirects=False, 29 | win_private_assemblies=False, 30 | cipher=block_cipher, 31 | noarchive=False) 32 | pyz = PYZ(a.pure, a.zipped_data, 33 | cipher=block_cipher) 34 | 35 | exe = EXE(pyz, 36 | a.scripts, 37 | [], 38 | exclude_binaries=True, 39 | name='mishkal-gui', 40 | debug=True, 41 | bootloader_ignore_signals=False, 42 | strip=False, 43 | upx=True, 44 | console=True, 45 | disable_windowed_traceback=False, 46 | target_arch=None, 47 | codesign_identity=None, 48 | entitlements_file=None ) 49 | coll = COLLECT(exe, 50 | a.binaries, 51 | a.zipfiles, 52 | a.datas, 53 | strip=False, 54 | upx=True, 55 | upx_exclude=[], 56 | name='mishkal-gui') 57 | -------------------------------------------------------------------------------- /mishkal-web.spec: -------------------------------------------------------------------------------- 1 | # -*- mode: python ; coding: utf-8 -*- 2 | 3 | 4 | block_cipher = None 5 | 6 | 7 | a = Analysis(["interfaces\\web\\mishkal_bottle.py"], 8 | pathex=['D:\\projects\\mishkal'], 9 | binaries=[], 10 | datas=[("data/*","data"), 11 | ("maskouk/data/*","maskouk/data"), 12 | # for web 13 | ('interfaces/web/resources/*','resources'), 14 | ('interfaces/web/resources/errorPages/*','resources/errorPages'), 15 | ('interfaces/web/resources/errorPages/images/*','resources/errorPages/images'), 16 | ('interfaces/web/resources/files/*','resources/files'), 17 | ('interfaces/web/resources/files/fonts/*','resources/files/fonts'), 18 | ('interfaces/web/resources/files/images/*','resources/files/images'), 19 | ('interfaces/web/resources/files/samples/*','resources/files/samples'), 20 | ('interfaces/web/resources/files/xzero-rtl/*','resources/files/xzero-rtl'), 21 | ('interfaces/web/resources/files/xzero-rtl/css/*','resources/files/xzero-rtl/css'), 22 | ('interfaces/web/resources/files/xzero-rtl/fonts/*','resources/files/xzero-rtl/fonts'), 23 | ('interfaces/web/resources/files/xzero-rtl/js/*','resources/files/xzero-rtl/js'), 24 | ('interfaces/web/resources/static/*','resources/static'), 25 | ('interfaces/web/resources/templates/*','resources/templates'), 26 | ('interfaces/web/views/*','views'), 27 | ('interfaces/web/tmp/*','tmp'), 28 | 29 | 30 | 31 | 32 | 33 | ], 34 | hiddenimports=[], 35 | hookspath=[], 36 | hooksconfig={}, 37 | runtime_hooks=[], 38 | excludes=[], 39 | win_no_prefer_redirects=False, 40 | win_private_assemblies=False, 41 | cipher=block_cipher, 42 | noarchive=False) 43 | pyz = PYZ(a.pure, a.zipped_data, 44 | cipher=block_cipher) 45 | 46 | exe = EXE(pyz, 47 | a.scripts, 48 | [], 49 | exclude_binaries=True, 50 | name='mishkal-web', 51 | debug=True, 52 | bootloader_ignore_signals=False, 53 | strip=False, 54 | upx=True, 55 | console=True, 56 | disable_windowed_traceback=False, 57 | target_arch=None, 58 | codesign_identity=None, 59 | entitlements_file=None ) 60 | coll = COLLECT(exe, 61 | a.binaries, 62 | a.zipfiles, 63 | a.datas, 64 | strip=False, 65 | upx=True, 66 | upx_exclude=[], 67 | name='mishkal-web') 68 | -------------------------------------------------------------------------------- /mishkal.cgi: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding=UTF-8 -*- 3 | import sys, os, os.path, re 4 | from glob import glob 5 | import cgitb 6 | cgitb.enable(logdir=os.path.join(os.path.dirname(__file__), 'tmp/logs'), 7 | display=True, format='html',) 8 | sys.path.append('interfaces/web/lib/'); 9 | sys.path.append('interfaces/web'); 10 | sys.path.append('support'); 11 | sys.path.append('mishkal'); 12 | #~ from okasha2.baseWebApp import * 13 | #~ from okasha2.utils import fromFs, toFs 14 | #~ from adawaty import * 15 | import okasha2.baseWebApp 16 | from okasha2.utils import fromFs 17 | #~ import okasha2.utils.toFs 18 | import adawaty 19 | # this requires python-paste package 20 | import logging 21 | import cgirunner 22 | 23 | if __name__ == '__main__': 24 | 25 | # prepare logging 26 | d = fromFs(os.path.dirname(sys.argv[0])) 27 | LOG_FILENAME = os.path.join(d,u'tmp','logging_mishkal.out') 28 | logging.basicConfig(filename = LOG_FILENAME,level=logging.INFO,) 29 | myLogger = logging.getLogger('Mishkal') 30 | h = logging.StreamHandler() # in production use WatchedFileHandler or RotatingFileHandler 31 | h.setFormatter(logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")) 32 | myLogger.addHandler(h) 33 | myLogger.setLevel(logging.INFO) # in production use logging.INFO 34 | #~ myLogger.setLevel(logging.DEBUG) # in production use logging.INFO 35 | 36 | app = adawaty.webApp( 37 | os.path.join(d,u'interfaces/web/resources/templates'), 38 | staticBaseDir={u'/_files/':os.path.join(d,u'interfaces/web/resources/files'), 39 | u'~/':os.path.join(d,u'tmp/home/'), 40 | }, 41 | logger=myLogger 42 | ); 43 | # for options see http://pythonpaste.org/modules/httpserver.html 44 | cgirunner.run_with_cgi(app) 45 | -------------------------------------------------------------------------------- /mishkal/__init__.py: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /mishkal/tashkeel_const.py: -------------------------------------------------------------------------------- 1 | # -*- coding=utf-8 -*- 2 | CorrectedTashkeel={ 3 | u"قال:":u'قَالَ:', 4 | u"ثم":u'ثُمَّ', 5 | u'ثنا': u'ثَنَا', 6 | } 7 | -------------------------------------------------------------------------------- /mishkal/unknown_tashkeel.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding = utf-8 -*- 3 | #--------------------------------------------------------------------- 4 | # Name: tashkeel 5 | # Purpose: Arabic automatic vocalization. # 6 | # Author: Taha Zerrouki (taha.zerrouki[at]gmail.com) 7 | # Created: 2015-03-25 8 | # Copyright: (c) Taha Zerrouki 2011 # Licence: GPL 9 | #--------------------------------------------------------------------- 10 | """ 11 | Arabic Tashkeel Class of unkonwn words, based on wordlist 12 | """ 13 | import sys 14 | sys.path.append('../lib') 15 | sys.path.append('../') 16 | import re 17 | from . import unknown_const 18 | #~ import unknown_const 19 | import pyarabic.araby as araby 20 | #debug = True 21 | debug = False 22 | class UnknownTashkeel: 23 | """ 24 | Unknown Arabic Tashkeel Class 25 | """ 26 | def __init__(self): 27 | pass 28 | def lookup(self, word): 29 | """ 30 | return a vocalized form of an unknown word, from a word list 31 | """ 32 | return unknown_const.Table.get(word, vocalize_foreign(word)) 33 | 34 | def vocalize_foreign(word): 35 | """ 36 | vocalize a foreign names written in arabic 37 | @param word: given word 38 | @type word: unicode 39 | @return: the vocalized word 40 | @rtype: unicode 41 | """ 42 | marks =[] 43 | previous = "" 44 | for c in word: 45 | if previous and not previous == araby.ALEF: 46 | #--------- add Harakat before letter 47 | if c in (araby.ALEF, araby.ALEF_MAKSURA, araby.TEH_MARBUTA,): 48 | marks.pop() 49 | marks.append(araby.FATHA) 50 | elif c in (araby.WAW, araby.WAW_HAMZA): 51 | marks.pop() 52 | marks.append(araby.DAMMA) 53 | elif c in( araby.YEH , araby.YEH_HAMZA ): 54 | marks.pop() 55 | marks.append(araby.KASRA) 56 | #--------- add Harakat before letter 57 | if c in (araby.ALEF_HAMZA_BELOW): 58 | marks.append(araby.KASRA) 59 | elif previous in (araby.ALEF_HAMZA_BELOW, araby.ALEF_HAMZA_ABOVE): 60 | marks.append(araby.SUKUN) 61 | elif previous in (araby.ALEF, araby.YEH, araby.WAW): 62 | if c == araby.YEH_HAMZA : 63 | marks.append(araby.KASRA) 64 | else: 65 | marks.append(araby.NOT_DEF_HARAKA) 66 | previous = c 67 | #print len(word) ,len(marks) 68 | #print marks 69 | return araby.joint(word, u"".join(marks)) 70 | 71 | -------------------------------------------------------------------------------- /mishkal/unkown.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding = utf-8 -*- 3 | #--------------------------------------------------------------------- 4 | # Name: tashkeel 5 | # Purpose: Arabic automatic vocalization. # 6 | # Author: Taha Zerrouki (taha.zerrouki[at]gmail.com) 7 | # Created: 2015-03-25 8 | # Copyright: (c) Taha Zerrouki 2011 # Licence: GPL 9 | #--------------------------------------------------------------------- 10 | """ 11 | Arabic Tashkeel Class of unkonwn words, based on wordlist 12 | """ 13 | import sys 14 | sys.path.append('../lib') 15 | sys.path.append('../') 16 | import re 17 | import unkown_const 18 | 19 | 20 | debug = False 21 | class UnkownTashkeel: 22 | """ 23 | Arabic Tashkeel Class 24 | """ 25 | def __init__(self): 26 | pass 27 | def lookup(self, word): 28 | """ 29 | return a vocalized form of an unknown word, from a word list 30 | """ 31 | return unkown_const.Table.get(word, word) 32 | 33 | -------------------------------------------------------------------------------- /mishkal/unkown_const.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding = utf-8 -*- 3 | #--------------------------------------------------------------------- 4 | # Name: tashkeel 5 | # Purpose: Arabic automatic vocalization. # 6 | # Author: Taha Zerrouki (taha.zerrouki[at]gmail.com) 7 | # Created: 2015-03-25 8 | # Copyright: (c) Taha Zerrouki 2011 # Licence: GPL 9 | #--------------------------------------------------------------------- 10 | """ 11 | Arabic Tashkeel Class of unkonwn words, based on wordlist 12 | """ 13 | 14 | Table={ 15 | u"داعش":u"دَاعِش", 16 | } 17 | 18 | 19 | -------------------------------------------------------------------------------- /mishkal/unkown_tashkeel.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding = utf-8 -*- 3 | #--------------------------------------------------------------------- 4 | # Name: tashkeel 5 | # Purpose: Arabic automatic vocalization. # 6 | # Author: Taha Zerrouki (taha.zerrouki[at]gmail.com) 7 | # Created: 2015-03-25 8 | # Copyright: (c) Taha Zerrouki 2011 # Licence: GPL 9 | #--------------------------------------------------------------------- 10 | """ 11 | Arabic Tashkeel Class of unkonwn words, based on wordlist 12 | """ 13 | import sys 14 | sys.path.append('../lib') 15 | sys.path.append('../') 16 | import re 17 | import unknown_const 18 | 19 | 20 | debug = True 21 | class UnknownTashkeel: 22 | """ 23 | Arabic Tashkeel Class 24 | """ 25 | def __init__(self): 26 | pass 27 | def lookup(self, word): 28 | """ 29 | return a vocalized form of an unknown word, from a word list 30 | """ 31 | return unkown_const.Table.get(word, word) 32 | 33 | -------------------------------------------------------------------------------- /mishkalbot.cgi: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | # -*- coding=UTF-8 -*- 3 | import sys, os, os.path, re 4 | import os; 5 | import locale; 6 | os.environ["PYTHONIOENCODING"] = "utf-8"; 7 | from glob import glob 8 | sys.path.append('interfaces/web'); 9 | from bottle import run 10 | import mishkal_bottle 11 | 12 | if __name__ == '__main__': 13 | run(mishkal_bottle.app, host='localhost', port=8080, debug=True, server="cgi") 14 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | pyarabic>=0.6.2 2 | libqutrub>=1.0 3 | naftawayh>=0.2 4 | tashaphyne>=0.3.1 5 | arramooz-pysqlite>=0.1 6 | qalsadi>=0.2 7 | mysam-tagmanager>=0.3.3 8 | alyahmor>=0.1 9 | asmai>=0.1 10 | sylajone>=0.1 11 | maskouk-pysqlite>=0.1 12 | pickledb>=0.9.0 13 | codernitydb3==0.6.0 14 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding=utf-8 -*- 3 | # to install type: 4 | # python setup.py install --root=/ 5 | 6 | from setuptools import setup 7 | 8 | with open("README.md", "r", encoding="utf-8") as fh: 9 | long_description = fh.read() 10 | 11 | with open("requirements.txt", "r", encoding="utf-8") as fh: 12 | requirements = fh.read().splitlines() 13 | 14 | setup( 15 | name="mishkal", 16 | version="1.10", 17 | author="Taha Zerrouki", 18 | author_email="taha.zerrouki@gmail.com", 19 | description="Mishkal: Arabic text diacritization library for Python", 20 | long_description=long_description, 21 | long_description_content_type="text/markdown", 22 | url="https://github.com/linuxscout/mishkal", 23 | project_urls={ 24 | "sourceforge mishkal": "http://mishkal.sourceforge.net/", 25 | "Bug Tracker": "https://github.com/linuxscout/mishkal/issues", 26 | }, 27 | classifiers=[ 28 | "Programming Language :: Python", 29 | "License :: OSI Approved :: GPL-3.0", 30 | "Development Status :: 5 - Production/Stable", 31 | "Intended Audience :: End Users/Desktop", 32 | "Operating System :: OS Independent", 33 | ], 34 | license="GPL-3.0", 35 | package_dir={"mishkal": "mishkal"}, 36 | packages=["mishkal"], 37 | install_requires=requirements, 38 | include_package_data=True, 39 | package_data={ 40 | "mishkal": ["doc/*.*", "doc/html/*", "data/*.sqlite", "data/*.sql"], 41 | }, 42 | ) 43 | -------------------------------------------------------------------------------- /support/spellcheck/__init__.py: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /support/spellcheck/backup: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/support/spellcheck/backup -------------------------------------------------------------------------------- /support/spellcheck/spellcheck_const.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/support/spellcheck/spellcheck_const.py -------------------------------------------------------------------------------- /support/yaraspell/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding=utf-8 -*- 3 | #------------------------------------------------------------------------------- 4 | # Name: Arabic Spell checking 5 | # Purpose: spellchecking. 6 | # 7 | # Author: Taha Zerrouki (taha.zerrouki[at]gmail.com) 8 | # 9 | # Created: 2015-04-20 10 | # Copyright: (c) Taha Zerrouki 2015 11 | # Licence: GPL 12 | #------------------------------------------------------------------------------- 13 | """ 14 | Arabic spell checker 15 | """ 16 | -------------------------------------------------------------------------------- /support/yaraspell/data/spellcheck.sqlite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/support/yaraspell/data/spellcheck.sqlite -------------------------------------------------------------------------------- /tests/.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxscout/mishkal/d9529df26b27421738a0f429a655358853a10558/tests/.txt -------------------------------------------------------------------------------- /tests/data/collocations.sqlite: -------------------------------------------------------------------------------- 1 | ../../data/collocations.sqlite -------------------------------------------------------------------------------- /tests/samples/phrases2.txt: -------------------------------------------------------------------------------- 1 | هواؤها 2 | هواءها 3 | هوائها 4 | -------------------------------------------------------------------------------- /tests/samples/semantic.txt: -------------------------------------------------------------------------------- 1 | يشرح الطبيب 2 | يشرح طبيبه 3 | شرحت الطبيبة الجسد 4 | يشرح جثة 5 | الطبيب المشرح 6 | جاء الشيخ الشارح 7 | الشيخ شارح 8 | شرح الجسد 9 | إنّ الطبيب يشرح 10 | في الطبيب يشرح 11 | في الدار طبيب 12 | 13 | -------------------------------------------------------------------------------- /tests/samples/txt: -------------------------------------------------------------------------------- 1 | جاء فريد بن عماد. 2 | اشتريت أحد عشر كتابا. 3 | لم أجد سوى ألف وخمسمئة وثلاثة وعشرين دينارا. 4 | 5 | -------------------------------------------------------------------------------- /tests/testUniqWords.sh: -------------------------------------------------------------------------------- 1 | #python extractUniqWords.py -f samples/vocalized/rndlines.txt >output/uniqwords.tmp.txt 2 | echo " tokenize words, remove last harakat, " 3 | python extractUniqWords.py -f vo1.txt >output/uniqwords.tmp.txt 4 | echo "sort and uniq" 5 | sort output/uniqwords.tmp.txt |uniq -c |sort -n -r > output/uniqwords.unq.txt 6 | echo "remove extra whitespace" 7 | sed "s/^ *//" -i output/uniqwords.unq.txt 8 | echo " extract uniq vocalized words" 9 | python extractUniqWords.py -r -f output/uniqwords.unq.txt > output/uniqwords.tmp.2.txt 10 | echo "sort extracted words by frequency" 11 | sort -n -r output/uniqwords.tmp.2.txt > output/uniqwords.txt 12 | 13 | -------------------------------------------------------------------------------- /tests/test_chunk.sh: -------------------------------------------------------------------------------- 1 | #/usr/bin/sh 2 | #DATA_FILE=vocalized/text.txt 3 | DATA_FILE=samples/vocalized/rndlines.txt 4 | #DATA_FILE=txt 5 | echo "extractchunks.py -f samples/${DATA_FILE} >output/chunks/${DATA_FILE}" 6 | python extractchunks.py -f samples/${DATA_FILE} >output/chunks/${DATA_FILE} 7 | 8 | sort output/chunks/${DATA_FILE} |uniq -c | sort -n -r > output/chunks/${DATA_FILE}.srt 9 | -------------------------------------------------------------------------------- /tests/test_foxPhrase.sh: -------------------------------------------------------------------------------- 1 | #/usr/bin/sh 2 | python -m cProfile ../bin/thalab-console.py -c -f samples/phrases.txt >output/phrases.txt 3 | cp output/phrases.txt output/phrases/1.txt 4 | -------------------------------------------------------------------------------- /tests/test_foxtext.sh: -------------------------------------------------------------------------------- 1 | #/usr/bin/sh 2 | DATE=`date +%Y-%m-%d-%H:%M` 3 | echo "thalab-console.py -c -f samples/10.txt >output/10${DATE}.txt" 4 | python -m cProfile ../bin/thalab-console.py -c -f samples/10.txt >output/10-${DATE}.txt 5 | 6 | 7 | -------------------------------------------------------------------------------- /tests/test_tashkeelCompare.sh: -------------------------------------------------------------------------------- 1 | #~FILE="adab.txt" 2 | FILE="rndlines.txt" 3 | action=`python -m cProfile ../bin/mishkal-console.py -p -c -l 500 -f samples/vocalized/${FILE} >output/compare/rndlines.11.txt` 4 | DATE=`date +%Y-%m-%d-%H:%M` 5 | echo " Test Tashkeel by comparaison " 6 | echo "${action}" 7 | ${action} 8 | echo "\nmake archive" 9 | cp output/compare/rndlines.11.txt output/compare/L${DATE}.txt 10 | echo "save stats" 11 | date >> output/compare/file.stats 12 | grep "function calls" -2 -h output/compare/rndlines.11.txt | sed 's/^.*function .* in //g;s/:\*.*$//g' | sed 'N;s/\n//g' >> output/compare/file.stats 13 | tail -n 3 output/compare/file.stats 14 | 15 | -------------------------------------------------------------------------------- /tests/test_tashkeelCompare2.sh: -------------------------------------------------------------------------------- 1 | echo "../bin/mishkal-console.py -c -l 500 -f samples/vocalized/almuhalla.012.txt >output/compare/rndlines.11.txt" 2 | python -m cProfile ../mishkal-console.py -c -l 500 -f samples/vocalized/almuhalla.012.txt >output/compare/rndlines.11.txt 3 | DATE=`date +%Y-%m-%d-%H:%M` 4 | echo "make archive" 5 | cp output/compare/rndlines.11.txt output/compare/L${DATE}.txt 6 | echo "save stats" 7 | date >> output/compare/file.stats 8 | grep "function calls" -1 -h output/compare/rndlines.txt | sed 's/^.*function .* in //g;s/:\*.*$//g' | sed 'N;s/\n//g' >> output/compare/file.stats 9 | 10 | -------------------------------------------------------------------------------- /tests/test_tashkeelCompare_jazeera.sh: -------------------------------------------------------------------------------- 1 | #~FILE="adab.txt" 2 | #FILE="rndlines.txt" 3 | FILE="aljazeera.txt" 4 | #valgrind --trace-children=yes --tool=massif ../mishkal-console.py -p -c -l 500 -f samples/vocalized/${FILE} >output/compare/rndlines.11.txt 5 | DATE=`date +%Y-%m-%d-%H:%M` 6 | #~ action=`python -m cProfile -o output/mishkal${DATE}.profile ../bin/mishkal-console.py -p -c -l 500 -f samples/vocalized/${FILE} >output/compare/rndlines.11.txt` 7 | action=`python -m cProfile ../bin/mishkal-console.py -p -c -l 500 -f samples/vocalized/${FILE} >output/compare/rndlines.11.txt` 8 | echo ${action} 9 | ${action} 10 | 11 | echo "make archive" 12 | cp output/compare/rndlines.11.txt output/compare/L${DATE}.txt 13 | echo "save stats" 14 | date >> output/compare/file.stats 15 | grep "function calls" -2 -h output/compare/rndlines.11.txt | sed 's/^.*function .* in //g;s/:\*.*$//g' | sed 'N;s/\n//g' >> output/compare/file.stats 16 | tail -n 3 output/compare/file.stats 17 | 18 | -------------------------------------------------------------------------------- /tests/test_tashkeelCompare_jazeera_mem.sh: -------------------------------------------------------------------------------- 1 | #~FILE="adab.txt" 2 | #FILE="rndlines.txt" 3 | FILE="aljazeera.txt" 4 | valgrind --tool=memcheck --tool=massif python ../mishkal-console.py -p -c -l 500 -f samples/vocalized/${FILE} >output/compare/rndlines.11.txt 5 | #python -m cProfile ../mishkal-console.py -p -c -l 500 -f samples/vocalized/${FILE} >output/compare/rndlines.11.txt 6 | DATE=`date +%Y-%m-%d-%H:%M` 7 | echo "make archive" 8 | cp output/compare/rndlines.11.txt output/compare/L${DATE}.txt 9 | echo "save stats" 10 | date >> output/compare/file.stats 11 | grep "function calls" -2 -h output/compare/rndlines.11.txt | sed 's/^.*function .* in //g;s/:\*.*$//g' | sed 'N;s/\n//g' >> output/compare/file.stats 12 | tail -n 3 output/compare/file.stats 13 | 14 | -------------------------------------------------------------------------------- /tests/test_tashkeel_mem.sh: -------------------------------------------------------------------------------- 1 | #~FILE="adab.txt" 2 | #FILE="rndlines.txt" 3 | FILE="text.txt" 4 | echo "delete cache" 5 | rm -r /tmp/qalsadiCache 6 | 7 | echo "test without cache" 8 | DATE=`date +%Y-%m-%d-%H:%M` 9 | LIMIT=500 10 | mkdir -p output/eval/d${DATE} 11 | OUTDIR="output/eval/d${DATE}" 12 | 13 | valgrindNoCache="valgrind --tool=massif --time-unit=ms --detailed-freq=20 --massif-out-file=${OUTDIR}/massif.out.nocache" 14 | valgrindCache="valgrind --tool=massif --time-unit=ms --detailed-freq=20 --massif-out-file=${OUTDIR}/massif.out.cache" 15 | 16 | ${valgrindNoCache} python -m cProfile ../bin/mishkal-console.py -n -p -l ${LIMIT} -f samples/corpus/${FILE} >output/eval/test.txt 17 | echo "Date; ${DATE} \t ${LIMIT} lines" >> output/eval/file.stats 18 | echo "No Cache" >> output/eval/file.stats 19 | grep "function calls" -2 -h output/eval/test.txt | sed 's/^.*function .* in //g;s/:\*.*$//g' | sed 'N;s/\n//g' >> output/eval/file.stats 20 | echo "make archive" 21 | mv output/eval/test.txt ${OUTDIR}/test.nocache 22 | ms_print ${OUTDIR}/massif.out.nocache |grep -v -e "[|-]" |sed -e 's/,//g' > ${OUTDIR}/massif.csv.nocache 23 | 24 | 25 | 26 | echo "test with cache" 27 | 28 | ${valgrindCache} python -m cProfile ../bin/mishkal-console.py -p -l ${LIMIT} -f samples/corpus/${FILE} >output/eval/test.txt 29 | echo "With Cache" >> output/eval/file.stats 30 | grep "function calls" -2 -h output/eval/test.txt | sed 's/^.*function .* in //g;s/:\*.*$//g' | sed 'N;s/\n//g' >> output/eval/file.stats 31 | echo "make archive" 32 | mv output/eval/test.txt ${OUTDIR}/test.cache 33 | ms_print ${OUTDIR}/massif.out.cache |grep -v -e "[|-]" |sed -e 's/,//g' > ${OUTDIR}/massif.csv.cache 34 | 35 | 36 | -------------------------------------------------------------------------------- /tests/tools/testAnalex.bat: -------------------------------------------------------------------------------- 1 | python testanalex.py -l 100 -f samples\vocalized\rndlines.txt >output\clause.rnd.txt -------------------------------------------------------------------------------- /tests/tools/testNumber.bat: -------------------------------------------------------------------------------- 1 | python testNumberVocalized.py -f samples\vocalized\rndlines.txt >output\number.rnd.txt -------------------------------------------------------------------------------- /tests/tools/test_tashkeel.bat: -------------------------------------------------------------------------------- 1 | python -m cProfile mishkal-console.py -l 10000 -f samples/Corpus/08.utf8.txt >output/08.10000.06.txt 2 | -------------------------------------------------------------------------------- /tests/tools/test_tashkeel.sh: -------------------------------------------------------------------------------- 1 | #python -m cProfile mishkla-console.py -f samples/Corpus/01.utf8.txt >output/Corpus/01.utf8.txt 2 | python mishkla-console.py -f samples/Corpus/01.utf8.txt >output/Corpus/01.txt 3 | python mishkla-console.py -f samples/Corpus/03.utf8.txt >output/Corpus/03.txt 4 | python mishkla-console.py -f samples/Corpus/06.utf8.txt >output/Corpus/06.txt 5 | python mishkla-console.py -f samples/Corpus/07.utf8.txt >output/Corpus/07.txt 6 | python mishkla-console.py -f samples/Corpus/08.utf8.txt >output/Corpus/08.txt 7 | python mishkla-console.py -f samples/Corpus_Shadda/01_Shadda.utf8.txt >output/Corpus_Shadda/01_Shaddav.txt 8 | python mishkla-console.py -f samples/Corpus_Shadda/03_Shadda.utf8.txt >output/Corpus_Shadda/03_Shadda.txt 9 | python mishkla-console.py -f samples/Corpus_Shadda/06_Shadda.utf8.txt >output/Corpus_Shadda/06_Shadda.txt 10 | python mishkla-console.py -f samples/Corpus_Shadda/07_Shadda.utf8.txt >output/Corpus_Shadda/07_Shadda.txt 11 | python mishkla-console.py -f samples/Corpus_Shadda/08_Shadda.utf8.txt >output/Corpus_Shadda/08_Shadda.txt 12 | -------------------------------------------------------------------------------- /tests/tools/test_tashkeelAlecso.sh: -------------------------------------------------------------------------------- 1 | #python -m cProfile mishkla-console.py -f samples/Corpus/01.utf8.txt >output/Corpus/01.utf8.txt 2 | python mishkla-console.py -f samples/Corpus/01.utf8.txt >output/Corpus/01.txt 3 | python mishkla-console.py -f samples/Corpus/03.utf8.txt >output/Corpus/03.txt 4 | python mishkla-console.py -f samples/Corpus/06.utf8.txt >output/Corpus/06.txt 5 | python mishkla-console.py -f samples/Corpus/07.utf8.txt >output/Corpus/07.txt 6 | python mishkla-console.py -f samples/Corpus/08.utf8.txt >output/Corpus/08.txt 7 | python mishkla-console.py -f samples/Corpus_Shadda/01_Shadda.utf8.txt >output/Corpus_Shadda/01_Shaddav.txt 8 | python mishkla-console.py -f samples/Corpus_Shadda/03_Shadda.utf8.txt >output/Corpus_Shadda/03_Shadda.txt 9 | python mishkla-console.py -f samples/Corpus_Shadda/06_Shadda.utf8.txt >output/Corpus_Shadda/06_Shadda.txt 10 | python mishkla-console.py -f samples/Corpus_Shadda/07_Shadda.utf8.txt >output/Corpus_Shadda/07_Shadda.txt 11 | python mishkla-console.py -f samples/Corpus_Shadda/08_Shadda.utf8.txt >output/Corpus_Shadda/08_Shadda.txt 12 | -------------------------------------------------------------------------------- /tests/tools/test_tashkeelCompare.bat: -------------------------------------------------------------------------------- 1 | rem Copy date and time to the single variable as separated by the single whitespace 2 | rem Skip incorrectness in time earlier than 10:00 - replace of leading whitespaces with '0' 3 | set now=%DATE: =0% %TIME: =0% 4 | 5 | rem The %now% variable consists of the string like this "03.10.2009 16:04:58,40" 6 | rem Disassemble date and time on parts 7 | for /f "tokens=1-7 delims=/-:., " %%a in ( "%now%" ) do ( 8 | rem Define your owned delimiters and order of tokens 9 | set now=%%c%%b%%a_%%d%%e 10 | ) 11 | cd .. 12 | python -m cProfile mishkal-console.py -c -l 10 -f samples/vocalized/rndlines.txt >output/compare/rndlines.11.txt 13 | copy output\compare\rndlines.11.txt output\compare\%now%.txt 14 | 15 | cd tools -------------------------------------------------------------------------------- /tests/tools/test_tashkeelCompare.sh: -------------------------------------------------------------------------------- 1 | python -m cProfile mishkal-console.py -c -f samples/vocalized/rndlines.txt >output/compare/rndlines.11.txt 2 | 3 | -------------------------------------------------------------------------------- /tests/tools/test_tashkeelPhrase.bat: -------------------------------------------------------------------------------- 1 | rem Copy date and time to the single variable as separated by the single whitespace 2 | rem Skip incorrectness in time earlier than 10:00 - replace of leading whitespaces with '0' 3 | set now=%DATE: =0% %TIME: =0% 4 | 5 | rem The %now% variable consists of the string like this "03.10.2009 16:04:58,40" 6 | rem Disassemble date and time on parts 7 | for /f "tokens=1-7 delims=/-:., " %%a in ( "%now%" ) do ( 8 | rem Define your owned delimiters and order of tokens 9 | set now=%%c%%b%%a_%%d%%e 10 | ) 11 | cd .. 12 | python -m cProfile mishkal-console.py -c -f samples/phrases.txt >output/phrases.txt 13 | copy output\phrases.txt output\phrases\%now%.txt 14 | 15 | cd tools -------------------------------------------------------------------------------- /tests/tools/test_tashkeelPhrase.sh: -------------------------------------------------------------------------------- 1 | #rem The %now% variable consists of the string like this "03.10.2009 16:04:58,40" 2 | #rem Disassemble date and time on parts 3 | python -m cProfile mishkla-console.py -i -f samples/phrases.txt >output/phrases.txt 4 | 5 | -------------------------------------------------------------------------------- /tests/tools/testclause.bat: -------------------------------------------------------------------------------- 1 | python testSplitClause.py -f samples\vocalized\rndlines.txt >output\clause.rnd.txt -------------------------------------------------------------------------------- /tools/cleancache: -------------------------------------------------------------------------------- 1 | rm -r ./~/tmp/* 2 | rm -r tests/~/tmp/* 3 | 4 | -------------------------------------------------------------------------------- /tools/cleanpyc: -------------------------------------------------------------------------------- 1 | find ../ -name "*.pyc" -exec rm {} \; 2 | find ../ -name "*.class" -exec rm {} \; 3 | -------------------------------------------------------------------------------- /tools/mintiq: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Mintiq: Arabic Text to speech, by using espeak and Mishkal 3 | # 4 | # 5 | # 6 | voice=mb-ar1 7 | if [ -n "$1" ] 8 | then 9 | cd /opt/mishkal/tools 10 | python ../mishkal-console.py $1 | espeak -v $voice 11 | else 12 | read text; 13 | if [ -n "$text" ] 14 | then 15 | #echo "$text" 16 | cd /opt/mishkal/tools 17 | python ../mishkal-console.py $text | espeak -v $voice 18 | 19 | else 20 | espeak -v $voice " عُذْرَنْ ، أَدْخِلْ نَصْصَنْ ," 21 | fi 22 | fi 23 | exit 24 | -------------------------------------------------------------------------------- /tools/mintiq2: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Mintiq: Arabic Text to speech, by using espeak and Mishkal 3 | # 4 | # 5 | # 6 | mishkalpath=/workspace/projects/mishkal-2017-03-19 7 | voice=mb-ar1 8 | if [ -n "$1" ] 9 | then 10 | cd $mishkalpath 11 | python2.7 bin/mishkal-console.py $1 | espeak -v $voice 12 | else 13 | read text; 14 | if [ -n "$text" ] 15 | then 16 | #echo "$text" 17 | cd $mishkalpath 18 | python2.7 bin/mishkal-console.py $text | espeak -v $voice 19 | 20 | else 21 | espeak -v $voice " عُذْرَنْ ، أَدْخِلْ نَصْصَنْ ," 22 | fi 23 | fi 24 | exit 25 | -------------------------------------------------------------------------------- /tools/process_files.sh: -------------------------------------------------------------------------------- 1 | function get_diacritics { 2 | # change the path to mishkal-console.py according to your system 3 | mishkal_py="../bin/mishkal-console.py" 4 | input_file=${1} 5 | output_dir=${2} 6 | out_name=$(basename ${input_file}) 7 | printf "processing %s\n" ${input_file} 8 | py -2.7 ${mishkal_py} -f ${input_file} | grep '^ ' > ${output_dir}/${out_name} || pause 9 | } 10 | 11 | # change pathes according to your system 12 | oov_files="../input/lines_*.txt" 13 | out_dir="../output" 14 | 15 | for oov_file in ${oov_files} 16 | do 17 | get_diacritics ${oov_file} ${out_dir} 18 | done 19 | 20 | printf "done\n" 21 | -------------------------------------------------------------------------------- /tools/strip_lastmark.sh: -------------------------------------------------------------------------------- 1 | CHARS=$(python -c 'print u"\u064b\u064c\u064d\u064e\u064f\u0651\u0652".encode("utf8")') 2 | sed 's/['"$CHARS"']$//g' < $1 3 | -------------------------------------------------------------------------------- /tools/strip_tashkeel.sh: -------------------------------------------------------------------------------- 1 | CHARS=$(python -c 'print u"\u064b\u064c\u064d\u064e\u064f\u0651\u0652".encode("utf8")') 2 | sed 's/['"$CHARS"']//g' < $1 3 | -------------------------------------------------------------------------------- /tools/token_convert_to_csv.sh: -------------------------------------------------------------------------------- 1 | # convert wordlist vocalized with statistics 2 | # to csv and unvocalized, vocalized, stats 3 | # strip vowels from the first field 4 | #cat $1 | awk '{ x=$2; gsub(/[ًٌٍَُِّْ]/, "",x); print x "\t"$2"\t"$1}' | sort > "$1.csv" 5 | 6 | cat $1 | awk '{ x=$2; gsub(/[ًٌٍَُِّْ]/, "",x); print "u\'"x"\':u\'"$2"',#\t"$1}' | sort > "$1.csv" 7 | -------------------------------------------------------------------------------- /tools/tokenize.sh: -------------------------------------------------------------------------------- 1 | tr -s '[*!"#\$%&\(\)\+,\\\.\/:;،؛<=>\?@\[\\\\]^_`\{|\}~][:space:]]' '\n' < $1 | sort | uniq -c | sort -nr >$1.unq 2 | -------------------------------------------------------------------------------- /tools/tokenize_uniq.sh: -------------------------------------------------------------------------------- 1 | awk '{ 2 | gsub(/["*^&()#@$,?~]/,"") 3 | for(i=1;i<=NF;i++){ _[$i] } 4 | } 5 | END{ for(o in _){ print o } }' $1 6 | --------------------------------------------------------------------------------