Thursday, October 13, 2016

Some thoughts on a simplified approach to ancient Greek grammar using only personal constructions. Since, both Infinitive and Participle constructions can be written as personal clauses with subordinating conjunctions, study of their syntax can be postponed.

Cover the 90% of greek verb morphology while ignoring the exceptions and rare. Instead of 6 principle parts, each verb has an imperfective and aorist stem via their infinitive. Regular verbs form the aorist from the imperfect by adding (s)a. Irregular verbs have an aorist reduced in some way from imperfect or an irregular form.
Past indicative has obligatory augment, either for carrying the stress or for disambiguating the 1st and 2nd plural.

Active endings for use when there is no returned action on subject (either partial or even figurative/implied)

PRESENT TENSES: after consonants or a/e/o uncontracted vowel stems (contains theme vowel): o^ eis ei omen ete onti
after vowels: mi si ti men te nti (not ousi)

PAST TENSES: after consonants (contains theme vowel): on es e omen ete on
after vowels: n s - men te n (all strong root aorists lengthen vowel)

IMPERATIVE: -(e) and -(e)te, etc

Medio-passive endings for use when there is either partial/implied returned action on subject or complete (reflexive); or subject receive action from (named) agent.

PRESENT TENSES: after consonants (contains theme vowel): omai esai etai ometha esthe ontai
after vowels: (remove theme vowel)

PAST TENSES: after consonants (contains theme vowel): ome^n eso eto ometha esthe onto
after vowels: (remove theme vowel)

IMPERATIVE: ?

SUBJUNCTIVE always uses the lengthened theme vowel endings (absorbs any stem vowel), OPTATIVE uses the stem plus iota plus the past endings without augment.

Example: te/mnein (regular aorist in -sa following rules, since there is no aorist form)
MinfVaAi te/mnein ; MparVaAi  te/mno^n
MimpVaAi: te/mne te/mneto^ te/mnete te/mnonto^n; (no past imperative)
MindVaAi: te/mn-o^ eis ei omen ete onti; e/temn-on es e omen ete on
MconVaAi: te/mn-o^ e^s e^ o^men e^te o^nti; te/mnoin ois oi oimen oite oin;
MimpVmpAi: ?
MindVmpAi: te/mnomai esai etai ometha esthe ontai; e/temnon es e omen ete on
MconVmpAi: te/mno^ e^s e^ o^men e^te o^nti; te/mnoin ois oi oimen oite oin

MinfVaAi tei/nai ; MparVaAi  tei/nas
MimpVaAa: tei/na tei/nate; --
MindVaAa: tei/nami.. ; e/teina  (present is not used in writing)
MconVaAi: tei/no^.. ; tai/naimi
MimpVmpAa: tei/naso teina/stho^ tai/nasthe teina/stho^n; (no past imperative)
MindVmpAa: tei/namai.. ; e/teiname^n  (present is not used in writing)
MconVmpAi: tei/no^mai.. ; tai/naime^n

POSTPONE AORIST PASSIVE DISTINCT FROM MIDDLE
FUTURE  is conjunctive, POSTPONE COMPLETE FUTURE SYSTEM UNTIL AORIST PASSIVE
PERFECT is with Perfect participle (redup + ko^s/kot-)  and einai.

IMPERSONAL CONSTRUCTIONS WITH INFINITIVE AND PARTICIPLE
learned as translations from personal subordinate clauses later
literature constantly footnoted until these are learned

Infinitives as hoti clauses when possible, nouns otherwise: need a way to automate this



Participles as hoti (adj) or epeide^,hote,kaiper (adv) clauses, with the verb in 3rd person and number taken from the participle, disregarding the case and number.




Wednesday, November 25, 2015

Making up Lorem Ipsum

The following javascript function showcases two inner functions that have only scope for the outer function. Not something I use often, but seemed apt for what I was doing here. The output generated looks like this (a cross between Hungarian/Turkish and Indonesian?)
ur tojo imfuw ukba aral inoma bodfuy iknedik ofat aav id evajuragonephu nimemobi umajvamjo lo bijpaulim ugpeibgac depi puisrejnahafi getegvoeysepied hu iclupgak parjonuf bos aivhocu us pokehekgerbak mugu itdaceii ikimhup penka iduab tojeme idmethe nalay ugservanuu atub pavdiv sep cowgimaag gon ipokipaberuvapadaehovcahat lonugirfi acasinal giosug dihocadu vumfilocoy ru benumeohuj rejav puj cidomten rom godioncogal likviu hucous cecioieruhubewuda naivac ive.

