diff options
author | Santhosh Thottingal <santhosh.thottingal@gmail.com> | 2009-03-26 22:14:43 +0530 |
---|---|---|
committer | Santhosh Thottingal <santhosh.thottingal@gmail.com> | 2009-03-26 22:14:43 +0530 |
commit | 02d0626ee9a64e4393db1e311f355ac5e0b041f5 (patch) | |
tree | 870e697bf5cfe77ee0812d3635d10be553080f15 /silpa | |
parent | 8ce8904c7366944801f426af20dec665a2f410cf (diff) | |
download | Rachana.git-02d0626ee9a64e4393db1e311f355ac5e0b041f5.tar.gz Rachana.git-02d0626ee9a64e4393db1e311f355ac5e0b041f5.tar.xz Rachana.git-02d0626ee9a64e4393db1e311f355ac5e0b041f5.zip |
changes fir plugin architecture
Diffstat (limited to 'silpa')
-rw-r--r-- | silpa/www/css/main.css | 288 | ||||
-rw-r--r-- | silpa/www/css/print.css | 51 | ||||
-rw-r--r-- | silpa/www/dot.png | bin | 0 -> 44493 bytes | |||
-rw-r--r-- | silpa/www/index.py | 33 | ||||
-rw-r--r-- | silpa/www/js/common.js | 21 | ||||
-rw-r--r-- | silpa/www/modules/__init__.py | 3 | ||||
-rw-r--r-- | silpa/www/modules/lemmatizer/__init__.py | 4 | ||||
-rw-r--r-- | silpa/www/modules/lemmatizer/lemmatizer.py | 121 | ||||
-rw-r--r-- | silpa/www/modules/lemmatizer/lemmatizer_ml.rules | 193 | ||||
-rw-r--r-- | silpa/www/silpa.conf | 20 | ||||
-rw-r--r-- | silpa/www/templates/__init__.py | 3 | ||||
-rw-r--r-- | silpa/www/templates/default/silpa.html | 119 | ||||
-rw-r--r-- | silpa/www/templates/template.py | 124 | ||||
-rw-r--r-- | silpa/www/utils/__init__.py | 4 | ||||
-rw-r--r-- | silpa/www/utils/langdetect.py | 76 |
15 files changed, 1060 insertions, 0 deletions
diff --git a/silpa/www/css/main.css b/silpa/www/css/main.css new file mode 100644 index 0000000..70658e6 --- /dev/null +++ b/silpa/www/css/main.css @@ -0,0 +1,288 @@ +/*
+LEGAL
+=====
+Copyright: Daemon Pty Limited 2006, http://www.daemon.com.au
+Community: Mollio http://www.mollio.org $
+License: Released Under the "Common Public License 1.0",
+http://www.opensource.org/licenses/cpl.php
+License: Released Under the "Creative Commons License",
+http://creativecommons.org/licenses/by/2.5/
+License: Released Under the "GNU Creative Commons License",
+http://creativecommons.org/licenses/GPL/2.0/
+*/
+
+/* THE BIG GUYS */
+* {margin:0;padding:0}
+body {padding: 0 0 20px;background: #fff url("images/body_bg.gif") repeat-x 0 100%;color:#333;font:83%/1.5 arial,tahoma,verdana,sans-serif}
+
+/* LINKS */
+a,a:link,a:link,a:link,a:hover {background:transparent;text-decoration:underline;cursor:pointer}
+a:link {color:#c00}
+a:visited {color:#999}
+a:hover,a:active {color:#069}
+
+/* FORMS */
+form {margin: 0 0 1.5em}
+input {font-family: arial,tahoma,verdana,sans-serif;margin: 2px 0}
+fieldset {border: none}
+label {display:block;padding: 5px 0}
+label br {clear:left}
+
+ /* FORMS - general classes */
+ input.f-submit {padding: 1px 3px;background:#666;color:#fff;font-weight:bold;font-size:96%}
+
+ /* FORMS - f-wrap-1 - simple form, headings on left, form elements on right */
+ form.f-wrap-1 {width:100%;padding: .5em 0;background: #f6f6f6 url("images/featurebox_bg.gif") no-repeat 100% 100%;border-top: 1px solid #d7d7d7;position:relative}
+ form.f-wrap-1 fieldset {width:auto;margin: 0 1em}
+ form.f-wrap-1 h3 {margin:0 0 .6em;font: bold 155% arial;color:#c00}
+ form.f-wrap-1 label {clear:left;float:left;width:100%;border-top: 1px solid #fff}
+
+ /* hide from IE mac \*/
+ form.f-wrap-1 label {float:none}
+ /* end hiding from IE5 mac */
+
+ form.f-wrap-1 label input, form.f-wrap-1 label textarea, form.f-wrap-1 label select {width:15em;float:left;margin-left:10px}
+
+ form.f-wrap-1 label b {float:left;width:8em;line-height: 1.7;display:block;position:relative}
+ form.f-wrap-1 label b .req {color:#c00;font-size:150%;font-weight:normal;position:absolute;top:-.1em;line-height:1;left:-.4em;width:.3em;height:.3em}
+ form.f-wrap-1 div.req {color:#666;font-size:96%;font-weight:normal;position:absolute;top:.4em;right:.4em;left:auto;width:13em;text-align:right}
+ form.f-wrap-1 div.req b {color:#c00;font-size:140%}
+ form.f-wrap-1 label select {width: 15.5em}
+ form.f-wrap-1 label textarea.f-comments {width: 20em}
+ form.f-wrap-1 div.f-submit-wrap {padding: 5px 0 5px 8em}
+ form.f-wrap-1 input.f-submit {margin: 0 0 0 10px}
+
+ form.f-wrap-1 fieldset.f-checkbox-wrap, form.f-wrap-1 fieldset.f-radio-wrap {clear:left;float:left;width:32em;border:none;margin:0;padding-bottom:.7em}
+ form.f-wrap-1 fieldset.f-checkbox-wrap b, form.f-wrap-1 fieldset.f-radio-wrap b {float:left;width:8em;line-height: 1.7;display:block;position:relative;padding-top:.3em}
+ form.f-wrap-1 fieldset.f-checkbox-wrap fieldset, form.f-wrap-1 fieldset.f-radio-wrap fieldset {float:left;width:13em;margin: 3px 0 0 10px}
+ form.f-wrap-1 fieldset.f-checkbox-wrap label, form.f-wrap-1 fieldset.f-radio-wrap label {float:left;width:13em;border:none;margin:0;padding:2px 0;margin-right:-3px}
+ form.f-wrap-1 label input.f-checkbox, form.f-wrap-1 label input.f-radio {width:auto;float:none;margin:0;padding:0}
+
+ form.f-wrap-1 label span.errormsg {position:absolute;top:0;right:-10em;left:auto;display:block;width:16em;background: transparent url(images/errormsg_bg.gif) no-repeat 0 0}
+ form.f-wrap-1 label span.errormsg b {padding: 10px 0;margin: 0 10px 0 30px;color:#B30800;font-weight:bold;display:block;width:auto;float:none;line-height:1.3}
+
+/* TYPOGRAPHY */
+p, ul, ol {margin: 0 0 1.5em}
+h1, h2, h3, h4, h5, h6 {letter-spacing: -1px;font-family: arial,verdana,sans-serif;margin: 1.2em 0 .3em;color:#000;border-bottom: 1px solid #eee;padding-bottom: .1em}
+h1 {font-size: 196%;margin-top:.6em}
+h2 {font-size: 136%}
+h3 {font-size: 126%}
+h4 {font-size: 116%}
+h5 {font-size: 106%}
+h6 {font-size: 96%}
+.highlight {color:#E17000}
+.subdued {color:#999}
+.error {color:#c00;font-weight:bold}
+.success {color:#390;font-weight:bold}
+.caption {color:#999;font-size:11px}
+.date {font: bold 82% arial;color:#bbb;display:block;letter-spacing: 1px}
+small {font-size:11px}
+
+/* LISTS */
+ul {margin: .3em 0 1.5em 0;list-style-type:none}
+ ul.related {margin-top: -1em}
+ol {margin: .5em .5em 1.5em}
+ol li {margin-left: 1.4em;padding-left: 0;background: none; list-style-type: decimal}
+li {line-height: 1.4em;padding-left: 25px;background: transparent url("images/sprites.gif") no-repeat 0 0}
+li.doc {background-position: 3px -500px}
+ul.nomarker li {background:none;padding-left:0}
+
+dl {margin: 0 0 1em 0}
+dt {font-weight:bold;margin-top: 1.3em}
+dl dl {margin: 0 0 1.5em 30px}
+
+/* GENERAL */
+img {border:none}
+hr {margin: 1em 0;background:#f2f2f2;height:1px;color:#f2f2f2;border:none;clear:both}
+.clear {clear:both;position:relative;font-size:0px;height:0px;line-height:0px}
+
+/* LAYOUT - HEADER */
+#header {background: #666 url("images/sprites.gif") repeat-x 0 100%;margin: 0 0 25px;padding: 0 0 8px}
+
+ #header #site-name {font: 265% arial;letter-spacing: -.05em;margin:0 0 0 40px;padding:3px 0;color:#ccc;border:none}
+
+ /* NAV - top horizontal nav */
+ #nav, #nav ul {padding: 0;margin: 0;list-style: none}
+ #nav {font-weight:bold;height:2.09em;font: bold 96% arial;margin: 0 105px 0 40px}
+ #nav li {position:relative;background: #999;float: left;width: 10em;display:block;margin: 0;border-bottom: 3px solid #666;border-right: 3px solid #252525;padding:0}
+ #nav a, #nav a:link, #nav a:visited, #nav a:hover, #nav a:active {text-decoration:none;cursor:pointer;color:#fff;display: block;padding: 4px 10px 2px}
+ #nav a:hover {color:#000}
+
+ #nav li ul {border-left: 1px solid #c00;background: #f6f6f6 url("images/featurebox_bg.gif") no-repeat 100% 100%;width:15.8em;font-size:90%;margin-top:3px;position: absolute;font-weight:normal;left: -999em}
+ #nav li:hover ul, #nav li.sfhover ul {left: 0;z-index:99999}
+
+ #nav li li {background:none;float:none;border:none;border: 1px solid #999;border-top:1px solid #fff;border-right:none;border-left:none;padding-left:0}
+ #nav li li.last {border-bottom:none}
+ #nav li li a, #nav li li a:link, #nav li li a:visited, #nav li li a:hover {color:#000;padding: 3px 10px 2px;width:14em}
+ #nav li li a:hover {color:#fff;background:#c00}
+
+ #nav li.active {background: #c00;border-bottom: 3px solid #c00}
+ #nav li.active ul {border:none;background: #c00 url("images/featurebox2_bg.gif") no-repeat 100% 100%}
+ #nav li.active a:link, #nav li.active a:visited, #nav li.active a:hover, #nav li.active a:active {}
+ #nav li.active a:hover {color:#000}
+
+ #nav li.active li {border:none;border-top: 1px solid #c15c5c;border-bottom: 1px solid #870000}
+ #nav li.active li.last {border-bottom: none}
+ #nav li.active li a:link, #nav li.active li a:visited, #nav li.active li a:hover, #nav li.active li a:active {color:#fff}
+ #nav li.active li a:hover {background: #666 url("images/sprites.gif") repeat-x 0 99%;color:#fff}
+
+ #nav li.active li.active a:link, #nav li.active li.active a:visited, #nav li.active li.active a:hover, #nav li.active li.active a:active {color:#fff;font-weight:bold;background: #666 url("images/sprites.gif") repeat-x 0 99%}
+
+ /* hide from IE mac \*/
+ #nav li {width:auto}
+ /* end hiding from IE5 mac */
+
+ /* SEARCH */
+ #search {color:#fff;font-weight:bold;position:absolute;top:10px;right:110px;left:auto;width:18em}
+ #search form {margin:0}
+ #search input {width:8em;margin: 0 0 -1px;height:1.2em}
+ #search label {padding:5px 0 0;display:inline}
+ #search input.f-submit {width:auto;font-size:81%;margin:0 0 -.15em;height:1.95em}
+
+ /* POWERED BY - mollio logo in this case */
+ #poweredby {width:96px;height:63px;position:absolute;top:-102px;right:0}
+
+/* LAYOUT - main body of page */
+#wrap {min-width:770px;max-width:1200px;margin: 0 auto;position:relative}
+#content-wrap {position:relative;width:100%}
+ #utility {position:absolute;top:0;left:25px;width:165px;border-top: 5px solid #999;padding-bottom: 40px}
+ #sidebar {position:absolute;top:0;right:25px;width:20%;border-top: 5px solid #999;padding-top: 1px;padding-bottom: 40px}
+
+#content {margin: 0 50px}
+ #content #breadcrumb {margin-top:-5px;font-size:93%;font-weight:bold}
+ #content #breadcrumb a:link, #content #breadcrumb a:visited {text-decoration:none}
+ #content #breadcrumb a:hover, #content #breadcrumb a:active {text-decoration:underline}
+
+ .featurebox {color:#333;padding: 15px 20px 20px;border-top: 1px solid #d7d7d7;margin: 0 0 1.5em;background: #f6f6f6 url("images/featurebox_bg.gif") no-repeat 100% 100%}
+ .featurebox p, .featurebox h1, .featurebox h2, .featurebox h3, .featurebox h4, .featurebox h5, .featurebox h6 {margin: 0 0 .3em;border-bottom: 1px solid #c00;color:#c00}
+ .featurebox p {border:none;margin: 0 0 1em;color:#444}
+ .featurebox a {font-weight:bold}
+
+ .thumbnail {margin: 0 0 0 10px;position:relative;z-index:9999;border: 1px solid #eee;float:right;width:100px;padding:5px;background:#fff}
+ .thumbnail img {border: 1px solid #000}
+
+ .pagination {background: #f2f2f2;color:#666;padding: 4px 2px 4px 7px;border: 1px solid #ddd;margin: 0 0 1.5em}
+ .pagination p {position:relative;text-align:right}
+ .pagination p a:link, .pagination p a:visited, .pagination p a:hover, .pagination p a:active {text-decoration:none;background:#fff;padding:2px 5px;border: 1px solid #ccc}
+ .pagination p a:hover {background:#c00;color:#fff}
+ .pagination p span {text-decoration:none;background:#fff;padding:2px 5px;border: 1px solid #ccc;color:#ccc}
+ .pagination * {margin:0}
+ .pagination h4 {margin-top:-1.45em;padding:0;border:none}
+
+ #resultslist-wrap {margin: 0 0 1.5em;font-size:92%}
+ #resultslist-wrap dt, #resultslist-wrap dl {margin: 0}
+ #resultslist-wrap dt {font: bold 85% arial;padding: 3px 0}
+ #resultslist-wrap li {padding: 0 0 1em;margin:0 0 0 1.2em;font: bold 145% arial}
+ #resultslist-wrap li dd {font: normal 73% arial}
+ #resultslist-wrap li dl {margin:0}
+ #resultslist-wrap dd {line-height:1.3}
+ #resultslist-wrap dd.filetype, #resultslist-wrap dd.date {color:#999;display:inline;padding-right:.5em}
+
+ /* TABLES */
+ .table1 {border: 2px solid #900;border-collapse:collapse;width:100%}
+ .table1 td {background: #fff url("images/sprites.gif") repeat-x 0 -1600px;padding:3px;border: 1px solid #fff}
+ .table1 th {text-align:left;border: 1px solid #fff}
+ .table1 thead th {color:#fff;font-size:145%;background: #900 url("images/sprites.gif") repeat-x 0 -1300px;padding: 10px 6px}
+ .table1 tbody th {color:#fff;font-size:115%;background: #88b8db url("images/sprites.gif") repeat-x 0 -1400px;padding: 6px}
+ .table1 tbody th.sub {font-size:100%;color:#000;background: #efefef url("images/sprites.gif") repeat-x 0 -1500px;padding: 6px}
+
+ /* TABLES - calendar */
+ .calendar {width:200px;font-size:92%}
+ .calendar td {text-align:center;border: 1px solid #ddd}
+ .calendar th {text-align:center}
+ .calendar thead th {padding: 3px 2px}
+ .calendar tbody th {padding: 2px}
+ .calendar tbody th.sub {padding: 2px}
+
+ /* 'MORE' LINK - provides an accessible alternative to just using 'more' as a link at the end of paragraphs */
+ a.morelink:link, a.morelink:visited, a.morelink:hover, a.morelink:active {background: transparent url("images/sprites.gif") no-repeat 5px -500px;padding-left:21px}
+ a.morelink:hover {background: transparent url("images/sprites.gif") 5px -400px}
+ .morelink span {position:absolute;left:-9999px;width:900px}
+
+ /* CODE - formatting for code inserted into body - more here: http://dizque.lacalabaza.net/temp/lipt/ */
+ ol.code {font-family: monospace;position:relative}
+ ol.code li {color: #666;margin-bottom: 1px}
+ ol.code code {color: #000;display: block}
+ ol.code .cmt {color: #4077d2}
+ li.tab0 code {padding-left: 4em}
+ li.tab1 code {padding-left: 8em}
+ li.tab2 code {padding-left: 12em}
+ li.tab3 code {padding-left: 16em}
+ li.tab4 code {padding-left: 20em}
+ li.tab5 code {padding-left: 24em}
+ ol.code li {background: #f3f3f3 url("images/td_bg.gif") no-repeat 100% 100%}
+ p.note {margin: 1em;border: 1px solid #ddd;background: #f0f0f0;padding: 1em}
+
+/* LAYOUT TYPE B */
+ #type-b #content-wrap {background: transparent url("images/content_wrap_bg.gif") repeat-y 30px 0}
+ #type-b #content {margin: 0 23px 0 235px}
+
+/* LAYOUT TYPE C */
+ #type-c #content-wrap {background: transparent url("images/content_wrap_bg.gif") repeat-y 30px 0}
+ #type-c #content {margin: 0 25% 0 235px}
+
+/* LAYOUT TYPE D */
+ #type-d #content {margin: 0 25% 0 50px}
+
+/* LAYOUT TYPE E */
+ #type-e #content-wrap {background: transparent url("images/content_wrap_e_bg.gif") repeat-y 100% 0}
+ #type-e #utility {position:absolute;top:0;left:auto;right:25px;width:165px;border-top: 5px solid #999}
+ #type-e #content {margin: 0 243px 0 50px}
+
+/* LAYOUT TYPE F */
+ #type-f #content-wrap {background: transparent url("images/content_wrap_e_bg.gif") repeat-y 100% 0}
+ #type-f #content {margin: 0 235px 0 25%}
+ #type-f #utility {left:auto;right:25px}
+ #type-f #sidebar {right:auto;left:25px}
+
+/* SECONDARY NAVIGATION - vertical navigation */
+ #nav-secondary, #nav-secondary ul {position:static}
+ #nav-secondary, #nav-secondary li {list-style: none;margin:0;padding:0;background:#fff}
+ #nav-secondary {padding-top:0;border-top: 1px solid #ccc;margin-top: 1px}
+ #nav-secondary a {line-height:1.8;padding: 5px 0 5px 23px;background: #fff url("images/sprites.gif") no-repeat 10px -695px;font: bold 86% arial;display:block}
+ #nav-secondary a, #nav-secondary a:link, #nav-secondary a:visited, #nav-secondary a:hover, #nav-secondary a:active {text-decoration:none;cursor:pointer}
+ #nav-secondary a:link {color:#000}
+ #nav-secondary a:visited {color:#000}
+ #nav-secondary a:hover {color:#c00;background: #fee url("images/sprites.gif") no-repeat 10px -695px}
+ #nav-secondary li.active a:link, #nav-secondary li.active a:visited, #nav-secondary li.active a:hover, #nav-secondary li.active a:active {color:#c00}
+ #nav-secondary li {border-top: 1px solid #fff;border-bottom: 1px solid #ccc}
+
+/* SECONDARY NAVIGATION - 2nd TIER */
+ #nav-secondary ul {margin: 0 0 1em 23px;padding:0}
+ #nav-secondary li.active li a, #nav-secondary li.active li a:link, #nav-secondary li.active li a:visited {line-height:1.5;background: #fff url("images/sprites.gif") no-repeat 0 -798px;padding:0 0 0 12px;font-weight:normal;width:auto;color:#000;width:130px;display:block}
+ #nav-secondary li.active li a:hover, #nav-secondary li.active li a:active {color: #c00}
+ #nav-secondary li.active li {border: none;margin:0}
+
+ #nav-secondary li.active li.active a:link,
+ #nav-secondary li.active li.active a:visited,
+ #nav-secondary li.active li.active a:hover,
+ #nav-secondary li.active li.active a:active {font-weight:bold}
+
+/* SECONDARY NAVIGATION - 3rd TIER */
+ #nav-secondary ul ul {margin: 0 0 1em 13px;padding:0}
+ #nav-secondary li.active li.active li a, #nav-secondary li.active li.active li a:link, #nav-secondary li.active li.active li a:visited {width:117px}
+ #nav-secondary li.active li.active li a:link,
+ #nav-secondary li.active li.active li a:visited,
+ #nav-secondary li.active li.active li a:hover,
+ #nav-secondary li.active li.active li a:active {font-weight:normal}
+ #nav-secondary li.active li.active li.active a:link,
+ #nav-secondary li.active li.active li.active a:visited,
+ #nav-secondary li.active li.active li.active a:hover,
+ #nav-secondary li.active li.active li.active a:active {font-weight:bold}
+
+/* SECONDARY NAVIGATION - 4th TIER */
+ #nav-secondary ul ul ul {margin: 0 0 1em 13px;padding:0}
+ #nav-secondary li.active li.active li.active li a, #nav-secondary li.active li.active li.active li a:link, #nav-secondary li.active li.active li.active li a:visited {width:104px}
+ #nav-secondary li.active li.active li.active li a:link,
+ #nav-secondary li.active li.active li.active li a:visited,
+ #nav-secondary li.active li.active li.active li a:hover,
+ #nav-secondary li.active li.active li.active li a:active {font-weight:normal}
+ #nav-secondary li.active li.active li.active li.active a:link,
+ #nav-secondary li.active li.active li.active li.active a:visited,
+ #nav-secondary li.active li.active li.active li.active a:hover,
+ #nav-secondary li.active li.active li.active li.active a:active {font-weight:bold}
+
+/* LAYOUT - FOOTER */
+#footer {clear:both;border-top: 1px solid #E3E8EE;padding: 10px 0 30px;font-size:86%;color:#999}
+ #footer p {margin:0}
+ #footer a:link {color:#999}
diff --git a/silpa/www/css/print.css b/silpa/www/css/print.css new file mode 100644 index 0000000..c15f500 --- /dev/null +++ b/silpa/www/css/print.css @@ -0,0 +1,51 @@ +/*
+LEGAL
+=====
+Copyright: Daemon Pty Limited 2006, http://www.daemon.com.au
+Community: Mollio http://www.mollio.org $
+License: Released Under the "Common Public License 1.0",
+http://www.opensource.org/licenses/cpl.php
+License: Released Under the "Creative Commons License",
+http://creativecommons.org/licenses/by/2.5/
+License: Released Under the "GNU Creative Commons License",
+http://creativecommons.org/licenses/GPL/2.0/
+*/
+
+
+body {font: 10pt arial,tahoma,verdana,sans-serif}
+h1, h2, h3, h4, h5, h6 {margin: 1em 0 .2em;font-family: arial,tahoma,verdana,sans-serif}
+
+* {float:none;position:static;width:auto;background:#fff}
+p {margin: 0 0 1em}
+img {border:none;display:block;margin: .5em 0}
+dt {font-weight:bold}
+
+#nav, #search, #nav-secondary, #breadcrumb, #poweredby {display:none}
+
+/* =LINKS */
+a {border:none}
+a,a:link,a:link,a:link,a:hover {background:transparent;text-decoration:underline;cursor:pointer}
+a:link {color:#5291c4}
+a:visited {color:#666}
+a:hover {color:#ff9900;border:none}
+a:active {color:#0066cc}
+
+.teaserBox {clear:both;margin: 0 0 1em}
+
+.sponsors img {margin: .5em 0}
+
+#footer {margin: 1em 0}
+
+#header {border-bottom: 3px solid #c00}
+
+/* TABLES */
+table {font-size: 9pt;margin: 0 0 1em;border-collapse:collapse}
+ table th {border-bottom: 3px solid #000;vertical-align:top;padding: 1.5em 3px 3px;line-height:1.1;font: bold 145% arial;letter-spacing:0;text-align:left}
+ .table1 th.time {border-bottom: none;font: bold 89% verdana;color:#ff9c00;vertical-align:top;padding: 3px}
+ .table1 td {border: 1px solid #ddd;font-size: 9pt;padding: 3px;vertical-align:top}
+ .table1 td a {display:block;width:auto;font-weight:bold}
+ .table1 td a:link, .table1 td a:visited, .table1 td a:hover, .table1 td a:active {border:none;text-decoration:none}
+ .table1 th.sub {background: #aaa}
+ .table1 th.sub2 {background: #bbb;color:#000}
+ .table1 td ul li {background: #fff}
+
diff --git a/silpa/www/dot.png b/silpa/www/dot.png Binary files differnew file mode 100644 index 0000000..69a000b --- /dev/null +++ b/silpa/www/dot.png diff --git a/silpa/www/index.py b/silpa/www/index.py new file mode 100644 index 0000000..edf0582 --- /dev/null +++ b/silpa/www/index.py @@ -0,0 +1,33 @@ +#! /usr/bin/env python +# -*- coding: utf-8 -*- + +from common import * +from utils import * +import traceback +import cgitb +import cgi +cgitb.enable() +def index(form): + if(form.has_key('action')): + action=form['action'].value + else: + action=None + response=SilpaResponse() + if(action): + module_manager=ModuleManager() + module_instance = module_manager.getModuleInstance(action) + if(module_instance): + response.setBreadcrumb(module_instance.get_module_name()) + response.setContent(module_instance.process(form)) + response.setErrorMessage(module_instance.get_errormessage()) + response.setSuccessMessage(module_instance.get_successmessage()) + else: + response.setBreadcrumb("Coming Soon") + response.setErrorMessage("Module not available") + response.setContent(None) + response.setSuccessMessage(None) + return response.toString(); + +if __name__ == '__main__': + print "Content-Type: text/html\n\n" + print index(cgi.FieldStorage()).encode('utf-8') diff --git a/silpa/www/js/common.js b/silpa/www/js/common.js new file mode 100644 index 0000000..40ab87e --- /dev/null +++ b/silpa/www/js/common.js @@ -0,0 +1,21 @@ +/*
+son of suckerfish menu script from:
+http://www.htmldog.com/articles/suckerfish/dropdowns/
+ */
+
+ sfHover = function() {
+ var sfEls = document.getElementById("nav").getElementsByTagName("LI");
+ for (var i=0; i<sfEls.length; i++) {
+ sfEls[i].onmouseover=function() {
+ this.className+=" sfhover";
+ this.style.zIndex=200; //this line added to force flyout to be above relatively positioned stuff in IE
+ }
+ sfEls[i].onmouseout=function() {
+ this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
+ }
+ }
+}
+if (window.attachEvent) window.attachEvent("onload", sfHover);
+
+
+
diff --git a/silpa/www/modules/__init__.py b/silpa/www/modules/__init__.py new file mode 100644 index 0000000..a436dc9 --- /dev/null +++ b/silpa/www/modules/__init__.py @@ -0,0 +1,3 @@ +#! /usr/bin/env python +# -*- coding: utf-8 -*- +from lemmatizer import * diff --git a/silpa/www/modules/lemmatizer/__init__.py b/silpa/www/modules/lemmatizer/__init__.py new file mode 100644 index 0000000..3e77cd8 --- /dev/null +++ b/silpa/www/modules/lemmatizer/__init__.py @@ -0,0 +1,4 @@ +#! /usr/bin/env python +# -*- coding: utf-8 -*- +import lemmatizer + diff --git a/silpa/www/modules/lemmatizer/lemmatizer.py b/silpa/www/modules/lemmatizer/lemmatizer.py new file mode 100644 index 0000000..c1ca78f --- /dev/null +++ b/silpa/www/modules/lemmatizer/lemmatizer.py @@ -0,0 +1,121 @@ +#! /usr/bin/env python +# -*- coding: utf-8 -*- + +import sys +import codecs +import os +import string +import curses.ascii +from common import SilpaModule +class Lemmatizer(SilpaModule): + + def __init__(self): + self.rules_file = "./modules/lemmatizer/lemmatizer_ml.rules" + self.rulesDict = dict() + + def lemmatize(self, text): + result = "" + self.rulesDict = self.LoadRules() + words=text.split(" ") + word_count=len(words) + word_iter=0 + word="" + while word_iter < word_count: + word = words[word_iter] + word = self.trim(word) + word_length = len(word) + suffix_pos_itr = 2 + while suffix_pos_itr < word_length : + suffix = word[suffix_pos_itr:word_length] + if suffix in self.rulesDict: + word= word[0:suffix_pos_itr] + self.rulesDict[suffix] + break; + suffix_pos_itr = suffix_pos_itr+1 + word_iter = word_iter+1 + #print word + result = result + word + " " + return result + + def LoadRules(self): + print "Loading the rules..." + rules_dict = dict() + line = [] + line_number = 0 + rule_number = 0 + rules_file = codecs. open(self.rules_file,encoding='utf-8', errors='ignore') + while 1: + line_number = line_number +1 + text = unicode( rules_file.readline()) + if text == "": + break + if text[0] == '#': + continue #this is a comment - ignore + text = text.split("#")[0] #remove the comment part of the line + line_number = line_number +1 + line = text.strip() # remove unwanted space + if(line == ""): + continue + if(len(line.split("=")) != 2): + print "[Error] Syntax Error in the Rules. Line number: ", line_number + print "Line: "+ text + continue + lhs = line.split("=") [ 0 ] .strip() + rhs = line.split("=") [ 1 ] .strip() + if(len(rhs)>0): + if(lhs[0]=='"'): + lhs=lhs[1:len(lhs)] # if the string is "quoted" + if(lhs[len(lhs)-1]=='"'): + lhs=lhs[0:len(lhs)-1] # if the string is "quoted" + if(len(rhs)>0): + if(rhs[0]=='"'): + rhs=rhs[1:len(rhs)] # if the string is "quoted" + if(rhs[len(rhs)-1]=='"'): + rhs=rhs[0:len(rhs)-1] # if the string is "quoted" + rule_number=rule_number+1 + rules_dict[lhs]=rhs + #print "[", rule_number ,"] " +lhs + " : " +rhs + print "Found ",rule_number, " rules." + return rules_dict + + def trim(self,word): + punctuations=['~','!','@','#','$','%','^','&','*','(',')','-','+','_','=','{','}','|' ,':',';','<','>','\,','.','?'] + word=word.strip() + index=len(word)-1 + while index>0: + if word[index] in punctuations: + word=word[0:index] + else: + break + index=index-1 + return word + def process(self, form): + response = """ + <h2>Lemmatization</h2></hr> + <p>Enter the text for lemmatization in the below text area. + Language of each word will be detected. + You can give the text in any language and even with mixed language + </p> + <form action="" method="post"> + <textarea cols='100' rows='25' name='input_text' id='id1'>%s</textarea> + <input type="submit" id="Lemmatize" value="Lemmatize" name="action" style="width:12em;"/> + <input type="reset" value="Clear" style="width:12em;"/> + </br> + </form> + """ + if(form.has_key('input_text')): + text = action=form['input_text'].value .decode('utf-8') + response=response % text + result = self.lemmatize(text) + response = response+"<h2>Lemmatization Results</h2></hr>" + response = response+"<p>"+result+"</p>" + else: + response=response % "" + return response + +def getInstance(): + return Lemmatizer() +if __name__ == "__main__": + lemmatizer= Lemmatizer() + lemmatizer.rules_file="/home/santhosh/www/malayalam.map" + lemmatizer.lemmatize("മുദ്രാവാക്യവുമായി മുറ്റത്തില്") + diff --git a/silpa/www/modules/lemmatizer/lemmatizer_ml.rules b/silpa/www/modules/lemmatizer/lemmatizer_ml.rules new file mode 100644 index 0000000..5bfc40d --- /dev/null +++ b/silpa/www/modules/lemmatizer/lemmatizer_ml.rules @@ -0,0 +1,193 @@ +#Malayalam Prathyaya Rules +$min_root_length=1 +$iterations=1 +#അനുസ്വാരത്തിലവസാനിക്കുന്ന ക്രിയ/നാമം +ത്തില് = ം +ത്ത്=ം +ത്തു്=ം +ത്തു=ം +ത്തെ = ം +വുമായി = ം +ത്തിനെ=ം +ത്തിലെ=ം +ത്തിലേയ്ക്ക് =ം +ത്തിലേയ്ക്കു്= ം +ത്തേക്ക്=ം +ത്തിന്റെ=ം +ത്തേയ്ക്കു്=ം +ത്തിലായി= ം +മാക്കി=ം +മായും=ം +മെങ്കില്=ം എങ്കില് +വും=ം +മാണു് = ം ആണു് +മാണ്=ം ആണ് +മല്ല = ം അല്ല +മില്ല = ം ഇല്ല +മേ =ം +മാകാം = ം ആകാം +മായിരിക്കും=ം ആയിരിക്കുക +മുണ്ടായിരുന്നതായി=ം ഉണ്ടു് ആവുക +മുണ്ടായി=ം ഉണ്ടു് ആവുക +മുണ്ടായിരുന്ന=ം ഉണ്ടു് ആവുക +മുണ്ടായിരുന്നു=ം ഉണ്ടു് ആവുക +മുള്ള=ം ഉണ്ടാവുക +മോ = ം +മെ = ം +ങ്ങളില്= ം +ങ്ങള് = ം +ങ്ങളെ=ം +ങ്ങള്ക്ക്=ം +ങ്ങള്ക്കു്=ം +ുകള് = ു് +#ക്രിയകള് +യ്ക്കുന്ന = യ്ക്കുക +ക്കുന്ന = ക്കുക +#ചില്ലിലവസാനിക്കുന്ന നാമങ്ങള് +രില് = ര് +രാണു് = ര് ആണു് +രാണ് = ര് ആണ് +രല്ല = ര് അല്ല +രില്ല = ര് ഇല്ല +രുടെ = ര് +രുടേ = ര് +രു് = ര് +രെ = ര് +രോടു് = ര് +രൊടു് = ര് +രൊട് = ര് +രോട് = ര് +രാല് = ര് +രോ = ര് +രും=ര് +നില് = ന് +നാണു് = ന് ആണു് +നാണ്=ന് ആണ് +നല്ല = ന് അല്ല +നില്ല= ന് ഇല്ല +നുടെ = ന് +നുടേ= ന് +നോടു് = ന് +നോട് = ന് +നായി = ന് ആയി +നോ =ന് +നും=ന് +ലാണു്= ല് ആണു് +ലാണ് = ല് ആണ് +ലല്ല= ല് അല്ല +ലില്ല = ല് ഇല്ല +ലില് = ല് +ലിന്റെ = ല് +ലോട് = ല് +ലോടു് = ല് +ലായി=ല് ആയി +ലോ= ല് +ലും=ല് +ണാണു്= ണ് ആണു് +ണാണ് = ണ് ആണ് +ണിന്റെ = ണ് +ണല്ല = ണ് അല്ല +ണില്ല = ണ് ഇല്ല +ണോട് =ണ് +ണോടു = ണ് +ണോടു്= ണ് +ണോ= ണ് +ണും=ണ് +ളാണു്= ള് ആണു് +ളാണ്=ള് ആണ് +ളല്ല = ള് അല്ല +ളില്ല= ള് ഇല്ല +ളില്=ള് +ളോട് = ള് +ളോടു് =ള് +ളോടു = ള് +ളോ=ള് +ളുടെ =ള് +ളുടേ=ള് +ള്ക്കായി=ള് +ള്ക്കുള്ള =ള് ഉള്ള +ളും=ള് +#അ/ഇകാരത്തിലവസാനിക്കുന്ന നാമങ്ങള് +യില്= +യുടെ= +യെ= +യാണു്= +യിലുള്ള=യില് ഉള്ള +യാണ്= +യും= +യ്ക്ക് = +യ്ക്കു് = +യോ= +യായ= +യ്ക്കായി= +ക്കായി= +#ഉകാരത്തിലവസാനിക്കുന്ന നാമങ്ങള് +വിനെ= +വിന്റെ= +വിന്= +വിനു്= +വെ= +#് എന്നതിലവസാനിക്കുന്ന നാമങ്ങള് +ില്=ു് +ിനെ=ു് +ിന്റെ=ു് +യായി= +#അ/ഇകാരത്തിലവസാനിക്കുന്ന ക്രിയകള് +താണു്= +താണ്= +കള്= +യാകാന്=" ആകാന്" +യുള്ള=" ഉള്ള" +ീകരിച്ചതു്=ിയാക്കുക +#ഉകാരത്തിലവസാനിക്കുന്ന ക്രിയകള് +ുണ്ടായ= ു് ഉണ്ടായ +ുണ്ടാവുക= ു് ഉണ്ടാവുക +#ത്തുക എന്നതില് അവസാനിക്കുന്ന ക്രിയകള്= ഉണര്ത്തുക, പകര്ത്തുക +ത്താറുണ്ടു്= ത്തുക ഉണ്ടു് +ത്താറുണ്ട്= ത്തുക ഉണ്ടു് +ത്തിയിട്ടുണ്ടു്= ത്തുക ഉണ്ടു് +ത്തുയിട്ടുണ്ട്=ത്തുക ഉണ്ടു് +ത്തിയില്ല=ത്തുക ഇല്ല +ത്തുമോ=ത്തുക +ത്തി=ത്തുക +#തുക എന്നതില് അവസാനിക്കുന്ന ക്രിയകള് = കരുതുക. പൊരുതുക +തി=തുക +താറുണ്ടു്=തുക ഉണ്ടു് +താറുണ്ട്=തുക ഉണ്ടു് +തിയില്ല=തുക ഇല്ല +#ക്കുക എന്നതില് അവസാനിക്കുന്ന ക്രിയകള് = സഞ്ചരിക്കുക, ഉറക്കുക പറക്കുക +ക്കാന്=ക്കുക +ക്കാറാണു്= ക്കുക ആണു് +ക്കാറാണ്=ക്കുക ആണു് +ക്കി=ക്കുക +യ്ക്കാനായി=യ്ക്കാന് ആവുക +ക്കാനായി=ക്കാന് ആവുക +ച്ചു=യ്ക്കുക +ിച്ച്=ിയ്ക്കുക +ിച്ചു്=ിയ്ക്കുക +റന്നു്=റക്കുക +റന്ന്=റക്കുക +ന്നിട്ടുണ്ടു്=ക്കുക ഉണ്ടു് +ന്നിട്ടുണ്ട്=ക്കുക ഉണ്ടു് +#കുക എന്നതില് അവസാനിക്കുന്ന ക്രിയകള്= പടരുക, തുടരുക, വിടരുക +ര്ന്നു്=രുക +ര്ന്നു=രുക +ര്ന്നില്ല=രുക ഇല്ല +രാനായി=രുക ആവുക +രുന്നതിനു=രുക +ടരും=ടരുക +#ങ്ങുക എന്നതില് അവസാനിക്കുന്ന ക്രിയകള്=കറങ്ങുക +ങ്ങന്നതിനു്=ങ്ങുക +ക്കം=ക്കുക +#msc +യാണിവ=" ആണു് ഇവ" +യുള്ളവ=" ഉള്ള അവ" +യുള്ളതു്=" ഉള്ള അതു്" +ാക്കപ്പെടുന്ന=ു് ആക്കുക പെടുക" +ായിരിക്കും=" ു് ആയിരിക്കും" +യാണുണ്ടാവുക=" ഉണ്ടാവുക" +ളാണുള്ളത്="ള് ആണു് ഉള്ളതു്" +യുപയോഗിച്ചു്=ു് ഉപയോഗിക്കുക +ുപയോഗിച്ചു്=ു് ഉപയോഗിക്കുക +യുപയോഗിച്ച്=ു് ഉപയോഗിക്കുക +ുപയോഗിച്ച്=ു് ഉപയോഗിക്കുക diff --git a/silpa/www/silpa.conf b/silpa/www/silpa.conf new file mode 100644 index 0000000..826b806 --- /dev/null +++ b/silpa/www/silpa.conf @@ -0,0 +1,20 @@ +# Silpa configuration file +# This is a comment +# Global properties +SILPA_BASE_URL=http://planet.smc.org.in/exp/silpa/index.py +SILPA_TEMPLATE=./templates/default/silpa.html +SILPA_SITE_NAME=Silpa +SILPA_LANGUAGE=Silpa +SILPA_SITE_ADMIN_NAME=Santhosh +SILPA_SITE_ADMIN_EMAIL=santhosh@silpa.org +SILPA_SITE_COPYRIGHT= Copyright 2008-2009. Silpa Team. All rights Reserved. + +#Silpa Plugin Modules +#Format: action=module. For eg: +#Action names should be unique. and should be prefixed with "SILPA_ACTION." +#TO disable an action, comment out the line +#An example entry +#SILPA_ACTION.sort=modules.sort #comment at the end of line is also allowed +SILPA_ACTION.Lemmatize=modules.lemmatizer #Lemmatizer module for Indian Languages +SILPA_ACTION.Detect Language=utils #This is also a valid module +#End of Silpa configuration file diff --git a/silpa/www/templates/__init__.py b/silpa/www/templates/__init__.py new file mode 100644 index 0000000..8a966c5 --- /dev/null +++ b/silpa/www/templates/__init__.py @@ -0,0 +1,3 @@ +#! /usr/bin/env python +# -*- coding: utf-8 -*- +from base import * diff --git a/silpa/www/templates/default/silpa.html b/silpa/www/templates/default/silpa.html new file mode 100644 index 0000000..43a5b77 --- /dev/null +++ b/silpa/www/templates/default/silpa.html @@ -0,0 +1,119 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<!-- +Copyright: Daemon Pty Limited 2006, http://www.daemon.com.au +Community: Mollio http://www.mollio.org $ +License: Released Under the "Common Public License 1.0", +http://www.opensource.org/licenses/cpl.php +License: Released Under the "Creative Commons License", +http://creativecommons.org/licenses/by/2.5/ +License: Released Under the "GNU Creative Commons License", +http://creativecommons.org/licenses/GPL/2.0/ +--> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<title>Silpa- The Indian Language Computing project</title> +<link rel="stylesheet" type="text/css" href="css/main.css" media="screen" /> +<link rel="stylesheet" type="text/css" href="css/print.css" media="print" /> +<!--[if lte IE 6]> +<link rel="stylesheet" type="text/css" href="css/ie6_or_less.css" /> +<![endif]--> +<script type="text/javascript" src="js/common.js"></script> +</head> +<body id="type-f"> +<div id="wrap"> + + <div id="header"> + + <div id="site-name">Silpa</div> + <div id="search"> + <form action=""> + <label for="searchsite">Site Search:</label> + <input id="searchsite" name="searchsite" type="text" /> + <input type="submit" value="Go" class="f-submit" /> + </form> + </div> + + <ul id="nav"> + <li class="active"><a href="#">Home</a></li> + <li class="active"><a href="#">About</a> + </li> + <li class="active"><a href="#">Documentation</a> + <ul> + <li class="first"><a href="#">Language Detection</a></li> + + <li><a href="#">Spellcheck</a></li> + <li><a href="#">Text to Speech</a></li> + </ul> + </li> + <li class="active"><a href="#">Links</a> + <li class="active"><a href="#">License</a> + </ul> + + </div> + + <div id="content-wrap"> + + <div id="utility"> + + <ul id="nav-secondary"> + <li class="first"><a href="?action=Detect+Language">Language Detection</a></li> + <li><a href="?action=spellcheck">Spellcheck</a></li> + <li class="active"><a href="#">Font Conversion</a> + <ul> + <li class="first"><a href="?action=To+Unicode">Ascii to Unicode</a></li> + <li><a href="?action=To+Ascii">Unicode to Ascii</a></li> + </ul> + </li> + <li><a href="#">Lemmatizer</a></li> + <li><a href="#">Normalizer</a></li> + + <li class="last"><a href="#">Sort</a></li> + </ul> + </div> + + <div id="content"> + + <div id="breadcrumb"> + + $$SILPA_BREADCRUMB$$ + + </div> + <hr /> + + <div class="featurebox"> + <h3>Welcome to Silpa!</h3> + <p><strong>Silpa stands for Swathanthra Indian Language Processing Applications. Silpa is a single place in the web + where you can use the exising free(dom) software langauge processing applications easily. Silpa is in development and if you + are intersted in contributing just drop a mail to <a href="mailto:santhosh.thottingal@gmail.com">Santhosh</a> </p> + </div> + $$SILPA_ERROR$$ + $$SILPA_SUCCESS$$ + $$SILPA_CONTENT$$ + <div id="footer"> + <p>$$SILPA_COPYRIGHT$$</p> + <p><a href="#">Contact Us</a> | <a href="#">Privacy</a> | <a href="#">Links</a></p> + + </div> + + + <div id="sidebar"> + + <div class="featurebox"> + <h3>Welcome to Silpa!</h3> + <p><strong>Silpa stands for Swathanthra Indian Language Processing Applications. Silpa is a single place in the web + where you can use the exising free(dom) software langauge processing applications easily. Silpa is in development and if you + are intersted in contributing just drop a mail to <a href="mailto:santhosh.thottingal@gmail.com">Santhosh</a> </p> + </div> + + + </div> + + + <div id="poweredby"><a href="http://smc.org.in">SMC</a></div> + + </div> + +</div> +</body> +</html> diff --git a/silpa/www/templates/template.py b/silpa/www/templates/template.py new file mode 100644 index 0000000..00d6586 --- /dev/null +++ b/silpa/www/templates/template.py @@ -0,0 +1,124 @@ +#! /usr/bin/env python +# -*- coding: utf-8 -*- + +def getBaseHTML(): + content = """\ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<!-- +Copyright: Daemon Pty Limited 2006, http://www.daemon.com.au +Community: Mollio http://www.mollio.org $ +License: Released Under the "Common Public License 1.0", +http://www.opensource.org/licenses/cpl.php +License: Released Under the "Creative Commons License", +http://creativecommons.org/licenses/by/2.5/ +License: Released Under the "GNU Creative Commons License", +http://creativecommons.org/licenses/GPL/2.0/ +--> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<title>Silpa- The Indian Language Computing project</title> +<link rel="stylesheet" type="text/css" href="css/main.css" media="screen" /> +<link rel="stylesheet" type="text/css" href="css/print.css" media="print" /> +<!--[if lte IE 6]> +<link rel="stylesheet" type="text/css" href="css/ie6_or_less.css" /> +<![endif]--> +<script type="text/javascript" src="js/common.js"></script> +</head> +<body id="type-f"> +<div id="wrap"> + + <div id="header"> + + <div id="site-name">Silpa</div> + <div id="search"> + <form action=""> + <label for="searchsite">Site Search:</label> + <input id="searchsite" name="searchsite" type="text" /> + <input type="submit" value="Go" class="f-submit" /> + </form> + </div> + + <ul id="nav"> + <li class="active"><a href="#">Home</a></li> + <li class="active"><a href="#">About</a> + </li> + <li class="active"><a href="#">Documentation</a> + <ul> + <li class="first"><a href="#">Language Detection</a></li> + + <li><a href="#">Spellcheck</a></li> + <li><a href="#">Text to Speech</a></li> + </ul> + </li> + <li class="active"><a href="#">Links</a> + <li class="active"><a href="#">License</a> + </ul> + + </div> + + <div id="content-wrap"> + + <div id="utility"> + + <ul id="nav-secondary"> + <li class="first"><a href="?action=Detect+Language">Language Detection</a></li> + <li><a href="?action=spellcheck">Spellcheck</a></li> + <li class="active"><a href="#">Font Conversion</a> + <ul> + <li class="first"><a href="?action=To+Unicode">Ascii to Unicode</a></li> + <li><a href="?action=To+Ascii">Unicode to Ascii</a></li> + </ul> + </li> + <li><a href="#">Lemmatizer</a></li> + <li><a href="#">Normalizer</a></li> + + <li class="last"><a href="#">Sort</a></li> + </ul> + </div> + + <div id="content"> + + <div id="breadcrumb"> + + $$SILPA_BREADCRUMB$$ + + </div> + <hr /> + <div class="featurebox"> + <h3>Welcome to Silpa!</h3> + <p><strong>Silpa stands for Swathanthra Indian Language Processing Applications. Silpa is a single place in the web + where you can use the exising free(dom) software langauge processing applications easily. Silpa is in development and if you + are intersted in contributing just drop a mail to <a href="mailto:santhosh.thottingal@gmail.com">Santhosh</a> </p> + </div> + $$SILPA_CONTENT$$ + + + + <div id="sidebar"> + + <div class="featurebox"> + <h3>Welcome to Silpa!</h3> + <p><strong>Silpa stands for Swathanthra Indian Language Processing Applications. Silpa is a single place in the web + where you can use the exising free(dom) software langauge processing applications easily. Silpa is in development and if you + are intersted in contributing just drop a mail to <a href="mailto:santhosh.thottingal@gmail.com">Santhosh</a> </p> + </div> + + + </div> + + + <div id="poweredby"><a href="http://smc.org.in">SMC</a></div> + + </div> + +</div> +</body> +</html> + +""" + + return content + +if __name__ == '__main__': + print getBaseHTML() diff --git a/silpa/www/utils/__init__.py b/silpa/www/utils/__init__.py new file mode 100644 index 0000000..b7b55b1 --- /dev/null +++ b/silpa/www/utils/__init__.py @@ -0,0 +1,4 @@ +#! /usr/bin/env python +# -*- coding: utf-8 -*- +from silpautils import * +from langdetect import * diff --git a/silpa/www/utils/langdetect.py b/silpa/www/utils/langdetect.py new file mode 100644 index 0000000..a75ba15 --- /dev/null +++ b/silpa/www/utils/langdetect.py @@ -0,0 +1,76 @@ +# Spellchecker with language detection +# coding: utf-8 +# +# Copyright © 2008 Santhosh Thottingal +# Released under the GPLV3+ license + +from common import * + +class LangDetect(SilpaModule): + + def detect_lang(self, text): + words=text.split(" ") + word_count=len(words) + word_iter=0 + word="" + result_dict=dict() + while word_iter < word_count: + word=words[word_iter] + if(word): + length = len(word) + index = 0 + while index < length: + letter=word[index] + if ((letter >= u'ം') & (letter <=u'൯')): + result_dict[word]= "ml_IN" + if ((letter >= u'ঁ') & (letter <= u'৺')): + result_dict[word]= "bn_IN" + if ((letter >= u'ँ') & (letter <= u'ॿ')): + result_dict[word]= "hi_IN" + if ((letter >=u'ઁ') & (letter <= u'૱')): + result_dict[word]= "gu_IN" + if ((letter >= u'ਁ') & (letter <=u'ੴ')): + result_dict[word]= "pa_IN" + if ((letter >= u'ಂ') & (letter <=u'ೲ')): + result_dict[word]= "ka_IN" + if ((letter >= u'ଁ') & (letter <= u'ୱ')): + result_dict[word]= "or_IN" + if ((letter >=u'ஂ') & (letter <= u'௺')): + result_dict[word]= "ta_IN" + if ((letter >=u'ఁ') & (letter <= u'౯')): + result_dict[word]= "te_IN" + if ((letter <= u'z')): + result_dict[word]= "en_US" + + index=index+1 + word_iter=word_iter+1 + return result_dict + def process(self,form): + response = """ + <h2>Language Detection</h2></hr> + <p>Enter the text for detecting the language in the below text area. + Language of each word will be detected. + You can give the text in any language and even with mixed language + </p> + <form action="" method="post"> + <textarea cols='100' rows='25' name='input_text' id='id1'>%s</textarea> + <input type="submit" id="Detect Language" value="Detect Language" name="action" style="width:12em;"/> + <input type="reset" value="Clear" style="width:12em;"/> + </br> + </form> + """ + if(form.has_key('input_text')): + text = action=form['input_text'].value .decode('utf-8') + response=response % text + detected_lang_dict = self.detect_lang(text) + response = response+"<h2>Language Detection Results</h2></hr>" + response = response+"<table><th><td>Word</td><td>Language</td></th>" + for key in detected_lang_dict: + response = response+"<tr><td>"+key+"</td><td>"+detected_lang_dict[key]+"</td></tr>" + response = response+"</table> " + else: + response=response % "" + return response + +def getInstance(): + return LangDetect() |