ElixirFM-1.1/0000755001432400135600000000000011420132771011537 5ustar smrzufalElixirFM-1.1/bin/0000755001432400135600000000000011420132771012307 5ustar smrzufalElixirFM-1.1/bin/elixir-resolve.pl0000444001432400135600000000306111420132771015613 0ustar smrzufal#! perl -w BEGIN { our $VERSION = join '.', '1.1', q $Revision: 846 $ =~ /(\d+)/; use Getopt::Std; $Getopt::Std::STANDARD_HELP_VERSION = 1; our $options = {}; getopts('v', $options); warn $VERSION . "\n" and exit if exists $options->{'v'}; } BEGIN { warn "Initializing ...\n"; } use ElixirFM::Resolve; use strict; my $elixir = new ElixirFM::Resolve; warn "ElixirFM is now expecting your input!\n\n"; while (my $line = <>) { my @word = split ' ', undiacritize($line); print $elixir->pretty($elixir->resolve($_)), "\n\n" foreach @word; } warn "Quitting ...\n"; sub undiacritize { my $text = $_[0]; $text =~ tr[aiuo~`FNK][]d; return $text; } __END__ =head1 NAME elixir-resolve - Arabic morphological analyzer derived from ElixirFM =head1 REVISION $Revision: 846 $ $Date: 2009-04-22 22:25:47 +0200 (Wed, 22 Apr 2009) $ =head1 OPTIONS elixir-resolve [OPTIONS] -v --version show program's version --help show usage information =head1 SEE ALSO ElixirFM Project L Encode Arabic Project L =head1 AUTHOR Otakar Smrz C<< >>, L =head1 COPYRIGHT AND LICENSE Copyright (C) 2009-2005 Otakar Smrz, 2009 Viktor Bielicky, 2002 Tim Buckwalter This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 3. =cut ElixirFM-1.1/bin/elixir-column.pl0000444001432400135600000000423311420132771015433 0ustar smrzufal#! perl -w use ElixirFM; $/ = "\n:::: "; # provide the data of `elixir resolve --lists` while ($data = <>) { # process the data efficiently word by word $data = substr $data, 0, -5 if $data =~ /\n:::: $/; $data = ":::: " . $data unless $data =~ /^:::: /; $data = $data . "\n"; @text = ElixirFM::unpretty $data; # recover structured information foreach my $line (@text) { # the text is processed by lines foreach my $word (@{$line}) { # words delimited by whitespace my ($node, @data) = @{$word}; # $node is an array reference my $form = join "", @{$node}; # remember the form for reuse print $form . "\n" unless @data; # mention unrecognized words foreach my $data (@data) { # level of word tokenization my (undef, @data) = @{$data}; foreach my $data (@data) { # grouped by lexeme sequences my ($node, @data) = @{$data}; # $node contains lexeme refs my @lexs = @{$node}; # remember lexemes for reuse foreach my $data (@data) { # solution token sequences my ($node, @data) = @{$data}; # @data contains solutions print join "\t", $form, # input word ( join "", @{$node} ), # token forms ( join " ", map { $_->[0] } @data ), # token tags ( join " ", map { $_->[0] } @lexs ), # lexeme ids ( join " ", map { $_->[1] } @lexs ). # translation "\n"; } } } print ""; # separate input words } print "\n"; # separate input lines } } ElixirFM-1.1/bin/elixir-compose.pl0000444001432400135600000001010111420132771015572 0ustar smrzufal#! perl -w use Data::Dumper; $Data::Dumper::Indent = 0; $Data::Dumper::Terse = 1; use strict; our %hash = (); our %list = (); our %idx = (); print << 'PL'; package ElixirFM::Data::Compose; use Data::Dumper; $Data::Dumper::Indent = 0; $Data::Dumper::Terse = 1; use strict; warn "Generating dictionaries, please be patient ...\n"; open PM, '>' . (substr __FILE__, 0, -2) . 'pm'; select PM; print << 'PM'; package ElixirFM::Data::Compose; sub new { my $obj = bless {}, ref $_[0] || $_[0]; $obj->{'data'} = { PM our $data = {}; our $lexs = []; our $idx = 0; foreach my $lexeme (@{data()}) { push @{$lexs}, shift @{$lexeme}; for (my $i = 0; $i < @{$lexeme}; $i += 2) { unshift @{$lexeme->[$i + 1]}, $idx; push @{$data->{$lexeme->[$i]}}, $lexeme->[$i + 1]; } $idx++; } printf "%s\t=> %s,\n", Data::Dumper->Dump([$_]), Data::Dumper->Dump([$data->{$_}]) foreach keys %{$data}; print << 'PM'; }; $obj->{'lexs'} = [ PM printf "%s,\n", Data::Dumper->Dump([$_]) foreach @{$lexs}; print << 'PM'; ]; $obj->{'tags'} = [ PM printf "%s,\n", Data::Dumper->Dump([$_]) foreach @{tags()}; print << 'PM'; ]; $obj->{'tmpl'} = [ PM printf "%s,\n", Data::Dumper->Dump([$_]) foreach @{tmpl()}; print << 'PM'; ]; $obj->{'cont'} = [ PM printf "%s,\n", Data::Dumper->Dump([$_]) foreach @{cont()}; print << 'PM'; ]; return $obj; } 1; PM close PM; sub data { return [ PL sub Nothing () { return ''; } sub Just ($) { return $_[0]; } local $/ = ""; while (my $line = <>) { chomp $line; if ($line =~ /^\[/ and $line =~ /\]$/) { $line =~ s/\$/\\\$/g; my $data = eval $line; printf "[%s", Data::Dumper->Dump([$data->[0]]); for (my $i = 1; $i < @{$data}; $i += 2) { printf ",\n%s, [", Data::Dumper->Dump([$data->[$i]]); my %assoc = (); for (my $j = 0; $j < @{$data->[$i + 1]}; $j += 2) { my @accum = (); for (my $k = 0; $k < @{$data->[$i + 1][$j + 1]}; $k += 2) { my $tmpl = Data::Dumper->Dump([$data->[$i + 1][$j + 1][$k]]); my $tags = Data::Dumper->Dump([$data->[$i + 1][$j + 1][$k + 1]]); $hash{'tmpl'}{$tmpl} = $idx{'tmpl'}++ unless exists $hash{'tmpl'}{$tmpl}; $hash{'tags'}{$tags} = $idx{'tags'}++ unless exists $hash{'tags'}{$tags}; push @accum, $hash{'tmpl'}{$tmpl}, $hash{'tags'}{$tags}; } $assoc{join ", ", @accum} = [] unless exists $assoc{join ", ", @accum}; push @{$assoc{join ", ", @accum}}, $data->[$i + 1][$j]; } print join ",", map { my $cont = Data::Dumper->Dump([$assoc{$_}]); $hash{'cont'}{$cont} = $idx{'cont'}++ unless exists $hash{'cont'}{$cont}; sprintf "\n\t[%s],\t%s", $_, $hash{'cont'}{$cont} } sort { $assoc{$a}[0] cmp $assoc{$b}[0] } keys %assoc; print "\t]"; } print "],\n\n"; } } print << 'PL'; ] } sub tags { return [ PL foreach my $one (keys %{$hash{'tags'}}) { my $dat = eval $one; for (my $i = 0; $i < @{$dat}; $i += 3) { push @{$list{'tags'}[$hash{'tags'}{$one}]}, [ @{$dat}[$i + 2, $i, $i + 1] ]; } } for (my $i = 0; $i < @{$list{'tags'}}; $i++) { printf "# %d\n", $i; printf "[%s],\n\n", join ",\n ", map { Data::Dumper->Dump([$_]) } @{$list{'tags'}[$i]}; } print << 'PL'; ] } sub tmpl { return [ PL foreach my $one (keys %{$hash{'tmpl'}}) { $list{'tmpl'}[$hash{'tmpl'}{$one}] = eval $one; } for (my $i = 0; $i < @{$list{'tmpl'}}; $i++) { printf "# %d\n", $i; printf "%s,\n\n", Data::Dumper->Dump([$list{'tmpl'}[$i]]); } print << 'PL'; ] } sub cont { return [ PL foreach my $one (keys %{$hash{'cont'}}) { $list{'cont'}[$hash{'cont'}{$one}] = eval $one; } for (my $i = 0; $i < @{$list{'cont'}}; $i++) { printf "# %d\n", $i; printf "%s,\n\n", Data::Dumper->Dump([$list{'cont'}[$i]]); } print << 'PL'; ] } 1; PL ElixirFM-1.1/cgi/0000755001432400135600000000000011420132771012301 5ustar smrzufalElixirFM-1.1/cgi/elixir/0000755001432400135600000000000011420132771013575 5ustar smrzufalElixirFM-1.1/cgi/elixir/index.fcgi0000555001432400135600000000116211420132771015537 0ustar smrzufal#!/usr/bin/perl # ###################################################################### Otakar Smrz, 2007/10/05 # # ElixirFM ##################################################################################### # $Id: index.fcgi 602 2008-07-07 09:52:29Z smrz $ our $VERSION = join '.', '1.1', q $Revision: 662 $ =~ /(\d+)/; use lib '/home/smrz/lib/perl5/site_perl/5.10.0', '/home/smrz/lib/perl5/5.10.0', '/home/smrz/lib/perl5/site_perl/5.10.0/i386-linux-thread-multi', '/home/smrz/lib/perl5/site_perl/5.10.0/i386-linux-thread-multi/auto'; use ElixirFM::CGI; our $cgi = new ElixirFM::CGI; $cgi->run(); ElixirFM-1.1/css/0000755001432400135600000000000011420132771012327 5ustar smrzufalElixirFM-1.1/css/elixir.js0000444001432400135600000000151511420132771014161 0ustar smrzufalfunction elixirYamli (n) { var elem = document.getElementsByName("mode"); var mode = elem.length > 0 ? elem[0].value : 'home'; if (mode == 'resolve' || mode == 'lookup') { var code = document.getElementsByName("code"); for (var i = 0; i < code.length; i++) { if (code[i].checked) { if (code[i].value == 'ArabTeX' || code[i].value == 'Buckwalter') { Yamli.deyamlify('text'); } else { Yamli.yamlify('text'); } } } } else { Yamli.yamlify('clip'); } var text = document.getElementById('text'); text.focus(); text.select(); } function elixirClear (n) { var input = document.getElementById(n); input.value = ''; input.focus(); } ElixirFM-1.1/css/listexpander/0000755001432400135600000000000011420132771015031 5ustar smrzufalElixirFM-1.1/css/listexpander/listexpander.js0000444001432400135600000002206611420132771020075 0ustar smrzufal/* List Expander written by Alen Grakalic provided by Css Globe (cssglobe.com) modified by Otakar Smrz */ this.listexpander = function(){ // edit var listClass = "listexpander"; // class name that you want to assign to list(s) var expandText = "Expand"; // text for expand button var collapseText = "Collapse"; // text for collapse button var excludeText = "Exclude"; // end edit (do not edit below this line) var elem = document.getElementsByName("mode"); var mode = elem.length > 0 ? elem[0].value : 'home'; var expandMax = mode == 'resolve' ? 4 : 3; var expandMin = 1; var expandInit = expandMax; if (mode == 'resolve' || mode == 'lookup') expandInit--; this.start = function(){ var ul = document.getElementsByTagName("ul"); for (var i=0;i 0){ var ul = items[0]; var is = limited(ul, list); ul.style.display = is ? "none" : "block"; li.className = is ? "collapsed" : "expanded"; li.over = true; ul.onmouseover = function(){li.over = false;} ul.onmouseout = function(){li.over = true;} li.onclick = function(){ if(this.over){ ul.style.display = (ul.style.display == "none") ? "block" : "none"; this.className = (ul.style.display == "none") ? "collapsed" : "expanded"; }; }; }; }; this.buttons = function(list){ var parent = list.parentNode; var p = document.createElement("p"); p.className = listClass; if (mode == 'resolve' || mode == 'inflect') { var i = document.createElement("input"); i.type = 'text'; i.name = 'exclude'; i.title = 'type in tags or parameter values'; i.onkeyup = function(){exclude(list, i)}; i.className = 'exclude'; p.appendChild(i); var a = document.createElement("a"); a.innerHTML = excludeText; a.onclick = function(){exclude(list, i)}; a.className = 'exclude'; p.appendChild(a); var items = list.getElementsByTagName("li"); var shows = false; for (var j = 0; j < items.length; j++) { if (items[j].parentNode.level == expandMax - 1) { var xtag = items[j].getElementsByTagName("td")[0]; if (xtag.firstChild.nodeValue.match(/[XY]/)) shows = true; } } if (shows) { i.value = 'X foreign Y acronym'; exclude(list, i); var hides = true; for (var j = 0; j < items.length; j++) { if (items[j].style.display == 'block') hides = false; } if (hides) { i.value = ''; exclude(list, i); } } } var a = document.createElement("a"); a.innerHTML = expandText; a.onclick = function(){expand(list)}; p.appendChild(a); var a = document.createElement("a"); a.innerHTML = collapseText; a.onclick = function(){collapse(list)}; p.appendChild(a); parent.insertBefore(p,list); }; this.exclude = function(list, input){ var words = input.value.split(/[ ,/]+/); var items = list.getElementsByTagName("li"); for (var i = 0; i < items.length; i++) { if (items[i].parentNode.level == expandMax - 3) { items[i].style.display = 'block'; } else { items[i].style.display = 'none'; } } for (var i = items.length - 1; i > -1; i--) { var level = items[i].parentNode.level; if (level == expandMax) { var table = items[i].getElementsByTagName("table"); if (table.length < 1) continue; var shows = prune(table[0], words); if (shows) { items[i].style.display = 'block'; var root = items[i].parentNode; while (root.nodeName != "LI") { root = root.parentNode; } root.style.display = 'block'; } } else if (level == expandMax - 1) { if (items[i].style.display == 'block') { var root = items[i].parentNode; while (root.nodeName != "LI") { root = root.parentNode; } root.style.display = 'block'; } } else if (level == expandMax - 2) { if (items[i].style.display == 'none') { var root = items[i].parentNode; while (root.nodeName != "LI") { root = root.parentNode; } root.style.display = 'none'; } } } /* for (var i = 0; i < items.length; i++) { if (items[i].parentNode.level < expandMin + 2) { if (items[i].style.display == 'none') { items[i].style.display = 'block'; items[i].className = 'empty'; } else { items[i].className = 'expanded'; } } } */ }; this.prune = function(table, words) { var lines = table.rows; var shows = false; var hides = false; for (var i = 0; i < lines.length; i++) { var items = lines[i].cells; var empty = true; var xr = false; var dr = false; for (var j = 0; j < items.length; j++) { if (items[j].className == 'xtag') { var xtag = items[j].firstChild; if (xtag == undefined) continue; xtag = xtag.nodeValue; if (xtag == ' ') continue; empty = false; for (var w = 0; w < words.length; w++) { if (words[w] == '') continue; xr = xr || xtag.indexOf(words[w]) > -1; } } if (items[j].className == 'dtag') { var dtag = items[j].firstChild; if (dtag == undefined) continue; dtag = dtag.nodeValue.split(/[ ,/]+/); for (var w = 0; w < words.length; w++) { if (words[w].length < 2) continue; for (var d = 0; d < dtag.length; d++) { if (dtag[d] == '') continue; empty = false; dr = dr || dtag[d].indexOf(words[w]) == 0; } } } } hides = empty ? hides : (xr || dr); lines[i].style.display = hides ? "none" : ""; shows = shows || ! hides; } return shows; }; this.expand = function(list){ if (list.limit < expandMax) list.limit++; var li = list.getElementsByTagName("li"); for(var i=0;i 0){ var ul = items[0]; var is = limited(ul, list); ul.style.display = is ? "none" : "block"; li[i].className = is ? "collapsed" : "expanded"; }; }; }; this.collapse = function(list){ if (list.limit > expandMin) list.limit--; var li = list.getElementsByTagName("li"); for(var i=0;i 0){ var ul = items[0]; var is = limited(ul, list); ul.style.display = is ? "none" : "block"; li[i].className = is ? "collapsed" : "expanded"; }; }; }; this.limited = function(node, list) { if (node.level == undefined) { node.level = 2; var root = node.parentNode; while(root != list) { if (root.nodeName == "UL") node.level++; root = root.parentNode; } } return (node.level > list.limit); }; start(); }; window.onload = listexpander; ElixirFM-1.1/css/listexpander/expanded.gif0000444001432400135600000000011211420132771017300 0ustar smrzufalGIF89a UUU!, (-"meLRp}de;ElixirFM-1.1/css/listexpander/listexpander.css0000444001432400135600000000534311420132771020250 0ustar smrzufal/* List Expander */ .listexpander{width: 100%} .listexpander, .listexpander ul, .listexpander li{ margin: 0px; padding: 0px; list-style: none; line-height: 150%; } .listexpander ul{ /* Uncomment this if you want to initially hide the child lists. If you do, Javascript disabled and CSS enabled browsers will not be able to use this list. display: none; */ } .listexpander li{ line-height: 150%; border-top: 2px white solid; cursor: default; text-indent: 30px; font-weight: bold; width: 100%; } .listexpander table { margin-left: 15px; border: 0px; border-spacing: 0px; } .listexpander td { padding-left: 20px; padding-right: 0px; } .listexpander li.collapsed, .listexpander li.expanded{cursor: pointer} /* first level */ .listexpander li{background: #EEE8AA /*palegoldenrod*/} .listexpander li.collapsed{background: #EEE8AA /*palegoldenrod*/ url(collapsed.gif) no-repeat 5px .4em} .listexpander li.expanded{background: #EEE8AA /*palegoldenrod*/ url(expanded.gif) no-repeat 5px .4em} ul.listexpander li.empty{cursor: default; background: #f8e7e7 url(empty.gif) no-repeat 5px .4em} /* second level */ .listexpander li ul, .listexpander li li{background: #eed; font-weight: normal} .listexpander li li.collapsed{background: #eed url(collapsed.gif) no-repeat 5px .5em} .listexpander li li.expanded{background: #eed url(expanded.gif) no-repeat 5px .5em} /* third level */ .listexpander li li ul, .listexpander li li li{background: #ffe} .listexpander li li li.collapsed{background: #ffe url(collapsed.gif) no-repeat 5px .5em} .listexpander li li li.expanded{background: #ffe url(expanded.gif) no-repeat 5px .5em} /* fourth level */ .listexpander li li li li{background: #fff} /* li{text-indent: 0; margin-left: 30px; width: auto} */ /* etc. */ /* buttons */ p.listexpander{ margin: 0em; margin-top: 0.5em; margin-bottom: 0.2em; } p.listexpander a{ padding: 0 5px; border: 1px solid #ddd; margin-right: 5px; cursor: pointer; } p.listexpander a:hover{ background: #eee; } p.listexpander input.exclude { float: right; margin: 3px 0px; line-height: 110%; padding: 0 5px; font-family: Courier New; font-size: smaller; } p.listexpander a.exclude { float: right; margin: 3px 0px; line-height: 110%; padding: 0px 5px; border: 1px solid #ddd; margin-right: 5px; cursor: pointer; } /* float fix */ .listexpander li:after{ content: "."; display: block; height: 0; clear: both; visibility: hidden; } .listexpander li{ display: inline-block; } /* Hides from IE-mac \*/ * html .listexpander li{ height: 1%; } .listexpander li{ display: block; } /* End hide from IE-mac */ /* end float fix */ ElixirFM-1.1/css/listexpander/empty.gif0000444001432400135600000000010711420132771016652 0ustar smrzufalGIF89a ,  (-"m 3}Ai۸&(;ElixirFM-1.1/css/listexpander/collapsed.gif0000444001432400135600000000011711420132771017463 0ustar smrzufalGIF89a UUU!,  (-"m25\r׈&#ձ *%Q;ElixirFM-1.1/css/elixir.css0000444001432400135600000001171611420132771014341 0ustar smrzufal.phon { font-style: italic; } .orth { font-size: medium; /* display: none; */ line-height: 150%; direction: rtl; } .xtag { font-family: Courier New; } .root { color: #4B0082 /*indigo*/; white-space: nowrap; } .morphs { font-family: DejaVu Sans /*Courier New*/; color: #FF8C00 /*darkorange*/; white-space: nowrap; } .class { font-family: Courier New; color: #FF4500 /*orangered*/; } .stems { font-family: DejaVu Sans /*Courier New*/; color: #FF8C00 /*darkorange*/; } .word { font-size: large; } .notice { color: #FF4500 /*orangered*/; } body { font-family: DejaVu Sans Condensed, DejaVu Sans, Tahoma, Arial Unicode MS, Verdana, Arial, Helvetica, sans-serif; font-weight: normal; font-size: medium; color: black; background-color: white; } p { margin: 12px 0px; } table { margin: 0px; margin-bottom: 10px; border-spacing: 0px; } table.lexeme { width: 98%; margin: 0px; padding: 2px 0px; border-spacing: 0px; } .lexeme td.xtag { width: 2ex; } .lexeme td.phon { width: 6em; } .lexeme td.orth { width: 4em; padding-right: 1em; } .lexeme td.atex { width: 3em; } .lexeme td.root { text-align: center; width: 9ex; } .lexeme td.morphs { width: 8em; } .lexeme td.class { width: 2.5em; } .lexeme td.stems { width: 5em; } .lexeme td.reflex { width: 20em; } .lexeme td.button { min-width: 10em; text-align: right; white-space: nowrap; } table.nest { width: 98%; margin: 0px; padding: 2px 0px; border-spacing: 0px; } .nest td.root { font-weight: bold; } .nest td.button { min-width: 10em; text-align: right; white-space: nowrap; } td { border: 0px; padding: 0px; padding-right: 25px; font-size: medium; font-weight: normal; text-indent: 0px; text-decoration: none; vertical-align: baseline; } td.orth { text-align: right; } input { font-family: DejaVu Sans Condensed, DejaVu Sans, Tahoma, Arial Unicode MS, Verdana, Arial, Helvetica, sans-serif; font-size: medium; } h1 { font-size: x-large; font-weight: bold; color: #EEE8AA /*palegoldenrod*/; background-color: #4B0082 /*indigo*/; padding: 3px 6px; } h2 { font-size: large; font-weight: bold; line-height: 130%; color: #4B0082 /*indigo*/; border: 1px; border-style: solid; border-color: #DAA520 /*goldenrod*/; padding: 2px 5px; margin-top: 25px; } h3 { font-size: large; font-weight: bold; line-height: 130%; color: black; border: 1px; border-style: solid; border-color: #FFD700 /*gold*/; padding: 2px 5px; margin-bottom: 10px; } h3 span.mode { font-size: medium; font-weight: normal; margin-right: 0.4em; } h3 span.word { margin-right: 0em; } a:link { color: #4B0082 /*indigo*/; text-decoration: none; } h1 a:link { color: #FFD700 /*gold*/; text-decoration: none; } a:visited { color: #4B0082 /*indigo*/; text-decoration: none; } h1 a:visited { color: #FFD700 /*gold*/; text-decoration: none; } a:hover { color: #4B0082 /*indigo*/; text-decoration: none; background-color: #EEE8AA /*palegoldenrod*/; } h1 a:hover { color: #FFD700 /*gold*/; text-decoration: none; background-color: #4B0082 /*indigo*/; } a:active { color: #FFD700 /*gold*/; text-decoration: none; } code { font-family: Courier New; font-size: medium; } span { display: inline; margin-right: 1em; } .button a { padding: 0 5px; border: 1px solid #ddd; margin-right: 0em; background-color: white; text-align: right; /* position: relative; */ /* left: 200px; */ } .button a:visited { padding: 0 5px; border: 1px solid #ddd; margin-right: 0em; } .button a:hover { padding: 0 5px; border: 1px solid #FFD700 /*gold*/; margin-right: 0em; color: #FF4500 /*orangered*/; } .button a:active { padding: 0 5px; border: 1px solid #FFD700 /*gold*/; margin-right: 0em; color: #FFD700 /*gold*/; } div.menu { /* min-width: 10em; */ /* line-height: 0%; */ font-weight: bold; text-align: right; white-space: nowrap; } .menu span { padding: 0 5px; border: 1px solid #ddd; margin-right: 0em; background-color: white; text-align: right; /* position: relative; */ /* left: 200px; */ } .menu a { padding: 0 5px; border: 1px solid #ddd; margin-right: 0em; background-color: white; text-align: right; /* position: relative; */ /* left: 200px; */ } .menu a:visited { padding: 0 5px; border: 1px solid #ddd; margin-right: 0em; } .menu a:hover { padding: 0 5px; border: 1px solid #FFD700 /*gold*/; margin-right: 0em; color: #FF4500 /*orangered*/; } .menu a:active { padding: 0 5px; border: 1px solid #FFD700 /*gold*/; margin-right: 0em; color: #FFD700 /*gold*/; } td.xtag input { font-family: Courier New; } ElixirFM-1.1/lib/0000755001432400135600000000000011420132771012305 5ustar smrzufalElixirFM-1.1/lib/ElixirFM.pm0000444001432400135600000010456711420132771014335 0ustar smrzufal# ########################################################################## Otakar Smrz, 2008/07/07 # # ElixirFM Interfaces ############################################################################## # $Id: ElixirFM.pm 976 2010-07-14 22:25:17Z smrz $ package ElixirFM; use 5.008; use strict; our $VERSION = '1.1' || join '.', '1.1', q $Revision: 976 $ =~ /(\d+)/; use Encode::Arabic; use XML::Parser; use Unicode::Normalize; # ################################################################################################## # # ################################################################################################## use subs 'foldr', 'foldl'; no warnings 'recursion'; sub foldr (&$@) { my ($fun, $nil, @lst, $lst) = @_; return $nil unless @lst; ($lst, @lst) = @lst; return $fun->($lst, foldr $fun, $nil, @lst); } sub foldl (&$@) { my ($fun, $nil, @lst, $lst) = @_; return $nil unless @lst; ($lst, @lst) = @lst; return foldl $fun, $fun->($nil, $lst), @lst; } sub nub (&@) { my ($fun, @lst, %nub) = @_; return grep { my $r = $fun->($_); exists $nub{$r} ? 0 : ++$nub{$r} } @lst; } sub tuples { my @data = @_; push @data, undef if @data % 2; my @pair; for (my $i = 0; $i < @data; $i += 2) { push @pair, [$data[$i], $data[$i + 1]]; } return @pair; } sub concat { return map { ref $_ eq 'ARRAY' ? @{$_} : $_ } @_; } # ################################################################################################## # # ################################################################################################## sub orth { return decode "arabtex", $_[0]; } sub phon { return decode "arabtex-zdmg", $_[0]; } sub orph { return join defined $_[1] ? $_[1] : " ", grep { $_ ne '' } orth($_[0]), phon($_[0]); } sub phor { return join defined $_[1] ? $_[1] : " ", grep { $_ ne '' } phon($_[0]), orth($_[0]); } sub cling { return join defined $_[1] ? $_[1] : "", split " ", $_[0]; } sub nice { my $morphs = morphs($_[0]); $morphs->[0] = $morphs->[0] =~ /^(?:_____|Identity)$/ ? '_____' : merge("", $morphs->[0]); $morphs->[0] =~ s/([FCL]|[KRDS])/|$1|/g; $morphs->[1] = [ map { $_ =~ /"/ ? showPrefix($_) : $_ } @{$morphs->[1]} ]; $morphs->[2] = [ map { $_ =~ /"/ ? showSuffix($_) : $_ } @{$morphs->[2]} ]; return join "-", map { phon($_) } @{$morphs->[1]}, $morphs->[0], @{$morphs->[2]}; } our $tagset = [ [ "", { "V-" => "verb", "VI" => "imperfective", "VP" => "perfective", "VC" => "imperative", "N-" => "noun", "A-" => "adjective", "S-" => "pronoun", "SP" => "personal", "SD" => "demonstrative", "SR" => "relative", "Q-" => "numeral", "QI" => "", "QV" => "", "QX" => "", "QY" => "", "QL" => "", "QC" => "", "QD" => "", "QM" => "", "D-" => "adverb", "P-" => "preposition", "PI" => "inflected", "C-" => "conjunction", "F-" => "particle", "FN" => "negative", "FI" => "interrogative", "I-" => "interjection", "X-" => "foreign word", "Y-" => "acronym/unit", "Z-" => "zero inflections", "G-" => "graphical symbol" } ], [ "", {} ], [ "mood", { "I" => "indicative", "S" => "subjunctive", "J" => "jussive", "E" => "energetic" } ], [ "voice", { "A" => "active", "P" => "passive" } ], [ "", {} ], [ "person", { "1" => "first", "2" => "second", "3" => "third" } ], [ "gender", { "M" => "masculine", "F" => "feminine" } ], [ "number", { "S" => "singular", "D" => "dual", "P" => "plural" } ], [ "case", { "1" => "nominative", "2" => "genitive", "4" => "accusative" } ], [ "state", { "I" => "indefinite", "D" => "definite", "R" => "reduced/construct", "A" => "absolute/negative", "C" => "complex/overdetermined", "L" => "lifted/underdetermined" } ] ]; our $dims = scalar @{$tagset}; sub describe { my $i = 0; my @slot = map { $i++ % 2 ? [ split //, $_ ] : map { [ $_ ne '-' ? $_ : () ] } split //, $_ } split /[\[\]]/, $_[0]; my $terse = defined $_[1] ? $_[1] : ''; if (@slot > $dims) { splice @slot, $dims, (@slot - $dims); } else { push @slot, ([]) x ($dims - @slot); } my @type = map { my $x = $_; [ exists $tagset->[0][1]{$_ . '-'} ? $tagset->[0][1]{$_ . '-'} : '', join " ", grep { $_ ne '' } map { exists $tagset->[0][1]{$x . $_} ? $tagset->[0][1]{$x . $_} : '' } @{$slot[1]} ] } @{$slot[0]}; my @cats = map { my $x = $_; [ $terse && $_ != 5 ? '' : $tagset->[$x][0], join " ", grep { $_ ne '' } map { exists $tagset->[$x][1]{$_} ? $tagset->[$x][1]{$_} : '' } @{$slot[$x]} ] } 2 .. $dims - 1; return join ", ", grep { $_ ne '' } ( join " ", map { grep { $_ ne '' } $_->[1], $_->[0] } @type ), ( map { join " ", grep { $_ ne '' } $_->[1] ne '' ? ($_->[1], $_->[0]) : () } @cats ); } sub retrieve { my @word = grep { $_ ne '' } map { split /([()])/, $_ } split ' ', $_[0]; my $tags = [ map { [] } 1 .. $dims ]; my @tags = ($tags); my @slot = (); foreach my $word (@word) { $word =~ /^verb/i and push @{$tags->[0]}, 'V' and next; $word =~ /^noun/i and push @{$tags->[0]}, 'N' and next; $word =~ /^adj/i and push @{$tags->[0]}, 'A' and next; $word =~ /^pron/i and push @{$tags->[0]}, 'S' and next; $word =~ /^num/i and push @{$tags->[0]}, 'Q' and next; $word =~ /^adv/i and push @{$tags->[0]}, 'D' and next; $word =~ /^prep/i and push @{$tags->[0]}, 'P' and next; $word =~ /^conj/i and push @{$tags->[0]}, 'C' and next; $word =~ /^part/i and push @{$tags->[0]}, 'F' and next; $word =~ /^int(?:er)?j/i and push @{$tags->[0]}, 'I' and next; $word =~ /^(?:e)?xtra/i and push @{$tags->[0]}, 'X' and next; $word =~ /^foreign/i and push @{$tags->[0]}, 'X' and next; $word =~ /^[yu]nit/i and push @{$tags->[0]}, 'Y' and next; $word =~ /^acronym/i and push @{$tags->[0]}, 'Y' and next; $word =~ /^zero/i and push @{$tags->[0]}, 'Z' and next; $word =~ /^null/i and push @{$tags->[0]}, 'Z' and next; $word =~ /^gr(?:a)?ph/i and push @{$tags->[0]}, 'G' and next; $word =~ /^symbol/i and push @{$tags->[0]}, 'G' and next; $word =~ /^perf/i and push @{$tags->[1]}, 'P' and next; $word =~ /^imp(?:er)?f/i and push @{$tags->[1]}, 'I' and next; $word =~ /^imp(?:er)?a/i and push @{$tags->[1]}, 'C' and next; $word =~ /^imp(?:er)?/i and push @{$tags->[1]}, 'I', 'C' and next; $word =~ /^pers(?:ona)?l/i and push @{$tags->[1]}, 'P' and next; $word =~ /^dem/i and push @{$tags->[1]}, 'D' and next; $word =~ /^rel/i and push @{$tags->[1]}, 'R' and next; $word =~ /^inf/i and push @{$tags->[1]}, 'I' and next; $word =~ /^neg/i and push @{$tags->[1]}, 'N' and next; $word =~ /^int(?:er)?r/i and push @{$tags->[1]}, 'I' and next; $word =~ /^ind(?![ef])/i and push @{$tags->[2]}, 'I' and next; $word =~ /^sub/i and push @{$tags->[2]}, 'S' and next; $word =~ /^jus/i and push @{$tags->[2]}, 'J' and next; $word =~ /^ene/i and push @{$tags->[2]}, 'E' and next; $word =~ /^act/i and push @{$tags->[3]}, 'A' and next; $word =~ /^pas/i and push @{$tags->[3]}, 'P' and next; $word =~ /^(?:fir|[1f])st/i and push @{$tags->[5]}, '1' and next; $word =~ /^(?:seco|[2s])nd/i and push @{$tags->[5]}, '2' and next; $word =~ /^(?:thi|[3t])rd/i and push @{$tags->[5]}, '3' and next; $word =~ /^mas/i and push @{$tags->[6]}, 'M' and next; $word =~ /^fem/i and push @{$tags->[6]}, 'F' and next; $word =~ /^s(?:in)?g/i and push @{$tags->[7]}, 'S' and next; $word =~ /^du/i and push @{$tags->[7]}, 'D' and next; $word =~ /^pl/i and push @{$tags->[7]}, 'P' and next; $word =~ /^nom/i and push @{$tags->[8]}, '1' and next; $word =~ /^gen(?![dr])/i and push @{$tags->[8]}, '2' and next; $word =~ /^acc/i and push @{$tags->[8]}, '4' and next; $word =~ /^obl/i and push @{$tags->[8]}, '2', '4' and next; $word =~ /^ind[ef]/i and push @{$tags->[9]}, 'I' and next; $word =~ /^red/i and push @{$tags->[9]}, 'R' and next; $word =~ /^cons/i and push @{$tags->[9]}, 'R' and next; $word =~ /^def/i and push @{$tags->[9]}, 'D' and next; $word =~ /^com/i and push @{$tags->[9]}, 'C' and next; $word =~ /^over/i and push @{$tags->[9]}, 'C' and next; $word =~ /^abs/i and push @{$tags->[9]}, 'A' and next; $word =~ /^lift/i and push @{$tags->[9]}, 'L' and next; $word =~ /^under/i and push @{$tags->[9]}, 'L' and next; if (@slot = $word =~ /\G([-A-Z1-4]|\[[-A-Z1-4]*\])/g) { if (@slot > $dims) { splice @slot, $dims, (@slot - $dims); } else { push @slot, ('-') x ($dims - @slot); } push @tags, join "", @slot; } if ($word =~ /[()]/ or @slot) { $tags = [ map { [] } 1 .. $dims ]; push @tags, $tags; } } return map { ref $_ ? ( grep { @{$_} } @{$_} ) ? join "", map { @{$_} == 0 ? '-' : @{$_} == 1 ? $_->[0] : '[' . (join '', @{$_}) . ']' } @{$_} : () : $_ } @tags; } sub restrict { my @restrict = split //, length $_[0] == $dims ? $_[0] : '-' x $dims; my @inherit = split //, $_[1]; return join '', map { $restrict[$_] eq '-' && defined $inherit[$_] ? $inherit[$_] : $restrict[$_] } 0 .. @restrict - 1; } sub prune { my $data = $_[0]; return $data unless ref $data eq 'ARRAY' and @{$data}; @{$data} = ($data->[0], grep { not grep { not @{$_}[1 .. @{$_} - 1] } @{$_}[1 .. @{$_} - 1] } @{$data}[1 .. @{$data} - 1]); return $data; } sub concise { return @_ unless @_ > 1; my @data = @_; my $data = pop @data; return foldr { return @_ unless ref $_[0] eq 'ARRAY' and ref $_[1] eq 'ARRAY'; return @_ unless @{$_[0]} > 1 and @{$_[1]} > 1 and @{$_[0]} == @{$_[1]}; for (1 .. @{$_[0]} - 1) { return @_ unless $_[0][$_] eq $_[1][$_]; } my @fst = $_[0]->[0] =~ /^("?[A-Z1-4-]{6})([MF])([A-Z1-4-]{3}"?)$/; my @snd = $_[1]->[0] =~ /^("?[A-Z1-4-]{6})([MF])([A-Z1-4-]{3}"?)$/; return @_ unless @fst == 3 and @snd == 3; return @_ unless $fst[0] eq $snd[0] and $fst[2] eq $snd[2] and $fst[1] ne $snd[1]; return [ $fst[0] . '-' . $fst[2], @{$_[0]}[1 .. @{$_[0]} - 1] ], @_[2 .. @_ - 1]; } $data, @data; } sub normalize { my ($text, $code) = @_; $code = 'UTF' unless defined $code; my @data = split " ", $text; if ($code eq 'UTF') { $text = Unicode::Normalize::normalize('KC', $text); $text =~ tr[\x{06A9}\x{06AA}][\x{0643}]; $text =~ tr[\x{06CC}][\x{064A}]; $text =~ tr[\x{0640}][]d; $text =~ s/([\x{064B}-\x{0650}\x{0652}\x{0670}])\x{0651}/\x{0651}$1/g; $text =~ s/([\x{0627}\x{0649}])\x{064B}/\x{064B}$1/g; @data = $text =~ /( (?: \p{Arabic} | [\x{064B}-\x{0652}\x{0670}\x{0657}\x{0656}\x{0640}] )+ )/gx; } elsif ($code eq 'Tim') { $text =~ tr[>&<][OWI]; $text =~ tr[_][]d; $text =~ s/([FNKauio\`])\~/\~$1/g; $text =~ s/([AY])F/F$1/g; @data = $text =~ /( [OWI\'\|\}AbptvjHxd\*rzs\$SDTZEgfqklmnhwYyPJRVG\{A\~FNKaui\`o]+ )/gx; } elsif ($code eq 'TeX') { $text = Unicode::Normalize::normalize('D', $text); $text =~ s/a[\x{0304}\x{0301}]/A/g; $text =~ s/i[\x{0304}\x{0301}]/I/g; $text =~ s/u[\x{0304}\x{0301}]/U/g; $text =~ s/aa/A/g; $text =~ s/ii/I/g; $text =~ s/uu/U/g; $text =~ s/j/\^g/g; $text =~ s/x/\_h/g; $text =~ s/(.)[\x{030C}\x{0303}]/\^$1/g; $text =~ s/(.)[\x{0331}\x{032E}]/\_$1/g; $text =~ s/(.)[\x{0323}\x{0307}]/\.$1/g; $text =~ s/(.)[\x{0301}]/\,$1/g; $text =~ s/\x{02BE}/\'/g; $text =~ s/\x{02BF}/\`/g; @data = $text =~ /( (?: \.[hsdtzgr] | \_[thdaIU] | \^[gscznl] | \,[c] | ['btdrzs`fqklmnhwyTaiuAIUYNW|"-] )+ )/gx; } return join " ", @data; } sub identify { my ($text, $code) = @_; $code = 'UTF' unless defined $code; my @data = (); while ($text ne '') { my $data = ''; $text =~ s/^ +//; if (($data) = $text =~ /^(\( *-? *[1-9][0-9]* *, *(?:-? *[1-9][0-9]*|Nothing|Just *\[ *-? *[1-9][0-9]* *(?:\, *-? *[1-9][0-9]* *)*\]) *\))/) { $text = substr $text, length $data; } elsif (($data) = $text =~ /^(\( *-? *[0-9]+ *, *(?:-? *[0-9]+|Nothing|Just *\[ *-? *[0-9]+ *(?:\, *-? *[0-9]+ *)*\]) *\))/) { $text = substr $text, length $data; $data = ''; } elsif (($data) = $text =~ /^(\"\"|(?: *\"(?:\\.|[^\"\\]+)+\")+)/) { $text = substr $text, length $data; } elsif (($data) = $text =~ /^(\p{InArabic}{2,}|\p{InArabic}(?: +\p{InArabic}(?!\p{InArabic}))*)/) { $text = substr $text, length $data; $data = normalize $data, 'UTF'; } elsif (($data) = $text =~ /^((?:[._^,]?[^ ._^,]){2,}|(?:[._^,]?[^ ._^,])(?: +(?:[._^,]?[^ ._^,])(?![^ ]))*)/ and $code ne 'UTF') { $text = substr $text, length $data; $data = normalize $data, $code; } elsif (($data) = $text =~ /^(.[^\(\)\"\p{InArabic}]*)/) { $text = substr $text, length $data; $data =~ tr[\(\)\/\-][ ]; $data =~ s/ +$//; } push @data, $data unless $data eq ''; } return @data; } sub parse { my $parser = new XML::Parser 'Handlers' => { 'Init' => sub { my $expat = shift; $expat->{'Lists'} = []; $expat->{'Tree'} = []; $expat->{'Curlist'} = [ '', {}, $expat->{'Tree'} ]; }, 'Start' => sub { my $expat = shift; my $name = shift; my $elem = [ $name, { @_ }, [] ]; push @{ $expat->{'Curlist'}[-1] }, $elem; push @{ $expat->{'Lists'} }, $expat->{'Curlist'}; $expat->{'Curlist'} = $elem; }, 'End' => sub { my $expat = shift; my $name = shift; my $elem = $expat->{'Curlist'}; my $hash = $expat->{'Curlist'}[1]; my $list = $expat->{'Curlist'}[-1]; if (@{$list} == 1 and not ref $list->[0]) { $expat->{'Curlist'}[-1] = $list->[0]; } else { @{$list} = grep { ref $_ or $_ !~ /^\s*$/ } @{$list}; my $memo = {}; my $quit = ''; foreach my $one (@{$list}) { if (ref $one and $one->[0] !~ /^[A-Z]/ and not exists $hash->{$one->[0]} and not exists $memo->{$one->[0]}) { $memo->{$one->[0]} = $one; } else { $quit = 'quit'; last; } } unless ($quit) { foreach my $one (keys %{$memo}) { if (keys %{$memo->{$one}[1]}) { if (ref $memo->{$one}[-1] and not @{$memo->{$one}[-1]}) { $hash->{$one} = $memo->{$one}[1]; } } else { $hash->{$one} = $memo->{$one}[-1]; } } $expat->{'Curlist'}[-1] = []; } } $expat->{'Curlist'} = pop @{ $expat->{'Lists'} }; }, 'Char' => sub { my $expat = shift; my $text = shift; my $list = $expat->{'Curlist'}[-1]; if (@{$list} > 0 and not ref $list->[-1]) { $list->[-1] .= $text; } else { push @{$list}, $text; } }, 'Final' => sub { my $expat = shift; delete $expat->{'Curlist'}; delete $expat->{'Lists'}; return $expat->{'Tree'}[0]; }, }; return $parser->parse($_[0]); } sub clear { my $data = [@{$_[0]}]; my $ents = $data->[1]; if ($data->[0] eq 'Entry') { if (exists $ents->{'reflex'}) { $_ = [ ref $_ ? map { $_->[-1] } @{$_} : $_ ] foreach $ents->{'reflex'}; } if (exists $ents->{'entity'}) { $ents->{'entity'} = $ents->{'entity'}[0]; foreach ('plural', 'femini', 'masdar', 'imperf', 'pfirst', 'second', 'form') { next unless exists $ents->{'entity'}[1]{$_}; $_ = [ ref $_ ? map { $_->[-1] } @{$_} : $_ ] foreach $ents->{'entity'}[1]{$_}; } pop @{$ents->{'entity'}}; } if (exists $ents->{'limits'}) { if (exists $ents->{'limits'}{'snd'}) { $_ = [ ref $_ eq 'ARRAY' ? map { $_->[-2] } @{$_} : $_ ] foreach $ents->{'limits'}{'snd'}; } } pop @{$data}; } else { foreach ('plural', 'femini', 'masdar', 'imperf', 'pfirst', 'second', 'form') { next unless exists $ents->{$_}; $_ = [ ref $_ ? map { $_->[-1] } @{$_} : $_ ] foreach $ents->{$_}; } pop @{$data}; } return $data; } sub lists_trees { my ($node, @data) = split /^[\t ]*[:]{1}(?=[\t ]+)/m, $_[0]; return $node =~ /[()]/ ? [ [ map { [ split /[\n ]*\t/, $_ ] } grep { $_ ne '' } split /[\n ]*(?=\([0-9]+,[0-9]+\)[\n ]*\t|$)/, $node ], map { my ($i) = /^(?:[\t ]*\n )*([\t ]*)(?![\t\n ])/; $i .= ' '; s/^[\t\n ]+//; s/[\t\n ]+$//; my ($node, @data) = split /(?]/ ? 'lexicon' : ''; my @data; if ($type eq 'resolve') { @data = split /(?:(?<=\n\n)\n|(?<=^\n)\n|(?<=^)\n)/, $data, -1; pop @data if @data and $data[-1] eq ''; @data = map { my (undef, @data) = split /^[\t ]*[:]{4}[\t ]+/m, $_; [ map { my ($node, @data) = split /^[\t ]*[:]{3}[\t ]+/m, $_; [ [ split ' ', $node ], map { my ($node, @data) = split /^[\t ]*[:]{2}[\t ]+/m, $_; [ [ map { join ' ', split ' ' } split /(?<=[>])\s+(?=[<])/, $node ], map { lists_trees($_) } @data ] } @data ] } @data ] } @data; } elsif ($type eq 'lookup') { @data = split /(?:(?<=\n)\n|(?<=^)\n)/, $data, -1; pop @data if @data and $data[-1] eq ''; @data = map { my @data = split /\s*<\/Nest>\s*/, $_; [ map { my ($clip, $data) = split /\s*\s*/, $_; my ($root) = $data =~ /(.*?<\/root>)/; my (@ents) = $data =~ /(.*?<\/Entry>)/gs; $root = parse($root)->[2]; { 'clip' => ( join '', split ' ', $clip ), 'root' => ( ref $root ? "" : $root ), 'ents' => [ map { parse_clear($_, $mode) } @ents ], } } @data ] } @data; } elsif ($type eq 'lexicon') { @data = parse_clear($data, $mode); } else { @data = split /(?:(?<=\n)\n|(?<=^)\n)/, $data, -1; pop @data if @data and $data[-1] eq ''; @data = map { my @data = split /\n/, $_; foldl { my ($data, @data) = @{$_[1]}; push @{$_[0]}, [$data] unless $data eq ' ' x 10; push @{$_[0][-1]}, [@data] if @data; return $_[0]; } [], map { [ split /\t/, $_ ] } @data } @data; } return @data; } sub template { my ($t, $p, $s) = @_; $p = $p =~ /\"$/ ? $p . " >>| " : $p . " >| " unless $p eq ''; $s = $s =~ /^\"/ ? " |<< " . $s : " |< " . $s unless $s eq ''; return $p . $t . $s; } # ################################################################################################## # # ################################################################################################## sub merge { my ($root, $template) = @_; my $morphs = morphs($template); my $prefixes = sub { foldr { mergePrefix($_[0], $_[1]) } $_[0], @{$morphs->[1]} }; my $suffixes = sub { foldl { (substr $_[0], 0, -1) . mergeSuffix( (substr $_[0], -1, 1), $_[1]) } $_[0], @{$morphs->[-1]} }; return $prefixes->($suffixes->(interlocks($morphs->[1], $morphs->[-1], $morphs->[0], split ' ', $root))); } sub morphs { my (@fields) = $_[0]; my $morphs = [ $_[0], [], [] ]; return $morphs if $_[0] eq ''; @fields = split /(?\| |(?<=\") \>\>\| /, $fields[-1]; @{$morphs->[1]} = @fields[0 .. @fields - 2]; @fields = split / \|\< (?!\")| \|\<\< (?=\")/, $fields[-1]; @{$morphs->[-1]} = @fields[1 .. @fields - 1]; $morphs->[0] = $fields[0]; return $morphs; } sub showPrefix { my $text = $_[0]; return $text if $text =~ tr["][]d; return $text . '-'; } sub showSuffix { my $text = $_[0]; $text =~ tr["][]d; return $text; } sub assimVIII { my ($c, $normal) = @_; my %h = ( "'" => [ $c . "t", "t" . "t" ], "_t" => $c . "_t", "_d" => [ "d" . "d", $c . "_d" ], "d" => $c . "d", "z" => $c . "d", ".s" => $c . ".t", ".d" => [ $c . ".t", $c . ".d" ], ".t" => [ $c . ".t", ".d" . ".t" ], ".z" => $c . ".z", "w" => "t" . "t" ); return exists $h{$c} ? ref $h{$c} ? $normal ? $h{$c}[0] : $h{$c}[1] : $h{$c} : $c . "t"; } sub assimVII { my ($c, $normal) = @_; my %h = ( "m" => [ "n" . $c, "m" . $c ] ); return exists $h{$c} ? ref $h{$c} ? $normal ? $h{$c}[0] : $h{$c}[1] : $h{$c} : "n" . $c; } sub interlock { return interlocks([], [], @_); } sub interlocks { my ($p, $s, $pattern, @root) = @_; if ($pattern =~ /^\"([^\"]+)\"$/) { $pattern = $1; $pattern .= 'w' if $pattern =~ /A$/ and @{$s} and $s->[0] eq "Iy"; $pattern =~ s/^H/'/; $pattern =~ s/^([IMNSTUY])/\l$1/; return $pattern unless @root; if ("' _h _d" eq join ' ', @root) { $pattern =~ s/Ft/assimVIII($root[0], 1)/e; } else { $pattern =~ s/Ft/assimVIII($root[0], 0)/e; } $pattern =~ s/nF/assimVII($root[0], 0)/e; $pattern =~ s/F/$root[0]/g if defined $root[0]; $pattern =~ s/C/$root[1]/g if defined $root[1]; $pattern =~ s/L/$root[2]/g if defined $root[2]; $pattern =~ s/K/$root[0]/g if defined $root[0]; $pattern =~ s/R/$root[1]/g if defined $root[1]; $pattern =~ s/D/$root[2]/g if defined $root[2]; $pattern =~ s/S/$root[3]/g if defined $root[3]; } elsif ($pattern =~ /^(?:_____|Identity)$/) { $pattern = join "", @root; $pattern = (substr $pattern, 0, -1) . 'm' if $pattern =~ /^(?:`an|min)$/ and @{$s} and $s->[0] eq '"mA"'; } elsif ($pattern =~ /[FCL]/) { @root = (@root, ('F', 'C', 'L')[@root .. 2]); $pattern = (substr $pattern, 0, -1) . 'w' if $pattern =~ /^F(?:[aiu]C|[IU])LA'$/ and @root and $root[-1] ne 'w' and @{$s} and not $s->[0] =~ /^"[aiu]N?"$/; $pattern =~ s/UC/U\|C/ if $pattern =~ /^(?:Tu)?FUC(?:i?L|I)$/ and @root > 1 and $root[1] eq 'w'; $pattern =~ s/^H/'/; $pattern =~ s/^([IMNSTUY])/\l$1/; if ("' _h _d" eq join ' ', @root) { $pattern =~ s/Ft/assimVIII($root[0], 0)/e; } else { $pattern =~ s/Ft/assimVIII($root[0], 1)/e; } $pattern =~ s/[nN]F/assimVII($root[0], 1)/e; $pattern =~ s/F/$root[0]/g; $pattern =~ s/C/$root[1]/g; $pattern =~ s/L/$root[2]/g; } elsif ($pattern =~ /[KRDS]/) { @root = (@root, ('K', 'R', 'D', 'S')[@root .. 3]); $pattern =~ s/^H/'/; $pattern =~ s/^([IMNSTUY])/\l$1/; $pattern =~ s/K/$root[0]/g; $pattern =~ s/R/$root[1]/g; $pattern =~ s/D/$root[2]/g; $pattern =~ s/S/$root[3]/g; } return $pattern; } sub isClosed { return 0 if $_[0] =~ /^[aiuAIUY]/; return 1; } our @sunny = ( "t", "_t", "d", "_d", "r", "z", "s", "^s", ".s", ".d", ".t", ".z", "l", "n" ); our @moony = ( "'", "b", "^g", ".h", "_h", "`", ".g", "f", "q", "k", "m", "h", "w", "y", "B", "p", "v", "g", "^c", "^z", "c", ",c", "^n", "^l", ".r" ); sub mergePrefix { my $p = $_[0]; my $y = substr $_[1], 0, 1; my $s = substr $_[1], 1; my ($x, $l); if ($_[0] =~ /^[Aa]l$/) { ($l) = grep { $_[1] =~ /^\Q$_/ } @sunny; return "a" . ( defined $l ? $l : $_[1] =~ /^i/ ? "l-i" : "l" ) . "-" . $_[1]; } return "'A" . $s if $p eq "\"'a\"" and $y eq '\'' and isClosed($s); return "'U" . $s if $p eq "\"'u\"" and $y eq '\'' and isClosed($s); return $x . "U" . $s if ($x) = $p =~ /^"(.)u"$/ and $y =~ /[wy]/ and isClosed($s); return showPrefix($_[0]) . $_[1]; } sub mergeSuffix { my (%rules, $x); if ($_[0] eq 'Y') { return "AT" if $_[1] =~ /^[Aa]T$/; return "awIy" if $_[1] eq "Iy"; return "awn" if $_[1] eq "Un"; return "ayn" if $_[1] eq "In"; %rules = ( "" => "a", "Una" => "awna", "U" => "aw", "UW" => "aW", "Ina" => "ayna", "I" => "ay", "^g" => "a^g" ); if (($x) = $_[1] =~ /^"(.*)"$/) { return $rules{$x} if exists $rules{$x}; return "Y" if $x =~ /^[aiu]$/; return "aNY" if $x =~ /^[aiu]N$/; return $x if $x =~ /^at/; return "aw" . $x if $x =~ /^u/; } return "ay" . showSuffix($_[1]); } if ($_[0] eq 'I') { return "iyaT" if $_[1] =~ /^[Aa]T$/; return "awIy" if $_[1] eq "Iy"; return "Un" if $_[1] eq "Un"; return "In" if $_[1] eq "In"; %rules = ( "" => "i", "Una" => "Una", "U" => "U", "UW" => "UW", "Ina" => "Ina", "I" => "I", "Iy" => "Iy", "mA" => "ImA", "ka" => "Ika" ); if (($x) = $_[1] =~ /^"(.*)"$/) { return $rules{$x} if exists $rules{$x}; return "I" if $x =~ /^[iu]$/; return "iN" if $x =~ /^[iu]N$/; return "I" . $x if $x =~ /^[nt]/; return $x if $x =~ /^[iu]/; } return "iy" . showSuffix($_[1]); } if ($_[0] eq 'A') { return "AT" if $_[1] =~ /^[Aa]T$/; return "awIy" if $_[1] eq "Iy"; return "awn" if $_[1] eq "Un"; return "ayn" if $_[1] eq "In"; %rules = ( "" => "a", "Una" => "awna", "U" => "aw", "UW" => "aW", "Ina" => "ayna", "I" => "ay", "Iy" => "AnIy", "At" => "A'At", "t" => "At", "_dA" => "A_dA", "li" => "Ali", "ka" => "Aka" ); if (($x) = $_[1] =~ /^"(.*)"$/) { return $rules{$x} if exists $rules{$x}; return "A" if $x =~ /^[aiu]$/; return "aN" if $x =~ /^[aiu]N$/; return $x if $x =~ /^at/; return "aw" . $x if $x =~ /^u/; } return "aw" . showSuffix($_[1]); } if ($_[0] eq 'U') { return "UhAt" if $_[1] eq "At"; return "Un" if $_[1] eq "Un"; return "In" if $_[1] eq "In"; %rules = ( "" => "u", "Una" => "Una", "U" => "U", "UW" => "UW", "Ina" => "Ina", "I" => "I", "u" => "U", "i" => "I", "l" => "Ul", "f" => "Uf", "^g" => "U^g" ); if (($x) = $_[1] =~ /^"(.*)"$/) { return $rules{$x} if exists $rules{$x}; return $x if $x =~ /^[ui]N$/; return "U" . $x if $x =~ /^[nt]/; return $x if $x =~ /^[iu]/; } return "uw" . showSuffix($_[1]); } return $_[0] . showSuffix($_[1]); } 1; __END__ =head1 NAME ElixirFM - Interfaces to the ElixirFM system implementing Functional Arabic Morphology =head1 REVISION $Revision: 976 $ $Date: 2010-07-15 00:25:17 +0200 (Thu, 15 Jul 2010) $ =head1 SYNOPSIS use ElixirFM; =head1 DESCRIPTION The L module reimplements some of the functionality of the ElixirFM system written in Haskell. You can find documentation for this module at L. =head1 AUTHOR Otakar Smrz C<< >>, L =head1 COPYRIGHT & LICENSE Copyright (C) 2005-2010 Otakar Smrz This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 3. =cut ElixirFM-1.1/lib/ElixirFM/0000755001432400135600000000000011420132771013764 5ustar smrzufalElixirFM-1.1/lib/ElixirFM/CGI/0000755001432400135600000000000011420132771014366 5ustar smrzufalElixirFM-1.1/lib/ElixirFM/CGI/Derive.pm0000444001432400135600000003033011420132771016137 0ustar smrzufal# ###################################################################### Otakar Smrz, 2009/01/25 # # ElixirFM Derive Online ####################################################################### # $Id: Derive.pm 946 2010-04-12 19:27:23Z smrz $ package ElixirFM::CGI::Derive; use strict; our $VERSION = join '.', '1.1', q $Revision: 946 $ =~ /(\d+)/; use ElixirFM::CGI; use CGI::Fast ':standard'; use ElixirFM::Exec './elixir'; use ElixirFM; use Encode::Arabic::ArabTeX ':simple'; use Encode::Arabic::Buckwalter ':xml'; use Encode::Arabic ':modes'; our @example = ( [ 'verb noun adjective', decode "buckwalter", "qrO" ], [ 'verb masdar participle', decode "buckwalter", "qrO" ], [ '[VN]--------- A---------', decode "buckwalter", "qrO" ], [ 'participle passive active masdar verb', decode "buckwalter", "AstqrO ktAbp" ], [ 'part pas act msd verb', decode "buckwalter", "AstqrO ktAbp" ], [ 'A--[PA] N V', decode "buckwalter", "AstqrO ktAbp" ] ); sub pretty ($$$$) { my ($reply, $query, $mode, $q) = @_; my @word = ElixirFM::unpretty $reply; my @text = split "\n", $q->param('clip'); my $r = ''; for (my $i = 0; $i < @text; $i++) { $r .= $q->h3($q->span({-class => "mode"}, ucfirst $mode), $q->span({-class => "word", -title => "input word"}, $text[$i])); my @r = pretty_lookup_tree($query->[$i], $q, \@word); next unless @r; $r .= $q->ul({-class => 'listexpander'}, $q->li([@r])); } return $r; } sub pretty_lookup_data { my $data = $_[0]; my $q = $_[1]; my ($clip) = $data->{'clip'} =~ /^\( (-?[1-9][0-9]*) , (?: Nothing | Just \[ ([^\]]*) \] ) \)$/x; $clip = "($clip,Nothing)"; return $q->table({-cellspacing => 0, -class => "nest"}, $q->Tr($q->td({-class => "root", -title => "common root"}, escape join " ", (decode "zdmg", $_->{'root'}), (quote decode "arabtex", ElixirFM::cling $_->{'root'}, "|")), $q->td({-class => "button"}, $q->a({-title => "lookup all entries under this root", -href => 'index.fcgi?mode=lookup' . '&text=' . (escape quote decode "arabtex", $_->{'root'})}, "Lookup")) )); } sub pretty_lookup_tree { my @data = @{$_[0]}; my $q = $_[1]; my @info = @data; return map { my $data = $_; my $clip = [undef, undef]; (@{$clip}) = $data->{'clip'} =~ /^\( (-?[1-9][0-9]*) , (?: Nothing | Just \[ ([^\]]*) \] ) \)$/x; $clip->[1] = [ grep { /^-?[1-9][0-9]*$/ } split ',', $clip->[1] ] if defined $clip->[1]; my @r = map { my $clip = sprintf "(%d,%d)", $clip->[0], defined $clip->[1] ? $clip->[1][$_] : $_ + 1; my $ents = $data->{'ents'}[$_]; my @info = @{$ents->[1]}{'morphs', 'entity', 'limits', 'reflex'}; my $form = exists $ents->[1]{'entity'}[1]{'form'} ? $ents->[1]{'entity'}[1]{'form'} : []; my $xtag = $info[1]->[0]; $xtag = join ' ', ElixirFM::retrieve $xtag; $xtag = substr $xtag, 0, 1; $info[4] = join " ", map { exists $ents->[1]{'entity'}[1]{$_} ? @{$ents->[1]{'entity'}[1]{$_}} : () } 'imperf', 'pfirst', 'second'; $info[5] = ElixirFM::merge $data->{'root'}, $info[0]; my $root = join " ", (decode "zdmg", $data->{'root'}), (decode "arabtex", ElixirFM::cling $data->{'root'}); my $word = shift @{$_[2]}; ! @{$word} ? () : join $", $q->table({-cellspacing => 0, -class => "lexeme"}, $q->Tr($q->td({-class => "xtag", -title => ElixirFM::describe $xtag}, $xtag), $q->td({-class => "phon", -title => "citation form"}, decode "zdmg", $info[5]), $q->td({-class => "orth", -title => "citation form"}, decode "arabtex", $info[5]), $q->td({-class => "root", -title => "root of citation form"}, $root), $q->td({-class => "morphs", -title => "morphs of citation form"}, ElixirFM::nice $info[0]), $q->td({-class => "class", -title => "derivational class"}, join " ", @{$form}), $q->td({-class => "stems", -title => "inflectional stems"}, ElixirFM::nice $info[4]), $q->td({-class => "reflex", -title => "lexical reference"}, escape join ", ", map { '"' . $_ . '"' } @{$info[3]}), $q->td({-class => "button"}, $q->a({-title => "inflect this lexeme", -href => 'index.fcgi?mode=inflect' . '&clip=' . $clip}, "Inflect"), $q->a({-title => "derive other lexemes", -href => 'index.fcgi?mode=derive' . '&clip=' . $clip}, "Derive"), $q->a({-title => "lookup in the lexicon", -href => 'index.fcgi?mode=lookup' . '&clip=' . $clip}, "Lookup")), )), $q->ul($q->li($q->table({-cellspacing => 0}, "\n", map { pretty_derive_list($_, $q) } map { [ $_->[0], @{$_} > 1 ? @{$_->[1]} : () ], map { [ ' ' x 10, @{$_} ] } @{$_} > 2 ? @{$_}[2 .. @{$_} - 1] : () } @{$word}))) } 0 .. @{$_->{'ents'}} - 1; ! @r ? () : pretty_lookup_data($_, $q) . "\n" . $q->ul($q->li([@r])) } @data; } sub pretty_derive_list { my @data = @{$_[0]}; my $q = $_[1]; return '' if @data < 4; $data[0] = substr $data[0], 1, -1; $data[3] = substr $data[3], 1, -1; return $q->Tr( join $", $q->td({-class => "xtag", -title => ElixirFM::describe $data[0]}, $data[0]), $q->td({-class => "class", -title => "derivational class"}, $data[1]), $q->td({-class => "phon", -title => "derived form"}, decode "zdmg", $data[2]), $q->td({-class => "orth", -title => "derived form"}, decode "arabtex", $data[2]), $q->td({-class => "morphs", -title => "morphs of derived form"}, ElixirFM::nice $data[4]), $q->td({-class => "dtag", -title => "grammatical parameters"}, ElixirFM::describe $data[0], 'terse') ); } sub main ($) { my $c = shift; my $q = $c->query(); my $r = ''; $q->param($c->mode_param(), 'derive'); $r .= display_header $c; $r .= display_headline $c; my $memoize = ''; if (defined $q->param('submit') and $q->param('submit') eq 'Example') { my $idx = rand @example; $q->param('text', $example[$idx][0]); $q->param('clip', $example[$idx][1]); } else { $q->param('text', join ' ', split ' ', defined $q->param('text') ? $q->param('text') : ''); if ($q->param('text') ne '') { $q->param('text', decode "utf8", $q->param('text')); } else { $q->param('text', $example[0][0]); } if (defined $q->param('clip') and $q->param('clip') !~ /^\s*$/) { $q->param('clip', decode "utf8", $q->param('clip')); } else { $q->param('clip', $example[0][1]); $memoize = 'yes'; } } $r .= $q->p("ElixirFM lets you derive words of similar meaning but different grammatical category.", "You only need to tell the desired grammatical categories."); $r .= $q->p("You can either enter natural language descriptions, or you can specify the parameters using the positional morphological tags."); $r .= $q->h2('Your Request'); $r .= $q->start_form(-method => 'POST'); $r .= $q->table( {-border => 0}, Tr( {-align => 'left'}, td( {-colspan => 3, -class => "xtag"}, $q->textfield( -name => 'text', -id => 'text', -dir => 'ltr', -default => $q->param('text'), -accesskey => '4', -size => 60, -maxlength => 180) ), td( {-colspan => 1, -align => 'left', -style => "vertical-align: middle; padding-left: 20px"}, $q->textfield( -name => 'clip', -id => 'clip', -default => $q->param('clip'), -accesskey => '5', -size => 30, -maxlength => 60) ) ), Tr( {-align => 'left'}, td({-align => 'left'}, $q->submit(-name => 'submit', -value => ucfirst $q->param($c->mode_param()))), td({-align => 'center'}, $q->button(-name => 'clear', -value => 'Clear', -onclick => "elixirClear('text')")), td({-align => 'right'}, $q->submit(-name => 'submit', -value => 'Example')), td({-align => 'right'}, $q->button(-name => 'clear', -value => 'Clear', -onclick => "elixirClear('clip')")) ) ); $r .= $q->hidden( -name => $c->mode_param(), -value => $q->param($c->mode_param()) ); $r .= $q->end_form(); $r .= $q->h2('ElixirFM Reply'); $r .= $q->p("Point the mouse over the data to receive further information."); my $mode = $q->param($c->mode_param()); my $text = $q->param('text'); $text =~ s/(?:masdar|msd)/noun/g; $text =~ s/(?:participle|part)/adj/g; $text = join ' ', ElixirFM::retrieve $text; my $clip = $q->param('clip'); $clip = join "\n", ElixirFM::identify $clip; $q->param('clip', $clip); my $query = ['lookup', $clip]; if ($memoize) { $memoize{$mode}[0] = ElixirFM::Exec::elixir @{$query} unless exists $memoize{$mode} and defined $memoize{$mode}[0]; $query = $memoize{$mode}[0]; } else { $query = ElixirFM::Exec::elixir @{$query}; } $query = [ ElixirFM::unpretty $query, 'clear' ]; my @clip = map { map { $_->{'clip'} } @{$_} } @{$query}; my $reply = [$mode, [@clip], $text]; if ($memoize) { $memoize{$mode}[1] = ElixirFM::Exec::elixir @{$reply} unless exists $memoize{$mode} and defined $memoize{$mode}[1]; $reply = $memoize{$mode}[1]; } else { $reply = ElixirFM::Exec::elixir @{$reply}; } $r .= pretty $reply, $query, $mode, $q; unless ($memoize and exists $memoize{$mode}) { open L, '>>', "$mode/index.log"; print L join "\t", gmtime() . "", (join " ", @clip), ($reply =~ /^\s*$/ ? '--' : '++'), encode "utf8", $q->param('text') . "\n"; close L; } $r .= display_footline $c; $r .= display_footer $c; return encode "utf8", $r; } 1; ElixirFM-1.1/lib/ElixirFM/CGI/Lookup.pm0000444001432400135600000002605711420132771016205 0ustar smrzufal# ###################################################################### Otakar Smrz, 2009/01/25 # # ElixirFM Lookup Online ####################################################################### # $Id: Lookup.pm 946 2010-04-12 19:27:23Z smrz $ package ElixirFM::CGI::Lookup; use strict; our $VERSION = join '.', '1.1', q $Revision: 946 $ =~ /(\d+)/; use ElixirFM::CGI; use CGI::Fast ':standard'; use ElixirFM::Exec './elixir'; use ElixirFM; use Encode::Arabic::ArabTeX ':simple'; use Encode::Arabic::Buckwalter ':xml'; use Encode::Arabic ':modes'; our @example = ( [ 'Unicode', join " ", "school", decode "buckwalter", "drs k t b" ], [ 'ArabTeX', "qAmUs 'lktrny ^g d d" ] ); sub pretty ($$$) { my ($reply, $mode, $q) = @_; my @word = ElixirFM::unpretty $reply, 'clear'; my @text = split "\n", $q->param('text'); my $r = ''; $r .= $q->p({-class => 'notice'}, 'The numbers of input and output words are not equal! ' . (scalar @text) . " <> " . (scalar @word)) unless @text == @word; for (my $i = 0; $i < @word; $i++) { $r .= $q->h3($q->span({-class => "mode"}, ucfirst $mode), $q->span({-class => "word", -title => "input word"}, $text[$i])); next unless @{$word[$i]}; $r .= $q->ul({-class => 'listexpander'}, pretty_lookup_tree($word[$i], $q)); } return $r; } sub pretty_lookup_data { my $data = $_[0]; my $q = $_[1]; my $clip = '(' . $_[2]->[0] . ',Nothing)'; return $q->table({-cellspacing => 0, -class => "nest"}, $q->Tr($q->td({-class => "root", -title => "common root"}, escape join " ", (decode "zdmg", $_->{'root'}), (quote decode "arabtex", ElixirFM::cling $_->{'root'}, "|")), $q->td({-class => "button"}, $q->a({-title => "lookup all entries under this root", -href => 'index.fcgi?mode=lookup' . '&text=' . (escape quote decode "arabtex", $_->{'root'})}, "Lookup")) )); } sub pretty_lookup_tree { my @data = @{$_[0]}; my $q = $_[1]; return $q->li([ map { my $data = $_; my $clip = [undef, undef]; (@{$clip}) = $_->{'clip'} =~ /^\( (-?[1-9][0-9]*) , (?: Nothing | Just \[ ([^\]]*) \] ) \)$/x; $clip->[1] = [ grep { /^-?[1-9][0-9]*$/ } split ',', $clip->[1] ] if defined $clip->[1]; pretty_lookup_data($_, $q, $clip) . "\n" . $q->ul($q->li([ map { pretty_lookup_entry($data, $q, $clip, $_) } 0 .. @{$_->{'ents'}} - 1 ] )) } @data ]); } sub pretty_lookup_entry { my $data = $_[0]; my $q = $_[1]; my $clip = '(' . $_[2]->[0] . ',' . (defined $_[2]->[1] ? $_[2]->[1][$_[3]] : $_[3] + 1) . ')'; my $ents = $data->{'ents'}[$_[3]]; my @info = @{$ents->[1]}{'morphs', 'entity', 'limits', 'reflex'}; my $form = exists $ents->[1]{'entity'}[1]{'form'} ? $ents->[1]{'entity'}[1]{'form'} : []; my @entity = map { exists $ents->[1]{'entity'}[1]{$_} ? $ents->[1]{'entity'}[1]{$_} : [] } 'plural', 'femini'; @entity = ((map { [($_ == 0 ? '-------P--' : ''), ElixirFM::merge($data->{'root'}, $entity[0][$_]), $entity[0][$_]] } 0 .. @{$entity[0]} - 1), (map { [($_ == 0 ? '------F---' : ''), ElixirFM::merge($data->{'root'}, $entity[1][$_]), $entity[1][$_]] } 0 .. @{$entity[1]} - 1)); my $xtag = $info[1]->[0]; $xtag = join ' ', ElixirFM::retrieve $xtag; $xtag = substr $xtag, 0, 1; $info[4] = join " ", map { exists $ents->[1]{'entity'}[1]{$_} ? @{$ents->[1]{'entity'}[1]{$_}} : () } 'imperf', 'pfirst', 'second'; $info[5] = ElixirFM::merge $data->{'root'}, $info[0]; return join $", $q->table({-cellspacing => 0, -class => "lexeme"}, $q->Tr($q->td({-class => "xtag", -title => ElixirFM::describe $xtag}, $xtag), $q->td({-class => "phon", -title => "citation form"}, decode "zdmg", $info[5]), $q->td({-class => "orth", -title => "citation form"}, decode "arabtex", $info[5]), $q->td({-class => "morphs", -title => "morphs of citation form"}, ElixirFM::nice $info[0]), $q->td({-class => "class", -title => "derivational class"}, join " ", @{$form}), $q->td({-class => "stems", -title => "inflectional stems"}, ElixirFM::nice $info[4]), $q->td({-class => "reflex", -title => "lexical reference"}, escape join ", ", map { '"' . $_ . '"' } @{$info[3]}), $q->td({-class => "button"}, $q->a({-title => "inflect this lexeme", -href => 'index.fcgi?mode=inflect' . '&clip=' . $clip}, "Inflect"), $q->a({-title => "derive other lexemes", -href => 'index.fcgi?mode=derive' . '&clip=' . $clip}, "Derive"), $q->a({-title => "lookup in the lexicon", -href => 'index.fcgi?mode=lookup' . '&clip=' . $clip}, "Lookup")), )), (@entity == 0) ? () : $q->ul($q->li($q->table({-cellspacing => 0}, $q->Tr([ map { pretty_lookup_entity($_, $q) } @entity ] ) )) ); } sub pretty_lookup_entity { my @info = @{$_[0]}; my $q = $_[1]; return join $", $q->td({-class => "xtag", -title => ElixirFM::describe $info[0]}, $info[0]), $q->td({-class => "phon", -title => "inflectional stem"}, decode "zdmg", $info[1]), $q->td({-class => "orth", -title => "inflectional stem"}, decode "arabtex", $info[1]), $q->td({-class => "morphs", -title => "morphs of inflectional stem"}, ElixirFM::nice $info[2]), $q->td({-class => "dtag", -title => "grammatical parameters"}, ElixirFM::describe $info[0], 'terse'); } sub main ($) { my $c = shift; my $q = $c->query(); my $r = ''; $q->param($c->mode_param(), 'lookup'); $r .= display_header $c; $r .= display_headline $c; my $memoize = ''; if (defined $q->param('submit') and $q->param('submit') eq 'Example') { my $idx = rand @example; $q->param('text', $example[$idx][1]); $q->param('code', $example[$idx][0]); } else { $q->param('text', join ' ', split ' ', defined $q->param('text') ? $q->param('text') : ''); if ($q->param('text') ne '') { $q->param('text', decode "utf8", $q->param('text')); } elsif (defined $q->param('clip') and $q->param('clip') =~ /^\s*\(\s*(-?)\s*([1-9][0-9]*)\s*,\s*(-?)\s*([1-9][0-9]*)\s*\)\s*$/) { $q->param('clip', "($1$2,$3$4)"); $q->param('text', $q->param('clip')); } else { $q->param('text', $example[0][1]); $q->param('code', $example[0][0]); $memoize = 'yes'; } } $q->param('code', 'Unicode') unless defined $q->param('code'); $r .= $q->p("ElixirFM can lookup lexical entries by the citation form and nests of entries by the root.", "You can even search the dictionary using English."); $r .= $q->p("You can try enclosing the text in quotes or parentheses if needed."); $r .= $q->h2('Your Request'); $r .= $q->start_form(-method => 'POST'); $r .= $q->table( {-border => 0}, Tr( {-align => 'left'}, td( {-colspan => 3}, $q->textfield( -name => 'text', -id => 'text', -dir => 'ltr', -default => $q->param('text'), -accesskey => '4', -size => 60, -maxlength => 180) ), td( {-colspan => 2, -style => "vertical-align: middle; padding-left: 20px", -class => 'notice'}, $q->radio_group(-name => 'code', -values => [ @enc_list ], -default => $q->param('code'), -accesskey => '5', -onchange => "elixirYamli('text')", -attributes => { 'ArabTeX' => {-title => "internal phonology-oriented notation"}, 'Buckwalter' => {-title => "letter-by-letter romanization"}, 'Unicode' => {-title => "original script and orthography"} }, -linebreak => 0, -rows => 1, -columns => scalar @enc_list) ) ), Tr( {-align => 'left'}, td({-align => 'left'}, $q->submit(-name => 'submit', -value => ucfirst $q->param($c->mode_param()))), td({-align => 'center'}, $q->button(-name => 'clear', -value => 'Clear', -onclick => "elixirClear('text')")), td({-align => 'right'}, $q->submit(-name => 'submit', -value => 'Example')) ) ); $r .= $q->hidden( -name => $c->mode_param(), -value => $q->param($c->mode_param()) ); $r .= $q->end_form(); $r .= $q->h2('ElixirFM Reply'); $r .= $q->p({-class => 'notice'}, "Click on the items in the list of solutions below in order to display or hide their contents."); $r .= $q->p("Point the mouse over the data to receive further information."); my $mode = $q->param($c->mode_param()); my $code = exists $enc_hash{$q->param('code')} ? $enc_hash{$q->param('code')} : 'UTF'; my $text = $q->param('text'); $text = join "\n", ElixirFM::identify $text; $q->param('text', $text); my $reply = [$mode, [$code], $text]; if ($memoize) { $memoize{$mode} = ElixirFM::Exec::elixir @{$reply} unless exists $memoize{$mode}; $reply = $memoize{$mode}; } else { $reply = ElixirFM::Exec::elixir @{$reply}; } $r .= pretty $reply, $mode, $q; unless ($memoize and exists $memoize{$mode}) { open L, '>>', "$mode/index.log"; print L join "\t", gmtime() . "", $code, ($reply =~ /^\s*$/ ? '--' : '++'), encode "utf8", (join "\t", split "\n", $q->param('text')) . "\n"; close L; } $r .= display_footline $c; $r .= display_footer $c; return encode "utf8", $r; } 1; ElixirFM-1.1/lib/ElixirFM/CGI/Inflect.pm0000444001432400135600000003013711420132771016312 0ustar smrzufal# ###################################################################### Otakar Smrz, 2009/01/25 # # ElixirFM Inflect Online ###################################################################### # $Id: Inflect.pm 946 2010-04-12 19:27:23Z smrz $ package ElixirFM::CGI::Inflect; use strict; our $VERSION = join '.', '1.1', q $Revision: 946 $ =~ /(\d+)/; use ElixirFM::CGI; use CGI::Fast ':standard'; use ElixirFM::Exec './elixir'; use ElixirFM; use Encode::Arabic::ArabTeX ':simple'; use Encode::Arabic::Buckwalter ':xml'; use Encode::Arabic ':modes'; our @example = ( [ 'perfect active third imperative', decode "buckwalter", "qrO" ], [ 'perf act 3rd impa', decode "buckwalter", "qrO" ], [ '-P-A-3---- -C--------', decode "buckwalter", "qrO" ], [ 'indicative subjunctive jussive indefinite reduced definite', decode "buckwalter", "AstqrO ktAbp" ], [ 'ind sub jus indf red def', decode "buckwalter", "AstqrO ktAbp" ], [ '--[ISJ]------[IRD]', decode "buckwalter", "AstqrO ktAbp" ] ); sub pretty ($$$$) { my ($reply, $query, $mode, $q) = @_; my @word = ElixirFM::unpretty $reply; my @text = split "\n", $q->param('clip'); my $r = ''; for (my $i = 0; $i < @text; $i++) { $r .= $q->h3($q->span({-class => "mode"}, ucfirst $mode), $q->span({-class => "word", -title => "input word"}, $text[$i])); my @r = pretty_lookup_tree($query->[$i], $q, \@word); next unless @r; $r .= $q->ul({-class => 'listexpander'}, $q->li([@r])); } return $r; } sub pretty_lookup_data { my $data = $_[0]; my $q = $_[1]; my ($clip) = $data->{'clip'} =~ /^\( (-?[1-9][0-9]*) , (?: Nothing | Just \[ ([^\]]*) \] ) \)$/x; $clip = "($clip,Nothing)"; return $q->table({-cellspacing => 0, -class => "nest"}, $q->Tr($q->td({-class => "root", -title => "common root"}, escape join " ", (decode "zdmg", $_->{'root'}), (quote decode "arabtex", ElixirFM::cling $_->{'root'}, "|")), $q->td({-class => "button"}, $q->a({-title => "lookup all entries under this root", -href => 'index.fcgi?mode=lookup' . '&text=' . (escape quote decode "arabtex", $_->{'root'})}, "Lookup")) )); } sub pretty_lookup_tree { my @data = @{$_[0]}; my $q = $_[1]; my @info = @data; return map { my $data = $_; my $clip = [undef, undef]; (@{$clip}) = $data->{'clip'} =~ /^\( (-?[1-9][0-9]*) , (?: Nothing | Just \[ ([^\]]*) \] ) \)$/x; $clip->[1] = [ grep { /^-?[1-9][0-9]*$/ } split ',', $clip->[1] ] if defined $clip->[1]; my @r = map { my $clip = sprintf "(%d,%d)", $clip->[0], defined $clip->[1] ? $clip->[1][$_] : $_ + 1; my $ents = $data->{'ents'}[$_]; my @info = @{$ents->[1]}{'morphs', 'entity', 'limits', 'reflex'}; my $form = exists $ents->[1]{'entity'}[1]{'form'} ? $ents->[1]{'entity'}[1]{'form'} : []; my $xtag = $info[1]->[0]; $xtag = join ' ', ElixirFM::retrieve $xtag; $xtag = substr $xtag, 0, 1; $info[4] = join " ", map { exists $ents->[1]{'entity'}[1]{$_} ? @{$ents->[1]{'entity'}[1]{$_}} : () } 'imperf', 'pfirst', 'second'; $info[5] = ElixirFM::merge $data->{'root'}, $info[0]; my $root = join " ", (decode "zdmg", $data->{'root'}), (decode "arabtex", ElixirFM::cling $data->{'root'}); my $word = shift @{$_[2]}; ! @{$word} ? () : join $", $q->table({-cellspacing => 0, -class => "lexeme"}, $q->Tr($q->td({-class => "xtag", -title => ElixirFM::describe $xtag}, $xtag), $q->td({-class => "phon", -title => "citation form"}, decode "zdmg", $info[5]), $q->td({-class => "orth", -title => "citation form"}, decode "arabtex", $info[5]), $q->td({-class => "root", -title => "root of citation form"}, $root), $q->td({-class => "morphs", -title => "morphs of citation form"}, ElixirFM::nice $info[0]), $q->td({-class => "class", -title => "derivational class"}, join " ", @{$form}), $q->td({-class => "stems", -title => "inflectional stems"}, ElixirFM::nice $info[4]), $q->td({-class => "reflex", -title => "lexical reference"}, escape join ", ", map { '"' . $_ . '"' } @{$info[3]}), $q->td({-class => "button"}, $q->a({-title => "inflect this lexeme", -href => 'index.fcgi?mode=inflect' . '&clip=' . $clip}, "Inflect"), $q->a({-title => "derive other lexemes", -href => 'index.fcgi?mode=derive' . '&clip=' . $clip}, "Derive"), $q->a({-title => "lookup in the lexicon", -href => 'index.fcgi?mode=lookup' . '&clip=' . $clip}, "Lookup")), )), $q->ul($q->li($q->table({-cellspacing => 0}, "\n", map { pretty_inflect_list($_, $q) } map { [ $_->[0], @{$_} > 1 ? @{$_->[1]} : () ], map { [ ' ' x 10, @{$_} ] } @{$_} > 2 ? @{$_}[2 .. @{$_} - 1] : () } @{$word}))) } 0 .. @{$_->{'ents'}} - 1; ! @r ? () : pretty_lookup_data($_, $q) . "\n" . $q->ul($q->li([@r])) } @data; } sub pretty_inflect_list { my @data = @{$_[0]}; my $q = $_[1]; return '' if @data < 4; $data[2] = substr $data[2], 1, -1; return $q->Tr( join $", $q->td({-class => "xtag", -title => ElixirFM::describe $data[0]}, $data[0]), $q->td({-class => "phon", -title => "inflected form"}, decode "zdmg", $data[1]), $q->td({-class => "orth", -title => "inflected form"}, decode "arabtex", $data[1]), $q->td({-class => "morphs", -title => "morphs of inflected form"}, ElixirFM::nice $data[3]), $q->td({-class => "dtag", -title => "grammatical parameters"}, ElixirFM::describe $data[0], 'terse') ); } sub main ($) { my $c = shift; my $q = $c->query(); my $r = ''; $q->param($c->mode_param(), 'inflect'); $r .= display_header $c; $r .= display_headline $c; my $memoize = ''; if (defined $q->param('submit') and $q->param('submit') eq 'Example') { my $idx = rand @example; $q->param('text', $example[$idx][0]); $q->param('clip', $example[$idx][1]); } else { $q->param('text', join ' ', split ' ', defined $q->param('text') ? $q->param('text') : ''); if ($q->param('text') ne '') { $q->param('text', decode "utf8", $q->param('text')); } else { $q->param('text', $example[0][0]); } if (defined $q->param('clip') and $q->param('clip') !~ /^\s*$/) { $q->param('clip', decode "utf8", $q->param('clip')); } else { $q->param('clip', $example[0][1]); $memoize = 'yes'; } } $r .= $q->p("ElixirFM lets you inflect words into the forms required by context.", "You only need to define the grammatical parameters of the expected word forms."); $r .= $q->p("You can either enter natural language descriptions, or you can specify the parameters using the positional morphological tags."); $r .= $q->h2('Your Request'); $r .= $q->start_form(-method => 'POST'); $r .= $q->table( {-border => 0}, Tr( {-align => 'left'}, td( {-colspan => 3, -class => "xtag"}, $q->textfield( -name => 'text', -id => 'text', -dir => 'ltr', -default => $q->param('text'), -accesskey => '4', -size => 60, -maxlength => 180) ), td( {-colspan => 1, -align => 'left', -style => "vertical-align: middle; padding-left: 20px"}, $q->textfield( -name => 'clip', -id => 'clip', -default => $q->param('clip'), -accesskey => '5', -size => 30, -maxlength => 60) ) ), Tr( {-align => 'left'}, td({-align => 'left'}, $q->submit(-name => 'submit', -value => ucfirst $q->param($c->mode_param()))), td({-align => 'center'}, $q->button(-name => 'clear', -value => 'Clear', -onclick => "elixirClear('text')")), td({-align => 'right'}, $q->submit(-name => 'submit', -value => 'Example')), td({-align => 'right'}, $q->button(-name => 'clear', -value => 'Clear', -onclick => "elixirClear('clip')")) ) ); $r .= $q->hidden( -name => $c->mode_param(), -value => $q->param($c->mode_param()) ); $r .= $q->end_form(); $r .= $q->h2('ElixirFM Reply'); $r .= $q->p("Point the mouse over the data to receive further information."); my $mode = $q->param($c->mode_param()); my $text = join ' ', ElixirFM::retrieve $q->param('text'); my $clip = $q->param('clip'); $clip = join "\n", ElixirFM::identify $clip; $q->param('clip', $clip); my $query = ['lookup', $clip]; if ($memoize) { $memoize{$mode}[0] = ElixirFM::Exec::elixir @{$query} unless exists $memoize{$mode} and defined $memoize{$mode}[0]; $query = $memoize{$mode}[0]; } else { $query = ElixirFM::Exec::elixir @{$query}; } $query = [ ElixirFM::unpretty $query, 'clear' ]; my @clip = map { map { $_->{'clip'} } @{$_} } @{$query}; my $reply = [$mode, [@clip], $text]; if ($memoize) { $memoize{$mode}[1] = ElixirFM::Exec::elixir @{$reply} unless exists $memoize{$mode} and defined $memoize{$mode}[1]; $reply = $memoize{$mode}[1]; } else { $reply = ElixirFM::Exec::elixir @{$reply}; } $r .= pretty $reply, $query, $mode, $q; unless ($memoize and exists $memoize{$mode}) { open L, '>>', "$mode/index.log"; print L join "\t", gmtime() . "", (join " ", @clip), ($reply =~ /^\s*$/ ? '--' : '++'), encode "utf8", $q->param('text') . "\n"; close L; } $r .= display_footline $c; $r .= display_footer $c; return encode "utf8", $r; } 1; ElixirFM-1.1/lib/ElixirFM/CGI/Resolve.pm0000444001432400135600000003174511420132771016353 0ustar smrzufal# ###################################################################### Otakar Smrz, 2009/01/25 # # ElixirFM Resolve Online ###################################################################### # $Id: Resolve.pm 964 2010-06-12 19:15:10Z smrz $ package ElixirFM::CGI::Resolve; use strict; our $VERSION = join '.', '1.1', q $Revision: 964 $ =~ /(\d+)/; use ElixirFM::CGI; use CGI::Fast ':standard'; use ElixirFM::Exec './elixir'; use ElixirFM; use Encode::Arabic::ArabTeX ':simple'; use Encode::Arabic::Buckwalter ':xml'; use Encode::Arabic ':modes'; our @example = ( [ 'Unicode', decode "buckwalter", "AqrO Aldrs AlOwl" ], [ 'ArabTeX', "iqra' ad-darsa al-'awwala" ], [ 'ArabTeX', "ad-dars al-'awwal" ], [ 'Buckwalter', "Aldrs AlOwl" ], [ 'Buckwalter', "AhlA wshlA" ], [ 'Unicode', decode "buckwalter", "Aldrs AlOwl" ], [ 'Unicode', decode "buckwalter", "AhlA wshlA" ] ); sub pretty ($$$) { my ($reply, $mode, $q) = @_; my @word = ElixirFM::concat ElixirFM::unpretty $reply; my @text = split " ", $q->param('text'); my $r = ''; $r .= $q->p({-class => 'notice'}, escape 'The numbers of input and output words are not equal! ' . @text . " <> " . @word) unless @text == @word; for (my $i = 0; $i < @word; $i++) { $r .= $q->h3($q->span({-class => "mode"}, ucfirst $mode), $q->span({-class => "word", -title => "input word"}, $text[$i])); if (@{$word[$i]} > 1) { $r .= $q->ul({-class => 'listexpander'}, pretty_resolve_tree($word[$i], $q)); } else { $r .= $q->ul({-class => 'listexpander'}, $q->li({-class => 'empty'}, $q->span({-class => "word", -title => "input word"}, $text[$i])) ); } } return $r; } sub pretty_resolve_tree { my (undef, @data) = @{$_[0]}; my $q = $_[1]; return '' unless @data; return $q->li([ map { my (undef, @data) = @{$_}; $q->span({-title => "possible tokenization"}, pretty_resolve_data($_, $q)) . "\n" . $q->ul($q->li([ map { my (undef, @data) = @{$_}; $q->span({-title => "token form variants"}, pretty_resolve_forms($_, $q)) . "\n" . $q->ul($q->li([ map { pretty_resolve_lexeme($_, $q) } @data ])) } @data ])) } @data ]); } sub pretty_resolve_data { my (undef, @data) = @{$_[0]}; my $q = $_[1]; enmode "buckwalter", 'noneplus'; my $text = join " " . $q->span({-style => 'width: 20px'}, " ") . " ", map { my @x = ElixirFM::nub { $_[0] } map { escape decode "buckwalter", encode "buckwalter", decode "arabtex", $_ } ElixirFM::nub { $_[0] } map { $_->[1] } map { @{$_}[1 .. @{$_} - 1] } @{$_}[1 .. @{$_} - 1]; join " ", @x > 3 ? ($x[0], '..', $x[-1]) : @x } @data; enmode "buckwalter", 'default'; return $text; } sub pretty_resolve_forms { my ($node, undef) = @{$_[0]}; my $q = $_[1]; return join " ", map { join " ", map { escape decode "zdmg", $_ } split " ", substr $_, 1, -1 } @{$node}; } sub pretty_resolve_lexeme { my ($node, @data) = @{$_[0]}; my @data = ElixirFM::concise @data; my @info = @{$node}; my $q = $_[1]; my $xcat = substr $data[0]->[0], 0, 1; $info[1] = substr $info[1], 1, -1; $info[1] =~ s/\",\"/\", \"/g; my @stem = $info[2] =~ /^Verb \[([^\]]*)\] \[([^\]]*)\] \[([^\]]*)\]$/; $info[2] = @stem ? join " ", map { split /[,]/, $stem[$_] } 1, 0, 2 : ""; $info[3] =~ s/[\[\]]//g; $info[-2] = substr $info[-2], 1, -1; my $root = join " ", (decode "zdmg", $info[-2]), (decode "arabtex", ElixirFM::cling $info[-2]); return join $", $q->table({-cellspacing => 0, -class => "lexeme"}, $q->Tr($q->td({-class => "xtag", -title => ElixirFM::describe $xcat}, $xcat), $q->td({-class => "phon", -title => "citation form"}, decode "zdmg", $info[-3]), $q->td({-class => "orth", -title => "citation form"}, decode "arabtex", $info[-3]), $q->td({-class => "root", -title => "root of citation form"}, $root), $q->td({-class => "morphs", -title => "morphs of citation form"}, ElixirFM::nice $info[-1]), $q->td({-class => "class", -title => "derivational class"}, $info[3]), $q->td({-class => "stems", -title => "inflectional stems"}, ElixirFM::nice $info[2]), $q->td({-class => "reflex", -title => "lexical reference"}, $info[1]), $q->td({-class => "button"}, $q->a({-title => "inflect this lexeme", -href => 'index.fcgi?mode=inflect' . '&clip=' . $info[0]}, "Inflect"), $q->a({-title => "derive other lexemes", -href => 'index.fcgi?mode=derive' . '&clip=' . $info[0]}, "Derive"), $q->a({-title => "lookup in the lexicon", -href => 'index.fcgi?mode=lookup' . '&clip=' . $info[0]}, "Lookup")), )), $q->ul($q->li($q->table({-cellspacing => 0}, $q->Tr([ map { pretty_resolve_token($_, $q) } @data ] ) )) ); } sub pretty_resolve_token { my @info = @{$_[0]}; my $q = $_[1]; return join $", $q->td({-class => "xtag", -title => ElixirFM::describe $info[0]}, $info[0]), $q->td({-class => "phon", -title => "inflected form"}, decode "zdmg", $info[-3]), $q->td({-class => "orth", -title => "inflected form"}, decode "arabtex", $info[-3]), $q->td({-class => "morphs", -title => "morphs of inflected form"}, ElixirFM::nice $info[-1]), $q->td({-class => "dtag", -title => "grammatical parameters"}, ElixirFM::describe $info[0], 'terse'); } sub main ($) { my $c = shift; my $q = $c->query(); my $r = ''; $q->param($c->mode_param(), 'resolve'); $r .= display_header $c; $r .= display_headline $c; my $memoize = ''; if (defined $q->param('submit') and $q->param('submit') eq 'Example') { my $idx = rand @example; $q->param('text', $example[$idx][1]); $q->param('code', $example[$idx][0]); $q->param('fuzzy', ''); $q->param('quick', ''); } else { $q->param('text', join ' ', split ' ', defined $q->param('text') ? $q->param('text') : ''); if ($q->param('text') ne '') { my $text = decode "utf8", $q->param('text'); unless (defined $q->param('code') and $q->param('code') ne 'Unicode') { return ElixirFM::CGI::Lookup::main $c unless $text =~ /\p{InArabic}/; } $q->param('text', $text); } else { $q->param('text', $example[0][1]); $q->param('code', $example[0][0]); $q->param('fuzzy', ''); $q->param('quick', ''); $memoize = 'yes'; } } $q->param('code', 'Unicode') unless defined $q->param('code'); $q->param('fuzzy', '') unless defined $q->param('fuzzy'); $q->param('quick', '') unless defined $q->param('quick'); $r .= $q->p("ElixirFM can analyze non-tokenized as well as tokenized words, even if you omit some symbols or do not spell everything correctly."); $r .= $q->p("You can experiment with entering the text in various notations."); $r .= $q->h2('Your Request'); $r .= $q->start_form(-method => 'POST'); $r .= $q->table( {-border => 0}, Tr( {-align => 'left'}, td( {-colspan => 3}, $q->textfield( -name => 'text', -id => 'text', -dir => 'ltr', -default => $q->param('text'), -accesskey => '4', -size => 60, -maxlength => 180) ), td( {-colspan => 2, -style => "vertical-align: middle; padding-left: 20px", -class => 'notice'}, $q->radio_group(-name => 'code', -values => [ @enc_list ], -default => $q->param('code'), -accesskey => '5', -onchange => "elixirYamli('text')", -attributes => { 'ArabTeX' => {-title => "internal phonology-oriented notation"}, 'Buckwalter' => {-title => "letter-by-letter romanization"}, 'Unicode' => {-title => "original script and orthography"} }, -linebreak => 0, -rows => 1, -columns => scalar @enc_list) ) ), Tr( {-align => 'left'}, td({-align => 'left'}, $q->submit(-name => 'submit', -value => ucfirst $q->param($c->mode_param()))), td({-align => 'center'}, $q->button(-name => 'clear', -value => 'Clear', -onclick => "elixirClear('text')")), td({-align => 'right'}, $q->submit(-name => 'submit', -value => 'Example')), td( {-align => 'left', -style => "vertical-align: middle; padding-left: 20px"}, $q->checkbox_group( -name => 'quick', -values => [ 'Tokenized' ], -default => [ $q->param('quick') ], -accesskey => '6', -title => "consider each input word as one token", -linebreak => 0, -rows => 1, -columns => 1) ), td( {-align => 'right', -style => "vertical-align: middle; padding-left: 20px"}, $q->checkbox_group( -name => 'fuzzy', -values => [ 'Fuzzy Notation' ], -default => [ $q->param('fuzzy') ], -accesskey => '7', -title => "less strict resolution of the input", -linebreak => 0, -rows => 1, -columns => 1) ) ) ); $r .= $q->hidden( -name => $c->mode_param(), -value => $q->param($c->mode_param()) ); $r .= $q->end_form(); $r .= $q->h2('ElixirFM Reply'); $r .= $q->p({-class => 'notice'}, "Click on the items in the list of solutions below in order to display or hide their contents."); $r .= $q->p("Point the mouse over the data to receive further information."); my $mode = $q->param($c->mode_param()); my $code = exists $enc_hash{$q->param('code')} ? $enc_hash{$q->param('code')} : 'UTF'; my $text = ElixirFM::normalize $q->param('text'), $code; $q->param('text', $text); my @param = map { $q->param($_) ? '--' . $_ : () } 'fuzzy', 'quick'; my $reply = [$mode, [@param, $code], $text]; if ($memoize) { $memoize{$mode} = ElixirFM::Exec::elixir @{$reply} unless exists $memoize{$mode}; $reply = $memoize{$mode}; } else { $reply = ElixirFM::Exec::elixir @{$reply}; } $r .= pretty $reply, $mode, $q; unless ($memoize and exists $memoize{$mode}) { open L, '>>', "$mode/index.log"; print L join "\t", gmtime() . "", $code, ($q->param('fuzzy') ? 'F' : 'A'), ($q->param('quick') ? 'T' : 'N'), ($reply =~ m/^::::$/m ? '--' : '++'), encode "utf8", $q->param('text') . "\n"; close L; } $r .= display_footline $c; $r .= display_footer $c; return encode "utf8", $r; } 1; ElixirFM-1.1/lib/ElixirFM/Data/0000755001432400135600000000000011420132771014635 5ustar smrzufalElixirFM-1.1/lib/ElixirFM/Data/Compose.PL0000444001432400135600000004663111420132771016507 0ustar smrzufal package ElixirFM::Data::Compose; use Data::Dumper; $Data::Dumper::Indent = 0; $Data::Dumper::Terse = 1; use strict; warn "Generating dictionaries, please be patient ...\n"; open PM, '>' . (substr __FILE__, 0, -2) . 'pm'; select PM; print << 'PM'; package ElixirFM::Data::Compose; sub new { my $obj = bless {}, ref $_[0] || $_[0]; $obj->{'data'} = { PM our $data = {}; our $lexs = []; our $idx = 0; foreach my $lexeme (@{data()}) { push @{$lexs}, shift @{$lexeme}; for (my $i = 0; $i < @{$lexeme}; $i += 2) { unshift @{$lexeme->[$i + 1]}, $idx; push @{$data->{$lexeme->[$i]}}, $lexeme->[$i + 1]; } $idx++; } printf "%s\t=> %s,\n", Data::Dumper->Dump([$_]), Data::Dumper->Dump([$data->{$_}]) foreach keys %{$data}; print << 'PM'; }; $obj->{'lexs'} = [ PM printf "%s,\n", Data::Dumper->Dump([$_]) foreach @{$lexs}; print << 'PM'; ]; $obj->{'tags'} = [ PM printf "%s,\n", Data::Dumper->Dump([$_]) foreach @{tags()}; print << 'PM'; ]; $obj->{'tmpl'} = [ PM printf "%s,\n", Data::Dumper->Dump([$_]) foreach @{tmpl()}; print << 'PM'; ]; $obj->{'cont'} = [ PM printf "%s,\n", Data::Dumper->Dump([$_]) foreach @{cont()}; print << 'PM'; ]; return $obj; } 1; PM close PM; sub data { return [ [['trIliyUn','trIliyUn','_____',['trillion'],'Num [_____ |< At] []',1,1], 'Altrylywn', [ [0, 0], 0 ], 'AltrylywnAn', [ [0, 1], 0 ], 'AltrylywnAt', [ [1, 2], 0 ], 'Altrylywnyn', [ [0, 3], 0 ], 'trylywn', [ [0, 4], 0, [0, 5], 1, [0, 6], 2 ], 'trylywnA', [ [0, 7], 0, [0, 8], 3 ], 'trylywnAn', [ [0, 9], 0 ], 'trylywnAt', [ [1, 10], 0, [1, 11], 3 ], 'trylywny', [ [0, 12], 4 ], 'trylywnyn', [ [0, 13], 0 ]], [['milyAr','milyAr','_____',['milliard','billion'],'Num [_____ |< At] []',2,1], 'AlmlyAr', [ [0, 0], 0 ], 'AlmlyArAn', [ [0, 1], 0 ], 'AlmlyArAt', [ [1, 2], 0 ], 'AlmlyAryn', [ [0, 3], 0 ], 'mlyAr', [ [0, 5], 1, [0, 6], 2, [0, 4], 0 ], 'mlyArA', [ [0, 7], 0, [0, 8], 3 ], 'mlyArAn', [ [0, 9], 0 ], 'mlyArAt', [ [1, 11], 3, [1, 10], 0 ], 'mlyAry', [ [0, 12], 4 ], 'mlyAryn', [ [0, 13], 0 ]], [['bilyUn','b l y n','KiRDUS',['billion'],'Num [KiRDUS |< At,KaRADIS] []',3,1], 'AlblAyyn', [ [2, 14], 0 ], 'Alblywn', [ [3, 0], 0 ], 'AlblywnAn', [ [3, 1], 0 ], 'AlblywnAt', [ [4, 2], 0 ], 'Alblywnyn', [ [3, 3], 0 ], 'blAyyn', [ [2, 16], 3, [2, 15], 0 ], 'blywn', [ [3, 6], 2, [3, 4], 0, [3, 5], 1 ], 'blywnA', [ [3, 8], 3, [3, 7], 0 ], 'blywnAn', [ [3, 9], 0 ], 'blywnAt', [ [4, 11], 3, [4, 10], 0 ], 'blywny', [ [3, 12], 4 ], 'blywnyn', [ [3, 13], 0 ]], [['milyUn','m l y n','KiRDUS',['million'],'Num [KiRDUS |< At,KaRADIS] []',4,1], 'AlmlAyyn', [ [2, 14], 0 ], 'Almlywn', [ [3, 0], 0 ], 'AlmlywnAn', [ [3, 1], 0 ], 'AlmlywnAt', [ [4, 2], 0 ], 'Almlywnyn', [ [3, 3], 0 ], 'mlAyyn', [ [2, 16], 3, [2, 15], 0 ], 'mlywn', [ [3, 4], 0, [3, 5], 1, [3, 6], 2 ], 'mlywnA', [ [3, 8], 3, [3, 7], 0 ], 'mlywnAn', [ [3, 9], 0 ], 'mlywnAt', [ [4, 10], 0, [4, 11], 3 ], 'mlywny', [ [3, 12], 4 ], 'mlywnyn', [ [3, 13], 0 ]], [['lakk','l k k','FaCL',['hundred thousand','lac'],'Num [FuCUL,HaFCAL] []',5,1], 'AlOlkAk', [ [5, 14], 0 ], 'Allk', [ [6, 0], 0 ], 'AllkAn', [ [6, 1], 0 ], 'Allkwk', [ [7, 14], 0 ], 'Allkyn', [ [6, 3], 0 ], 'OlkAk', [ [5, 17], 0, [5, 16], 3 ], 'OlkAkA', [ [5, 18], 0 ], 'lk', [ [6, 6], 2, [6, 4], 0, [6, 5], 1 ], 'lkA', [ [6, 8], 3, [6, 7], 0 ], 'lkAn', [ [6, 9], 0 ], 'lkwk', [ [7, 17], 0, [7, 16], 3 ], 'lkwkA', [ [7, 18], 0 ], 'lky', [ [6, 12], 4 ], 'lkyn', [ [6, 13], 0 ]], [['ribwaT','r b w','FiCL |< aT',['ten thousand','myriad'],'Num [FiCL |< At] []',6,1], 'AlrbwAt', [ [8, 2], 0 ], 'Alrbwp', [ [9, 0], 0 ], 'AlrbwtAn', [ [9, 1], 0 ], 'Alrbwtyn', [ [9, 3], 0 ], 'rbwAt', [ [8, 10], 0, [8, 11], 3 ], 'rbwp', [ [9, 19], 0 ], 'rbwt', [ [9, 6], 2, [9, 5], 1 ], 'rbwtA', [ [9, 8], 5 ], 'rbwtAn', [ [9, 9], 0 ], 'rbwty', [ [9, 12], 4 ], 'rbwtyn', [ [9, 13], 0 ]], [['\'alf','\' l f','FaCL',['thousand'],'Num [FuCUL,HACAL] []',7,1], 'AlOlf', [ [6, 0], 0 ], 'AlOlfAn', [ [6, 1], 0 ], 'AlOlfyn', [ [6, 3], 0 ], 'AlOlwf', [ [7, 14], 0 ], 'Al|lAf', [ [10, 14], 0 ], 'Olf', [ [6, 4], 0, [6, 5], 1, [6, 6], 2 ], 'OlfA', [ [6, 8], 3, [6, 7], 0 ], 'OlfAn', [ [6, 9], 0 ], 'Olfy', [ [6, 12], 4 ], 'Olfyn', [ [6, 13], 0 ], 'Olwf', [ [7, 16], 3, [7, 17], 0 ], 'OlwfA', [ [7, 18], 0 ], '|lAf', [ [10, 17], 0, [10, 16], 3 ], '|lAfA', [ [10, 18], 0 ]], [['mi\'aT','m \' y','FiC |< aT',['hundred'],'Num [FiC |< Un,FiC |< At] []',8,1], 'Alm}At', [ [11, 20], 0 ], 'Alm}p', [ [12, 21], 0 ], 'Alm}tAn', [ [12, 22], 0 ], 'Alm}tyn', [ [12, 23], 0 ], 'Alm}wn', [ [13, 24], 0 ], 'Alm}yn', [ [13, 25], 0 ], 'm}', [ [13, 26], 2 ], 'm}At', [ [11, 28], 3, [11, 27], 0 ], 'm}p', [ [12, 29], 0 ], 'm}t', [ [12, 30], 1, [12, 31], 2 ], 'm}tA', [ [12, 32], 5 ], 'm}tAn', [ [12, 33], 0 ], 'm}ty', [ [12, 34], 4 ], 'm}tyn', [ [12, 35], 0 ], 'm}w', [ [13, 36], 4 ], 'm}wn', [ [13, 37], 0 ], 'm}y', [ [13, 38], 4 ], 'm}yn', [ [13, 39], 0 ]], [['m_I\'aT','m \' y','"F_IC" |< aT',['hundred'],'Num ["F_IC" |< Un,"F_IC" |< At] []',9,1], 'AlmA}At', [ [14, 20], 0 ], 'AlmA}p', [ [15, 21], 0 ], 'AlmA}tAn', [ [15, 22], 0 ], 'AlmA}tyn', [ [15, 23], 0 ], 'AlmA}wn', [ [16, 24], 0 ], 'AlmA}yn', [ [16, 25], 0 ], 'mA\'', [ [16, 26], 2 ], 'mAW', [ [16, 26], 2 ], 'mA}', [ [16, 26], 2 ], 'mA}At', [ [14, 27], 0, [14, 28], 3 ], 'mA}p', [ [15, 29], 0 ], 'mA}t', [ [15, 31], 2, [15, 30], 1 ], 'mA}tA', [ [15, 32], 5 ], 'mA}tAn', [ [15, 33], 0 ], 'mA}ty', [ [15, 34], 4 ], 'mA}tyn', [ [15, 35], 0 ], 'mA}w', [ [16, 36], 4 ], 'mA}wn', [ [16, 37], 0 ], 'mA}y', [ [16, 38], 4 ], 'mA}yn', [ [16, 39], 0 ]], [['tis`aT','t s `','FiCL |< aT',['nine'],'Num [] [FiCL]',10,1], 'AltsE', [ [17, 40], 0 ], 'AltsEp', [ [9, 41], 0 ], 'tsE', [ [17, 42], 0, [17, 43], 6 ], 'tsEA', [ [17, 44], 0 ], 'tsEp', [ [9, 45], 0 ]], [['tis`Un','t s `','FiCL |< Un',['ninety'],'Num [] []',10,2], 'AltsEwn', [ [17, 46], 0 ], 'AltsEyn', [ [17, 47], 0 ], 'tsEw', [ [17, 48], 0 ], 'tsEwn', [ [17, 49], 0 ], 'tsEy', [ [17, 50], 0 ], 'tsEyn', [ [17, 51], 0 ]], [['_tamAniyaT','_t m n','FaCALI |< aT',['eight'],'Num [] [FaCALI]',11,1], 'AlvmAny', [ [18, 40], 0 ], 'AlvmAnyp', [ [19, 41], 0 ], 'vmAn', [ [18, 52], 0 ], 'vmAny', [ [18, 53], 0, [18, 43], 6 ], 'vmAnyA', [ [18, 44], 0 ], 'vmAnyp', [ [19, 45], 0 ]], [['_tamAnUn','_t m n','FaCAL |< Un',['eighty'],'Num [] []',11,2], 'AlvmAnwn', [ [20, 46], 0 ], 'AlvmAnyn', [ [20, 47], 0 ], 'vmAnw', [ [20, 48], 0 ], 'vmAnwn', [ [20, 49], 0 ], 'vmAny', [ [20, 50], 0 ], 'vmAnyn', [ [20, 51], 0 ]], [['sab`aT','s b `','FaCL |< aT',['seven'],'Num [] [FaCL]',12,1], 'AlsbE', [ [6, 40], 0 ], 'AlsbEp', [ [21, 41], 0 ], 'sbE', [ [6, 43], 6, [6, 42], 0 ], 'sbEA', [ [6, 44], 0 ], 'sbEp', [ [21, 45], 0 ]], [['sab`Un','s b `','FaCL |< Un',['seventy'],'Num [] []',12,2], 'AlsbEwn', [ [6, 46], 0 ], 'AlsbEyn', [ [6, 47], 0 ], 'sbEw', [ [6, 48], 0 ], 'sbEwn', [ [6, 49], 0 ], 'sbEy', [ [6, 50], 0 ], 'sbEyn', [ [6, 51], 0 ]], [['sittaT','s t t','FiCL |< aT',['six'],'Num [] [FiCL]',13,1], 'Alst', [ [17, 40], 0 ], 'Alstp', [ [9, 41], 0 ], 'st', [ [17, 42], 0, [17, 43], 6 ], 'stA', [ [17, 44], 0 ], 'stp', [ [9, 45], 0 ]], [['sittUn','s t t','FiCL |< Un',['sixty'],'Num [] []',13,2], 'Alstwn', [ [17, 46], 0 ], 'Alstyn', [ [17, 47], 0 ], 'stw', [ [17, 48], 0 ], 'stwn', [ [17, 49], 0 ], 'sty', [ [17, 50], 0 ], 'styn', [ [17, 51], 0 ]], [['_hamsaT','_h m s','FaCL |< aT',['five'],'Num [] [FaCL]',14,1], 'Alxms', [ [6, 40], 0 ], 'Alxmsp', [ [21, 41], 0 ], 'xms', [ [6, 42], 0, [6, 43], 6 ], 'xmsA', [ [6, 44], 0 ], 'xmsp', [ [21, 45], 0 ]], [['_hamsUn','_h m s','FaCL |< Un',['fifty'],'Num [] []',14,2], 'Alxmswn', [ [6, 46], 0 ], 'Alxmsyn', [ [6, 47], 0 ], 'xmsw', [ [6, 48], 0 ], 'xmswn', [ [6, 49], 0 ], 'xmsy', [ [6, 50], 0 ], 'xmsyn', [ [6, 51], 0 ]], [['\'arba`aT','r b `','HaFCaL |< aT',['four'],'Num [] [HaFCaL]',15,1], 'AlOrbE', [ [22, 40], 0 ], 'AlOrbEp', [ [23, 41], 0 ], 'OrbE', [ [22, 42], 0, [22, 43], 6 ], 'OrbEA', [ [22, 44], 0 ], 'OrbEp', [ [23, 45], 0 ]], [['\'arba`Un','r b `','HaFCaL |< Un',['fourty'],'Num [] []',15,2], 'AlOrbEwn', [ [22, 46], 0 ], 'AlOrbEyn', [ [22, 47], 0 ], 'OrbEw', [ [22, 48], 0 ], 'OrbEwn', [ [22, 49], 0 ], 'OrbEy', [ [22, 50], 0 ], 'OrbEyn', [ [22, 51], 0 ]], [['_talA_taT','_t l _t','FaCAL |< aT',['three'],'Num [] [FaCAL]',16,1], 'AlvlAv', [ [20, 40], 0 ], 'AlvlAvp', [ [24, 41], 0 ], 'vlAv', [ [20, 43], 6, [20, 42], 0 ], 'vlAvA', [ [20, 44], 0 ], 'vlAvp', [ [24, 45], 0 ]], [['_talA_tUn','_t l _t','FaCAL |< Un',['thirty'],'Num [] []',16,2], 'AlvlAvwn', [ [20, 46], 0 ], 'AlvlAvyn', [ [20, 47], 0 ], 'vlAvw', [ [20, 48], 0 ], 'vlAvwn', [ [20, 49], 0 ], 'vlAvy', [ [20, 50], 0 ], 'vlAvyn', [ [20, 51], 0 ]], [['i_tnAn','_t n y','IFC |< An',['two'],'Num [] [IFC |< aT |< An]',17,1], 'AlAvnAn', [ [25, 54], 0 ], 'AlAvntAn', [ [26, 55], 0 ], 'AlAvntyn', [ [26, 56], 0 ], 'AlAvnyn', [ [25, 57], 0 ], 'AvnA', [ [25, 58], 0 ], 'AvnAn', [ [25, 59], 0 ], 'AvntA', [ [26, 60], 0 ], 'AvntAn', [ [26, 61], 0 ], 'Avnty', [ [26, 62], 0 ], 'Avntyn', [ [26, 63], 0 ], 'Avny', [ [25, 64], 0 ], 'Avnyn', [ [25, 65], 0 ]], [['\'a.had','\' .h d','FaCaL',['one'],'Num [] [FiCLY]',18,1], 'AlIHdY', [ [27, 66], 0 ], 'AlOHd', [ [28, 67], 0 ], 'IHdY', [ [27, 68], 0 ], 'OHd', [ [28, 69], 0 ], 'OHdA', [ [28, 70], 0 ]], [['wA.hid','w .h d','FACiL',['one'],'Num [] [FACiL |< aT]',19,1], 'AlwAHd', [ [29, 67], 0 ], 'AlwAHdp', [ [30, 66], 0 ], 'wAHd', [ [29, 69], 0 ], 'wAHdA', [ [29, 70], 0 ], 'wAHdp', [ [30, 71], 0 ]], [['`a^saraT','` ^s r','FaCaL |< aT',['ten'],'Num [] [FaCL]',20,1], 'AlE$r', [ [6, 72], 0 ], 'AlE$rp', [ [31, 73], 0 ], 'E$r', [ [6, 74], 0 ], 'E$rA', [ [6, 75], 0 ], 'E$rp', [ [31, 76], 0 ]], [['`a^saraT','` ^s r','FaCaL |< aT',['ten','score','dozen'],'Num [FaCaL |< At] []',20,2], 'AlE$rAt', [ [32, 2], 0 ], 'AlE$rp', [ [31, 0], 0 ], 'E$rAt', [ [32, 11], 3, [32, 10], 0 ], 'E$rp', [ [31, 19], 0 ], 'E$rt', [ [31, 5], 3 ]], [['`a^sar','` ^s r','FaCaL',['-teen'],'Num [] [FaCL |< aT]',20,3], 'E$r', [ [28, 77], 0 ], 'E$rp', [ [21, 78], 0 ]], [['`i^srUn','` ^s r','FiCL |< Un',['twenty'],'Num [] []',20,4], 'AlE$rwn', [ [17, 46], 0 ], 'AlE$ryn', [ [17, 47], 0 ], 'E$rw', [ [17, 48], 0 ], 'E$rwn', [ [17, 49], 0 ], 'E$ry', [ [17, 50], 0 ], 'E$ryn', [ [17, 51], 0 ]], ] } sub tags { return [ # 0 [['QM-----S1D','al','"u"'], ['QM-----S2D','al','"i"'], ['QM-----S4D','al','"a"']], # 1 [['QM-----D1D','al','"Ani"']], # 2 [['QM-----P1D','al','"u"'], ['QM-----P2D','al','"i"'], ['QM-----P4D','al','"i"']], # 3 [['QM-----D2D','al','"ayni"'], ['QM-----D4D','al','"ayni"']], # 4 [['QM-----S1I','','"uN"'], ['QM-----S2I','','"iN"'], ['QM-----S1R','','"u"'], ['QM-----S2R','','"i"'], ['QM-----S4R','','"a"'], ['QM-----S1A','','"u"'], ['QM-----S2A','','"i"'], ['QM-----S4A','','"a"']], # 5 [['QM-----S1R','','"u"'], ['QM-----S2R','','"i"'], ['QM-----S4R','','"a"']], # 6 [['QM-----S1R','','"u"'], ['QM-----S2R','','"i"'], ['QM-----S4R','','"a"'], ['QM-----D2R','','"ay"'], ['QM-----D4R','','"ay"']], # 7 [['QM-----S4I','','"aN"'], ['QM-----D1R','','"A"']], # 8 [['QM-----D1R','','"A"']], # 9 [['QM-----D1I','','"Ani"'], ['QM-----D1A','','"Ani"']], # 10 [['QM-----P1I','','"uN"'], ['QM-----P2I','','"iN"'], ['QM-----P4I','','"iN"'], ['QM-----P1R','','"u"'], ['QM-----P2R','','"i"'], ['QM-----P4R','','"i"'], ['QM-----P1A','','"u"'], ['QM-----P2A','','"i"'], ['QM-----P4A','','"i"']], # 11 [['QM-----P1R','','"u"'], ['QM-----P2R','','"i"'], ['QM-----P4R','','"i"']], # 12 [['QM-----D2R','','"ay"'], ['QM-----D4R','','"ay"']], # 13 [['QM-----D2I','','"ayni"'], ['QM-----D4I','','"ayni"'], ['QM-----D2A','','"ayni"'], ['QM-----D4A','','"ayni"']], # 14 [['QM-----P1D','al','"u"'], ['QM-----P2D','al','"i"'], ['QM-----P4D','al','"a"']], # 15 [['QM-----P1I','','"u"'], ['QM-----P2I','','"a"'], ['QM-----P4I','','"a"'], ['QM-----P1R','','"u"'], ['QM-----P2R','','"i"'], ['QM-----P4R','','"a"'], ['QM-----P1A','','"u"'], ['QM-----P2A','','"i"'], ['QM-----P4A','','"a"']], # 16 [['QM-----P1R','','"u"'], ['QM-----P2R','','"i"'], ['QM-----P4R','','"a"']], # 17 [['QM-----P1I','','"uN"'], ['QM-----P2I','','"iN"'], ['QM-----P1R','','"u"'], ['QM-----P2R','','"i"'], ['QM-----P4R','','"a"'], ['QM-----P1A','','"u"'], ['QM-----P2A','','"i"'], ['QM-----P4A','','"a"']], # 18 [['QM-----P4I','','"aN"']], # 19 [['QM-----S1I','','"uN"'], ['QM-----S2I','','"iN"'], ['QM-----S4I','','"aN"'], ['QM-----S1R','','"u"'], ['QM-----S2R','','"i"'], ['QM-----S4R','','"a"'], ['QM-----S1A','','"u"'], ['QM-----S2A','','"i"'], ['QM-----S4A','','"a"']], # 20 [['QC-----P1D','al','"u"'], ['QC-----P2D','al','"i"'], ['QC-----P4D','al','"i"']], # 21 [['QC-----S1D','al','"u"'], ['QC-----S2D','al','"i"'], ['QC-----S4D','al','"a"']], # 22 [['QC-----D1D','al','"Ani"']], # 23 [['QC-----D2D','al','"ayni"'], ['QC-----D4D','al','"ayni"']], # 24 [['QC-----P1D','al','"Una"']], # 25 [['QC-----P2D','al','"Ina"'], ['QC-----P4D','al','"Ina"']], # 26 [['QC-----P1R','','"U"'], ['QC-----P2R','','"I"'], ['QC-----P4R','','"I"']], # 27 [['QC-----P1I','','"uN"'], ['QC-----P2I','','"iN"'], ['QC-----P4I','','"iN"'], ['QC-----P1R','','"u"'], ['QC-----P2R','','"i"'], ['QC-----P4R','','"i"'], ['QC-----P1A','','"u"'], ['QC-----P2A','','"i"'], ['QC-----P4A','','"i"']], # 28 [['QC-----P1R','','"u"'], ['QC-----P2R','','"i"'], ['QC-----P4R','','"i"']], # 29 [['QC-----S1I','','"uN"'], ['QC-----S2I','','"iN"'], ['QC-----S4I','','"aN"'], ['QC-----S1R','','"u"'], ['QC-----S2R','','"i"'], ['QC-----S4R','','"a"'], ['QC-----S1A','','"u"'], ['QC-----S2A','','"i"'], ['QC-----S4A','','"a"']], # 30 [['QC-----S1R','','"u"'], ['QC-----S2R','','"i"'], ['QC-----S4R','','"a"']], # 31 [['QC-----S1R','','"u"'], ['QC-----S2R','','"i"'], ['QC-----S4R','','"a"'], ['QC-----D2R','','"ay"'], ['QC-----D4R','','"ay"']], # 32 [['QC-----D1R','','"A"']], # 33 [['QC-----D1I','','"Ani"'], ['QC-----D1A','','"Ani"']], # 34 [['QC-----D2R','','"ay"'], ['QC-----D4R','','"ay"']], # 35 [['QC-----D2I','','"ayni"'], ['QC-----D4I','','"ayni"'], ['QC-----D2A','','"ayni"'], ['QC-----D4A','','"ayni"']], # 36 [['QC-----P1R','','"U"']], # 37 [['QC-----P1I','','"Una"'], ['QC-----P1A','','"Una"']], # 38 [['QC-----P2R','','"I"'], ['QC-----P4R','','"I"']], # 39 [['QC-----P2I','','"Ina"'], ['QC-----P4I','','"Ina"'], ['QC-----P2A','','"Ina"'], ['QC-----P4A','','"Ina"']], # 40 [['QV----F-1D','al','"u"'], ['QV----F-2D','al','"i"'], ['QV----F-4D','al','"a"'], ['QV----F-1C','al','"u"'], ['QV----F-2C','al','"i"'], ['QV----F-4C','al','"a"']], # 41 [['QV----M-1D','al','"u"'], ['QV----M-2D','al','"i"'], ['QV----M-4D','al','"a"'], ['QV----M-1C','al','"u"'], ['QV----M-2C','al','"i"'], ['QV----M-4C','al','"a"']], # 42 [['QV----F-1I','','"uN"'], ['QV----F-2I','','"iN"'], ['QV----F-1R','','"u"'], ['QV----F-2R','','"i"'], ['QV----F-4R','','"a"'], ['QV----F-1A','','"u"'], ['QV----F-2A','','"i"'], ['QV----F-4A','','"a"'], ['QV----F-1L','','"u"'], ['QV----F-2L','','"i"'], ['QV----F-4L','','"a"']], # 43 [['QV----F-1R','','"u"'], ['QV----F-2R','','"i"'], ['QV----F-4R','','"a"']], # 44 [['QV----F-4I','','"aN"']], # 45 [['QV----M-1I','','"uN"'], ['QV----M-2I','','"iN"'], ['QV----M-4I','','"aN"'], ['QV----M-1R','','"u"'], ['QV----M-2R','','"i"'], ['QV----M-4R','','"a"'], ['QV----M-1A','','"u"'], ['QV----M-2A','','"i"'], ['QV----M-4A','','"a"'], ['QV----M-1L','','"u"'], ['QV----M-2L','','"i"'], ['QV----M-4L','','"a"']], # 46 [['QL------1D','al','"Una"']], # 47 [['QL------2D','al','"Ina"'], ['QL------4D','al','"Ina"']], # 48 [['QL------1R','','"U"']], # 49 [['QL------1I','','"Una"'], ['QL------1A','','"Una"']], # 50 [['QL------2R','','"I"'], ['QL------4R','','"I"']], # 51 [['QL------2I','','"Ina"'], ['QL------4I','','"Ina"'], ['QL------2A','','"Ina"'], ['QL------4A','','"Ina"']], # 52 [['QV----F-1I','','"uN"'], ['QV----F-2I','','"iN"']], # 53 [['QV----F-1R','','"u"'], ['QV----F-2R','','"i"'], ['QV----F-4R','','"a"'], ['QV----F-1A','','"u"'], ['QV----F-2A','','"i"'], ['QV----F-4A','','"a"'], ['QV----F-1L','','"u"'], ['QV----F-2L','','"i"'], ['QV----F-4L','','"a"']], # 54 [['QI----M-1D','al','"Ani"']], # 55 [['QI----F-1D','al','"Ani"']], # 56 [['QI----F-2D','al','"ayni"'], ['QI----F-4D','al','"ayni"']], # 57 [['QI----M-2D','al','"ayni"'], ['QI----M-4D','al','"ayni"']], # 58 [['QI----M-1R','','"A"']], # 59 [['QI----M-1I','','"Ani"'], ['QI----M-1A','','"Ani"']], # 60 [['QI----F-1R','','"A"']], # 61 [['QI----F-1I','','"Ani"'], ['QI----F-1A','','"Ani"']], # 62 [['QI----F-2R','','"ay"'], ['QI----F-4R','','"ay"']], # 63 [['QI----F-2I','','"ayni"'], ['QI----F-4I','','"ayni"'], ['QI----F-2A','','"ayni"'], ['QI----F-4A','','"ayni"']], # 64 [['QI----M-2R','','"ay"'], ['QI----M-4R','','"ay"']], # 65 [['QI----M-2I','','"ayni"'], ['QI----M-4I','','"ayni"'], ['QI----M-2A','','"ayni"'], ['QI----M-4A','','"ayni"']], # 66 [['QI----F-1D','al','"u"'], ['QI----F-2D','al','"i"'], ['QI----F-4D','al','"a"']], # 67 [['QI----M-1D','al','"u"'], ['QI----M-2D','al','"i"'], ['QI----M-4D','al','"a"']], # 68 [['QI----F-1I','','"u"'], ['QI----F-2I','','"a"'], ['QI----F-4I','','"a"'], ['QI----F-1R','','"u"'], ['QI----F-2R','','"i"'], ['QI----F-4R','','"a"'], ['QI----F-1A','','"u"'], ['QI----F-2A','','"i"'], ['QI----F-4A','','"a"']], # 69 [['QI----M-1I','','"uN"'], ['QI----M-2I','','"iN"'], ['QI----M-1R','','"u"'], ['QI----M-2R','','"i"'], ['QI----M-4R','','"a"'], ['QI----M-1A','','"u"'], ['QI----M-2A','','"i"'], ['QI----M-4A','','"a"']], # 70 [['QI----M-4I','','"aN"']], # 71 [['QI----F-1I','','"uN"'], ['QI----F-2I','','"iN"'], ['QI----F-4I','','"aN"'], ['QI----F-1R','','"u"'], ['QI----F-2R','','"i"'], ['QI----F-4R','','"a"'], ['QI----F-1A','','"u"'], ['QI----F-2A','','"i"'], ['QI----F-4A','','"a"']], # 72 [['QX----F-1D','al','"u"'], ['QX----F-2D','al','"i"'], ['QX----F-4D','al','"a"']], # 73 [['QX----M-1D','al','"u"'], ['QX----M-2D','al','"i"'], ['QX----M-4D','al','"a"']], # 74 [['QX----F-1I','','"uN"'], ['QX----F-2I','','"iN"'], ['QX----F-1R','','"u"'], ['QX----F-2R','','"i"'], ['QX----F-4R','','"a"'], ['QX----F-1A','','"u"'], ['QX----F-2A','','"i"'], ['QX----F-4A','','"a"']], # 75 [['QX----F-4I','','"aN"']], # 76 [['QX----M-1I','','"uN"'], ['QX----M-2I','','"iN"'], ['QX----M-4I','','"aN"'], ['QX----M-1R','','"u"'], ['QX----M-2R','','"i"'], ['QX----M-4R','','"a"'], ['QX----M-1A','','"u"'], ['QX----M-2A','','"i"'], ['QX----M-4A','','"a"']], # 77 [['QY----M---','','"a"']], # 78 [['QY----F---','','"a"']], ] } sub tmpl { return [ # 0 '_____', # 1 '_____ |< At', # 2 'KaRADIS', # 3 'KiRDUS', # 4 'KiRDUS |< At', # 5 'HaFCAL', # 6 'FaCL', # 7 'FuCUL', # 8 'FiCL |< At', # 9 'FiCL |< aT', # 10 'HACAL', # 11 'FiC |< At', # 12 'FiC |< aT', # 13 'FiC', # 14 '"F_IC" |< At', # 15 '"F_IC" |< aT', # 16 '"F_IC"', # 17 'FiCL', # 18 'FaCALI', # 19 'FaCALI |< aT', # 20 'FaCAL', # 21 'FaCL |< aT', # 22 'HaFCaL', # 23 'HaFCaL |< aT', # 24 'FaCAL |< aT', # 25 'IFC', # 26 'IFC |< aT', # 27 'FiCLY', # 28 'FaCaL', # 29 'FACiL', # 30 'FACiL |< aT', # 31 'FaCaL |< aT', # 32 'FaCaL |< At', ] } sub cont { return [ # 0 [['']], # 1 [['SP---1-D2-','SP---1-P2-','SP---2--2-','SP---3--2-']], # 2 [['SP---1-S2-']], # 3 [['SP---1-D2-','SP---1-P2-','SP---2--2-','SP---3--2-'],['SP---1-S2-']], # 4 [[''],['SP---1-D2-','SP---1-P2-','SP---2--2-','SP---3--2-']], # 5 [[''],['SP---1-D2-','SP---1-P2-','SP---2--2-','SP---3--2-'],['SP---1-S2-']], # 6 [['QC-----S2I','QC-----S2R','QC-----S2A']], ] } 1; ElixirFM-1.1/lib/ElixirFM/Exec.pm0000444001432400135600000000760111420132771015210 0ustar smrzufal# ########################################################################## Otakar Smrz, 2009/03/21 # # ElixirFM Executable ############################################################################## # $Id: Exec.pm 946 2010-04-12 19:27:23Z smrz $ package ElixirFM::Exec; use strict; our $VERSION = join '.', '1.1', q $Revision: 946 $ =~ /(\d+)/; use Encode; use File::Spec; use File::Temp; use File::Which; our $elixir = 'elixir'; our %elixir = (); sub import { my $caller = caller 0; if (@_ > 1 and $_[1] ne '') { my @path = File::Spec->splitpath($_[1]); if ($path[0] . $path[1] eq '' and $path[2] ne '.' and $path[2] ne '..') { if (defined which $_[1]) { $elixir{$caller} = $_[1]; } else { $elixir{$caller} = File::Spec->join($_[1], $elixir); warn "No program like '$_[1]' or '$elixir{$caller}' can be executed" unless grep { -x $elixir{$caller} . $_ } '', split ';', $ENV{'PATHEXT'} || '.exe;.com;.bat'; } } else { $elixir{$caller} = -d $_[1] ? File::Spec->join($_[1], $elixir) : $_[1]; warn "No program like '$elixir{$caller}' can be executed" unless grep { -x $elixir{$caller} . $_ } '', split ';', $ENV{'PATHEXT'} || '.exe;.com;.bat'; } } else { delete $elixir{$caller}; warn "No program like '$elixir' can be executed" unless defined which $elixir; } return exists $elixir{$caller} ? $elixir{$caller} : $elixir; } sub elixir { my $mode = defined $_[0] && ! ref $_[0] ? shift : ''; my $opts = defined $_[0] && ref $_[0] eq 'ARRAY' ? shift : []; my $text = join "", map { $_ =~ /\n$/ ? $_ : $_ . "\n" } @_; my $code = Encode::is_utf8($text); my $caller = caller 0; $caller = caller 1 if $caller eq __PACKAGE__; my $system = exists $elixir{$caller} ? $elixir{$caller} : $elixir; my $params = join " ", $mode, map { '"' . $_ . '"' } @{$opts}; my $handle = new File::Temp; print $handle $code ? encode "utf8", $text : $text; my $data = scalar `"$system" $params < "$handle"`; return $code ? decode "utf8", $data : $data; } sub main { return elixir @_; } sub resolve { return elixir 'resolve', @_; } sub inflect { return elixir 'inflect', @_; } sub derive { return elixir 'derive', @_; } sub lookup { return elixir 'lookup', @_; } 1; __END__ =head1 NAME ElixirFM::Exec - Interface to the ElixirFM executable =head1 REVISION $Revision: 946 $ $Date: 2010-04-12 21:27:23 +0200 (Mon, 12 Apr 2010) $ =head1 SYNOPSIS use ElixirFM::Exec; # 'elixir' will be tried out use ElixirFM::Exec '.'; # './elixir' will be invoked use ElixirFM::Exec './elixir'; # './elixir' will be invoked use ElixirFM::Exec 'some/other'; # 'some/other/elixir' unless # 'some/other' is executable ElixirFM::Exec::elixir 'help'; import ElixirFM::Exec 'other/elixir'; # switching to 'other/elixir' ElixirFM::Exec::elixir 'inflect', ['(1320,1)'], "V[PI]---3MS--", "N------P-[IRD]"; ElixirFM::Exec::inflect ['(1320,1)'], "V[PI]---3MS--", "N------P-[IRD]"; =head1 DESCRIPTION The L module provides a simple interface for invoking the ElixirFM executable, which you need to install on your system yourself. The download and further information are at L. =head1 AUTHOR Otakar Smrz C<< >>, L =head1 COPYRIGHT & LICENSE Copyright (C) 2005-2010 Otakar Smrz This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 3. =cut ElixirFM-1.1/lib/ElixirFM/Resolve.pm0000444001432400135600000001206311420132771015741 0ustar smrzufal# ########################################################################## Otakar Smrz, 2008/07/07 # # ElixirFM Resolve ################################################################################# # $Id: Resolve.pm 826 2009-03-09 22:24:19Z smrz $ package ElixirFM::Resolve; use 5.008; use strict; our $VERSION = '1.1' || do { q $Revision: 826 $ =~ /(\d+)/; sprintf "%4.2f", $1 / 100 }; # ################################################################################################## # # ################################################################################################## use base 'ElixirFM::Data::Compose'; use ElixirFM; use Encode::Arabic; use Encode::Arabic::Buckwalter ':xml'; use Data::Dumper; $Data::Dumper::Indent = 0; $Data::Dumper::Terse = 1; sub data { return $_[0]->{'data'}{$_[1]} if exists $_[0]->{'data'}{$_[1]}; return []; } sub lexs { return $_[0]->{'lexs'}[$_[1]]; } sub tags { return $_[0]->{'tags'}[$_[1]]; } sub tmpl { return $_[0]->{'tmpl'}[$_[1]]; } sub cont { return $_[0]->{'cont'}[$_[1]]; } sub resolve { my ($q, $word) = @_; return $q->resolves([], ['----------'], $word); } sub resolves { my ($q, $p, $r, $word) = @_; if ($word eq '') { return $p if grep { $_ eq '' } @{$r}; return; } my @return = (); for (my $i = length $word; $i > 0; $i--) { my $lookup = $q->data(substr $word, 0, $i); my %assoc = (); foreach (@{$lookup}) { my ($lexs, @data) = @{$_}; foreach (ElixirFM::tuples @data) { foreach my $cont (map { Data::Dumper->Dump([$_]) } @{$q->cont($_->[1])}) { $assoc{$cont} = [] unless exists $assoc{$cont}; push @{$assoc{$cont}}, [$lexs, $_->[0]]; } } } my $next = substr $word, $i; foreach (keys %assoc) { my @data = $q->filter($r, @{$assoc{$_}}); next unless @data; my $cont = eval $_; push @return, $q->resolves([@{$p}, [@data]], $cont, $next); if ($i == 1 and 'll' eq substr $word, 0, 2) { push @return, $q->resolves([@{$p}, [@data]], $cont, 'A' . $next), $q->resolves([@{$p}, [@data]], $cont, 'Al' . $next); } } } return @return; } sub filter { my ($q, $r, @data) = @_; my @return; foreach (@data) { my ($lexs, $data) = @{$_}; my @lexs = (); foreach (ElixirFM::tuples @{$data}) { my ($tmpl, $tags) = @{$_}; my @tmpl = grep { my $t = $_->[0]; grep { ElixirFM::restrict($_, $t) eq $t and ($_ eq $t or $_ ne 'S---------') } grep { $_ ne '' } @{$r} } @{$q->tags($tags)}; push @lexs, [$tmpl, [@tmpl]] if @tmpl; } push @return, [$lexs, [@lexs]] if @lexs; } return @return; } sub pretty { my ($q, @data) = @_; return join "\n::\n", map { join "\n:\n", map { join "", map { my ($lexs, $data) = @{$_}; $lexs = $q->lexs($lexs); my $r = "\n"; $r .= join "\t", @{$lexs}[0 .. 2], $lexs->[4], "($lexs->[5],$lexs->[6])" . "\n", Data::Dumper->Dump([$lexs->[3]]); foreach (@{$data}) { my ($tmpl, $tags) = ($q->tmpl($_->[0]), $_->[1]); $r .= join "", map { "\n\t" . $_ } map { my $t = ElixirFM::template($tmpl, $_->[1], $_->[-1]); my $m = ElixirFM::merge($lexs->[1], $t); my $p = encode "utf8", decode "zdmg", $m; join "\t", $_->[0], $t, $m, $p } @{$tags}; } $r . "\n" } @{$_} } @{$_} } @data; } 1; __END__ =head1 NAME ElixirFM::Resolve - Interfaces to the ElixirFM system in Haskell =head1 REVISION $Revision: 826 $ $Date: 2009-03-09 23:24:19 +0100 (Mon, 09 Mar 2009) $ =head1 SYNOPSIS use ElixirFM::Resolve; =head1 DESCRIPTION The L module reimplements some of the functionality of the ElixirFM system written in Haskell. In particular, it includes the L and L modules providing the algorithms and data for advanced Arabic morphological analysis, see also the L executable. Other applications, such as morphological generation, can also be implemented with ElixirFM. =head1 SUPPORT You can find documentation for this module with the perldoc command. perldoc ElixirFM You can also look for information at L. =head1 AUTHOR Otakar Smrz C<< >>, L =head1 COPYRIGHT & LICENSE Copyright (C) 2009-2005 Otakar Smrz, 2002 Tim Buckwalter This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 3. =cut ElixirFM-1.1/lib/ElixirFM/CGI.pm0000444001432400135600000002353011420132771014725 0ustar smrzufal# ###################################################################### Otakar Smrz, 2007/10/05 # # ElixirFM Online Interface #################################################################### # $Id: CGI.pm 946 2010-04-12 19:27:23Z smrz $ package ElixirFM::CGI; use strict; our $VERSION = join '.', '1.1', q $Revision: 946 $ =~ /(\d+)/; use base 'CGI::Application::FastCGI'; use CGI::Fast ':standard'; use base 'Exporter'; our @EXPORT = (qw 'display_header display_headline display_welcome display_footline display_footer', qw 'escape quote revert', qw '@modes %memoize %enc_hash @enc_list'); our @modes = qw 'home resolve inflect derive lookup'; our %memoize = (); our %enc_hash = ( 'ArabTeX' => 'TeX', 'Buckwalter' => 'Tim', 'Unicode' => 'UTF' ); our @enc_list = reverse sort keys %enc_hash; sub setup { my $c = shift; no strict; $c->run_modes('home' => \&{__PACKAGE__ . '::main'}, map { $_ => \&{__PACKAGE__ . '::' . (ucfirst $_) . '::main'} } @modes[1 .. @modes - 1]); use strict; $c->mode_param('mode'); $c->start_mode('home'); } # use base 'CGI::Application::FastCGI'; sub run { my $self = shift; my $request = FCGI::Request(); $self->fastcgi($request); while ($request->Accept >= 0) { $self->reset_query; $self->CGI::Application::run; last if $self->reinit(); } } sub reinit { return -M $0 < 0; } sub escape ($) { my $text = shift; $text =~ s/\&/\&/g; $text =~ s/\/\>/g; return $text; } sub quote ($) { return $_[0] eq '' ? '""' : $_[0]; } sub revert ($) { my $text = shift; $text =~ s/\>/\>/g; $text =~ s/\</\query(); my $r; $q->charset('utf-8'); $r .= $q->start_html(-title => "ElixirFM 1.1 Online Interface", -encoding => $q->charset(), -meta => { 'keywords' => join ' ', 'Arabic morphological analyzer analysis generator generation', 'morphology lexicon dictionary lookup inflection derivation rules grammar language' }, -style => [ {-src => 'http://quest.ms.mff.cuni.cz/elixir/elixir.css', -type => 'text/css'}, {-src => 'http://quest.ms.mff.cuni.cz/elixir/listexpander/listexpander.css', -type => 'text/css'} ], -script => [ {-src => 'http://quest.ms.mff.cuni.cz/elixir/elixir.js', -type => 'text/javascript'}, {-src => 'http://quest.ms.mff.cuni.cz/elixir/listexpander/listexpander.js', -type => 'text/javascript'} ]); return $r; } sub display_headline ($) { my $c = shift; my $q = $c->query(); my $m = $q->param($c->mode_param()); my $r; $r .= $q->h1($q->a({'href' => 'http://sourceforge.net/projects/elixir-fm/'}, "ElixirFM 1.1"), ( $m eq 'home' ? ('Online', 'Interface') : (ucfirst $m, 'Online') )); $r .= $q->div({-class => "menu"}, map { $q->param($c->mode_param()) eq $_ ? $q->span(ucfirst $_) : $q->a({'href' => 'index.fcgi?mode=' . $_}, ucfirst $_) } @modes); return $r; } sub display_welcome ($) { my $c = shift; my $q = $c->query(); my $r; $r .= $q->p("Welcome to the online interface to", $q->a({-href => 'http://sourceforge.net/projects/elixir-fm/'}, "ElixirFM") . ", the implementation of", $q->a({-href => 'http://ufal.mff.cuni.cz/~smrz/elixir-thesis.pdf'}, "Functional Arabic Morphology"), "written in Haskell and Perl."); $r .= $q->p("ElixirFM can work in four different modes. This request is processed by the", $q->code($q->param($c->mode_param())), "method of the morphological system."); return $r; } sub display_footline ($) { my $c = shift; my $q = $c->query(); my $r; $r .= $q->p({'style' => 'margin-top: 30px'}, "(C) Otakar Smrz 2010, Viktor Bielicky 2010, Tim Buckwalter 2002. GNU General Public License", $q->a({-href => 'http://www.gnu.org/licenses/'}, "GNU GPL 3") . "."); $r .= $q->p("ElixirFM is an", $q->a({-href => 'http://sourceforge.net/projects/elixir-fm/'}, "open-source online"), "project.", "You can contribute to its development with your suggestions!"); $r .= $q->p("Contact", $q->a({-href => 'http://ufal.mff.cuni.cz/~smrz/'}, "otakar.smrz"), "at", $q->a({-href => 'http://ufal.mff.cuni.cz/'}, "mff.cuni.cz") . ",", "Institute of Formal and Applied Linguistics, Charles University in Prague."); return $r; } sub display_footer ($) { my $c = shift; my $q = $c->query(); my $r; $r .= $q->p( # {'style' => 'height: 31px'}, # $q->a({'style' => 'float: right', # 'href' => "http://jigsaw.w3.org/css-validator/check?uri=referer"}, # $q->img({'border' => "0", # 'src' => "http://www.w3.org/Icons/valid-css2", # 'alt' => "Valid CSS level 2.1", # 'height' => "31", 'width' => "88"})), # $q->a({'style' => 'float: right', # 'href' => "http://validator.w3.org/check?uri=referer"}, # $q->img({'border' => "0", # 'src' => "http://www.w3.org/Icons/valid-xhtml10", # 'alt' => "Valid XHTML 1.0 Transitional", # 'height' => "31", 'width' => "88"})), $q->a({'style' => 'float: right', 'href' => "http://sourceforge.net/projects/elixir-fm/"}, $q->img({'border' => "0", 'style' => 'margin-bottom: 20px', 'src' => "http://sflogo.sourceforge.net/sflogo.php?group_id=181087&type=13", 'alt' => "ElixirFM at SourceForge.net", 'height' => "30", 'width' => "120"})) ); $r .= $q->script({-type => 'text/javascript', -src => 'http://api.yamli.com/js/yamli_api.js'}, ""); $r .= $q->script({-type => 'text/javascript'}, join ' ', split ' ', q { if (typeof(Yamli) == "object") { Yamli.init({ uiLanguage: "en", startMode: "onOrUserDefault", settingsPlacement: 'inside', showTutorialLink: false, showDirectionLink: false }); elixirYamli(''); } }); $r .= $q->end_html(); return $r; } sub show_param ($@) { my $q = shift; return join '', map { '&' . $_ . '=' . $q->param($_) } @_; } require ElixirFM::CGI::Resolve; require ElixirFM::CGI::Inflect; require ElixirFM::CGI::Derive; require ElixirFM::CGI::Lookup; sub main ($) { my $c = shift; my $q = $c->query(); my $r = ''; $q->param($c->mode_param(), 'home'); $r .= display_header $c; $r .= display_headline $c; $r .= $q->p("Welcome to the online interface to", $q->a({-href => 'http://sourceforge.net/projects/elixir-fm/'}, "ElixirFM") . ", the implementation of", $q->a({-href => 'http://ufal.mff.cuni.cz/~smrz/elixir-thesis.pdf'}, "Functional Arabic Morphology"), "written in Haskell and Perl."); $r .= $q->p("ElixirFM can process words of", $q->a({-href => 'http://en.wikipedia.org/wiki/Dictionary_of_Modern_Written_Arabic'}, "Modern Written Arabic"), "using four different modes.", "Here, you can learn how to use these modes for various purposes."); $r .= $q->p("ElixirFM is further documented at", $q->a({-href => 'http://elixir-fm.wiki.sourceforge.net/'}, "ElixirFM Wiki") . ".", "The multiple scripts of this site are best viewed with", $q->a({-href => 'http://sourceforge.net/projects/dejavu/'}, "DejaVu Fonts") . "."); $r .= $q->h2($q->a({-href => 'index.fcgi?mode=resolve'}, 'Resolve')); $r .= $q->p("This mode provides tokenization and morphological analysis of the inserted text,", "even if you omit some symbols or do not spell everything correctly."); $r .= $q->p("You can experiment with entering the text in various notations."); # $r .= $q->p("You can check the 'Fuzzy Notation' option due to which the resolution of the input words is less strict."); $r .= $q->h2($q->a({-href => 'index.fcgi?mode=inflect'}, 'Inflect')); $r .= $q->p("This mode lets you inflect words into the forms required by context.", "You only need to define the grammatical parameters of the expected word forms."); $r .= $q->p("You can either enter natural language descriptions, or you can specify the parameters using the positional morphological tags."); $r .= $q->h2($q->a({-href => 'index.fcgi?mode=derive'}, 'Derive')); $r .= $q->p("This mode lets you derive words of similar meaning but different grammatical category.", "You only need to tell the desired grammatical categories."); $r .= $q->p("You can either enter natural language descriptions, or you can specify the parameters using the positional morphological tags."); $r .= $q->h2($q->a({-href => 'index.fcgi?mode=lookup'}, 'Lookup')); $r .= $q->p("This mode can lookup lexical entries by the citation form and nests of entries by the root,", "and lets you search also in the English translations."); $r .= $q->p("You can try enclosing the text in quotes or parentheses if needed."); $r .= display_footline $c; $r .= display_footer $c; return $r; } 1; ElixirFM-1.1/LICENSE0000444001432400135600000010451311420132771012546 0ustar smrzufal GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . ElixirFM-1.1/README0000444001432400135600000000155111420132771012417 0ustar smrzufalElixirFM - Interfaces to the ElixirFM system in Haskell The ElixirFM module reimplements some of the functionality of the ElixirFM system written in Haskell. The Exec::ElixirFM module provides a simple interface for invoking the ElixirFM executable, which you need to install on your system yourself. ElixirFM is documented at http://elixir-fm.wiki.sourceforge.net/. INSTALLATION To install this module, run the following from the command line: perl Build.PL Build Build install DOCUMENTATION Visit the site http://sourceforge.net/projects/elixir-fm/ or run perldoc ElixirFM in order to get more information on this and related software. COPYRIGHT AND LICENCE Copyright (C) 2010-2005 Otakar Smrz, 2002 Tim Buckwalter This program is free software. You can redistribute it and/or modify it under the terms of the GNU General Public License version 3. ElixirFM-1.1/Build.PL0000444001432400135600000000114411420132771013031 0ustar smrzufaluse Module::Build; use strict; use warnings; my $build = Module::Build->new( module_name => 'ElixirFM', license => 'gpl', dist_author => 'Otakar Smrz ', dist_version_from => 'lib/ElixirFM.pm', requires => { 'perl' => 5.008, 'Encode::Arabic' => 0, }, build_requires => { 'Encode::Arabic' => 0, 'Test::More' => 0, }, add_to_cleanup => [ 'ElixirFM-*' ], ); $build->create_build_script(); ElixirFM-1.1/META.yml0000444001432400135600000000202411420132771013004 0ustar smrzufal--- name: ElixirFM version: 1.1 author: - 'Otakar Smrz ' abstract: Interfaces to the ElixirFM system implementing Functional Arabic Morphology license: gpl resources: license: ~ requires: Encode::Arabic: 0 perl: 5.008 build_requires: Encode::Arabic: 0 Test::More: 0 provides: ElixirFM: file: lib/ElixirFM.pm version: 1.1 ElixirFM::CGI: file: lib/ElixirFM/CGI.pm version: 1.1.946 ElixirFM::CGI::Derive: file: lib/ElixirFM/CGI/Derive.pm version: 1.1.946 ElixirFM::CGI::Inflect: file: lib/ElixirFM/CGI/Inflect.pm version: 1.1.946 ElixirFM::CGI::Lookup: file: lib/ElixirFM/CGI/Lookup.pm version: 1.1.946 ElixirFM::CGI::Resolve: file: lib/ElixirFM/CGI/Resolve.pm version: 1.1.964 ElixirFM::Exec: file: lib/ElixirFM/Exec.pm version: 1.1.946 ElixirFM::Resolve: file: lib/ElixirFM/Resolve.pm version: 1.1 generated_by: Module::Build version 0.32 meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.2.html version: 1.2 ElixirFM-1.1/MANIFEST0000444001432400135600000000102511420132771012664 0ustar smrzufalBuild.PL bin/elixir-column.pl bin/elixir-compose.pl bin/elixir-resolve.pl cgi/elixir/index.fcgi css/elixir.css css/elixir.js css/listexpander/collapsed.gif css/listexpander/empty.gif css/listexpander/expanded.gif css/listexpander/listexpander.css css/listexpander/listexpander.js LICENSE lib/ElixirFM.pm lib/ElixirFM/CGI.pm lib/ElixirFM/CGI/Derive.pm lib/ElixirFM/CGI/Inflect.pm lib/ElixirFM/CGI/Lookup.pm lib/ElixirFM/CGI/Resolve.pm lib/ElixirFM/Data/Compose.PL lib/ElixirFM/Exec.pm lib/ElixirFM/Resolve.pm MANIFEST META.yml README