function randomClauseMarkup() {

    var initials = "bc df gh jk lm np rs tv"; // chance of an initial is 66%
    var vowels = "aeiou"; // 100%, since all syllables must have vowels
    var finals = "y w b c d f g j k l m n p r s t v"; // change of final is 50%
    var randomsyl=function() {
        var initial = initials.charAt( Math.floor(Math.random()*initials.length));
        var vowel = vowels.charAt( Math.floor(Math.random()*vowels.length));
        var final = finals.charAt( Math.floor(Math.random()*finals.length));
        return (initial+vowel+final).trim()
    }

    var randomword=function() {
        var ns= 1 + Math.floor(Math.random()*4);
        var w = '';
        while (w.length<ns*2) w += randomsyl();
        return ' <span class="word">'+w+'</span>';
    }

    var s = '';
    var numwords = 3 +  Math.floor(Math.random()*30); // these clauses will have [3,33] words
    for (w = 0; w < numwords; w++) {
        s += randomword();
    }
    return ' <span class="clause">'+s+'</span>';
}

To turn the string into html, just use $.parseHTML or load element with .html()
 

Saturday, November 7, 2015

Digrams, or two letter graphs, in any language

Every wonder what the most likely letter is after a given letter in a language. Suppose you needed to know to write an interactive keyboard on a mobile phone to save that precious real estate, instead of taking up half the screen like the iPhone does. That is exactly one of my current projects. So, here is some javascript code to get those frequency graphs, given a list of possible letters (and punctuation) along with a sample test.

Here is a typing program I developed to use timed digrams as a way to improve typing:
TYPOR
Comments?



var letters = "abcdefghijklmnopqrstuvwzyxABCDEFGHIJKLMNOPQRSTUVWXYZ ,;:.";

var sampletext = "As they rounded a bend in the path that ran beside the river, Lara recognized the silhouette of a fig tree atop a nearby hill. The weather was hot and the days were long. The fig tree was in full leaf, but not yet bearing fruit. Soon Lara spotted other landmarks—an outcropping of limestone beside the path that had a silhouette like a man’s face, a marshy spot beside the river where the waterfowl were easily startled, a tall tree that looked like a man with his arms upraised. They were drawing near to the place where there was an island in the river. The island was a good spot to make camp. They would sleep on the island tonight. Lara had been back and forth along the river path many times in her short life. Her people had not created the path—it had always been there, like the river—but their deerskin-shod feet and the wooden wheels of their handcarts kept the path well worn. Lara’s people were salt traders, and their livelihood took them on a continual journey. At the mouth of the river, the little group of half a dozen intermingled families gathered salt from the great salt beds beside the sea. They groomed and sifted the salt and loaded it into handcarts. When the carts were full, most of the group would stay behind, taking shelter amid rocks and simple lean-tos, while a band of fifteen or so of the heartier members set out on the path that ran alongside the river. With their precious cargo of salt, the travelers crossed the coastal lowlands and traveled toward the mountains. But Lara’s people never reached the mountaintops; they traveled only as far as the foothills. Many people lived in the forests and grassy meadows of the foothills, gathered in small villages. In return for salt, these people would give Lara’s people dried meat, animal skins, cloth spun from wool, clay pots, needles and scraping tools carved from bone, and little toys made of wood. Their bartering done, Lara and her people would travel back down the river path to the sea. The cycle would begin again. It had always been like this. Lara knew no other life. She traveled back and forth, up and down the river path. No single place was home. She liked the seaside, where there was always fish to eat, and the gentle lapping of the waves lulled her to sleep at night. She was less fond of the foothills, where the path grew steep, the nights could be cold, and views of great distances made her dizzy. She felt uneasy in the villages, and was often shy around strangers. The path itself was where she felt most at home. She loved the smell of the river on a hot day, and the croaking of frogs at night. Vines grew amid the lush foliage along the river, with berries that were good to eat. Even on the hottest day, sundown brought a cool breeze off the water, which sighed and sang amid the reeds and tall grasses.";

var digrams = new Array(letters.length);
for (var i=0; i<letters.length; i++) {
 digrams[i] = new Array(letters.length);
 for (var j=0; j<letters.length; j++) {
  digrams[i][j] = 0;
 }
}

var nextLets = new Array(letters.length);
for (var i=0; i<letters.length; i++) {
 nextLets[i] = new Array();
}

loadDigrams(sampletext);
document.writeln("<table border='1'><tr><td></td>");
for (var j=0; j<letters.length; j++) {
 document.writeln("<td align='center'>"+letters[j]+"</td>");
}
document.writeln("</tr>");
for (var i=0; i<letters.length; i++) {
 document.write("<tr><td>"+letters[i]+"</td>");
 for (var j=0; j<letters.length; j++) {
  document.writeln("<td align='right'>"+digrams[i][j]+"</td>");
 }
 document.writeln("</tr>");
}
document.writeln("</table>");

loadNextlets();
document.writeln("<div>");
for (var i=0; i<letters.length; i++) {
 document.write("<div><span style='border: 1px solid black;'>"+letters[i].replace(' ','_')+"</span> ");
 for (var j=0; j<nextLets[i].length; j++) {
  if (!nextLets[i][j]) continue;
  document.writeln("&nbsp;<span style='text-align:center;border: 1px solid black;'>"+nextLets[i][j].replace(' ','_')+"</span>");
 }
 document.writeln("</div>");
}
document.writeln("</div>");



function loadDigrams(text) {
 text = text + ' ';
 for (var x=0; x<text.length-1; x++) {
   var i = letters.indexOf(text.charAt(x));
   var j = letters.indexOf(text.charAt(x+1));
   if (i>=0 && j>=0) digrams[i][j]++;
 }
}

function loadNextlets() {
 for (var x=0; x<letters.length; x++) {

  var rowvals = digrams[x].slice()
   .sort(function (a,b) {return b-a;})
   .filter(function(item,ix,ary) {return !ix || item != ary[ix-1];})

  for (var y=0; y<rowvals.length; y++) {
   if (rowvals[y]==0) break;
   nextLets[x][y] = '';
   for (var j=0; j<digrams[x].length; j++) {
    if (digrams[x][j]==rowvals[y]) { nextLets[x][y] += letters[j]; }
   }
  }

 }
}


function getRandomInt(min,max) {
    return Math.floor(Math.random()*(max-min+1)+min);
}



Sunday, November 23, 2014

Sanskrit Test Lesson


Original text (with corrections) हास्यकणिका अध्यापिका व्याकरणं पाठयति। कर्ता कः, कर्म किम्, क्रिया का इति बोधयति। तत्परं सा कृष्णफलके इदं वाक्यं लिखति - ‘मण्टुः लड्डुकं खादितुं न इच्छति।’ अध्यापिका - सुरेश, त्वं वद। अस्मिन् वाक्ये मण्टुः कः। सुरेशः - मण्टुः मूर्खः। अध्यापिका - कथम्। सुरेशः - आर्ये, कः लड्डुकं खादितुं न इच्छेत्।
Version without sandhis
हास्य-कणिका अध्यापिका व्याकरणम् पाठयति । कर्ता कः, कर्म किम्, क्रिया का इति बोधयति। तत्परम् सा कृष्ण-फलके इदम् वाक्यम् लिखति - ‘मण्टुः लड्डुकम् खादितुम् न इच्छति।’ अध्यापिका - सुरेश, त्वम् वद। अस्मिन् वाक्ये मण्टुः कः । सुरेशः - मण्टुः मूर्खः। अध्यापिका - कथम्। सुरेशः - आर्ये, कः लड्डुकम् खादितुम् न इच्छेत्।
Inter linear, literal translation हास्य-कणिका laughter-particle अध्यापिका teacher व्याकरणम् grammar पाठयति teaches। कर्ता subject कः who, कर्म object किम् what, क्रिया verb का who इति so बोधयति explains। तत्परम् thereafter सा she कृष्ण-फलके on blackboard इदम् this वाक्यम् sentence लिखति writes - ‘मण्टुः Mantu लड्डुकम् sweetmeat खादितुम् to eat न no इच्छति desires।’ अध्यापिका teacher - सुरेश Suresh, त्वम् you वद speak। अस्मिन् in this वाक्ये in sentence मण्टुः Mantu कः who। सुरेशः Suresh - मण्टुः Mantu मूर्खः fool। अध्यापिका teacher - कथम् how। सुरेशः Suresh - आर्ये madam, कः who लड्डुकम् sweetmeat खादितुम् to eat न no इच्छेत् desires।
Natural translation Joke Teacher is teaching grammar. She explains what is subject, what is object, what is verb. Then she writes this sentence on the blackboard: Mantu does not want to eat sweetmeat. Teacher: Suresh, you answer. What is Mantu in this sentence? Suresh: Mantu is a fool. Teacher: How? Suresh: Who does not want to eat sweetmeat?

Friday, November 14, 2014

First Camel Integration home project

Sanskrit Newspaper - Sanskrit Dictionary integration using Camel
1) spin up a tomcat container running camel (AWS - EC2)
2) pull from articles in http://sudharma.epapertoday.com/
3) event driven pull from dictionary http://spokensanskrit.de/
4) results merged with editorial content on  http://pradyumnsharma.blogspot.in/

Normally I would have gone with a YQL (yahoo query language) solution implemented in javascript, which could be embedded into Pradyumn's blog, but I saw this as a change to architect a simple enrichment pattern in camel, and make this available to him as a webservice.

The camel ETL component also looks promising, so I worked through the example in the Camel download. Be careful that your later version may no longer set the entity manager in the header of the camel exchange -- I simply grabbed the entity manager factory from the exchange via the registry and it worked fine.

Playing around with this example (which uses JPA to consume records as files and insert/update them into a database) naturally led me to consume instead from a webpage (sudharma) -- merely substituting the file component with the http one. WSnotification might be what is under the hood for the camel http endpoint. I ended up making the following changes to get it to work:
(CXF)
Of course, my goal was not merely to load a database, but make the data available via a webservice for the javascript client to have access to. I could have just fronted the database with a Spring Data REST client, but wanted to remain in camel land a while longer. So I am investigating routing to another http component instead.

Final comfy solution resulted in creating a new component: webpage.