[Parley-devel] Practice Sentence idea

alsaf alfraealba at gmail.com
Wed Mar 23 21:34:38 CET 2011


I've written the following Python script that generates simple sentences 
that can be copied and pasted into Parley to use as practice.

http://kde-files.org/content/show.php/Parley+Sentence+Generator?content=138154

I am going to written a detailed how-to on how to use it hopefully in 
the next few days (this is being hampered as I have been suffering from 
migraines the last few days which is limiting the amount of time I can 
spend in from the PC which I hope will clear up).

My intention is to incorporate this into Parley. Before I do, I would 
look to get input on the best way to go about incorporating it. I've 
tested this and the logic is sound so theoretically it shouldn't be too 
hard to insert the code in but how would this work with grading? Would 
the sentence be rated, errorcount and count or the individual words 
contained in the sentence be amended? Will the words be dynamically 
created each time the sentence practice option is entered or just 
created once? Will the individual words be taken from the scope of the 
lesson it belongs to or from the whole .kvmtl file?

This generates simple sentences but for anything more complex, the 
generated output will either need to be manually amended by user or 
extra coding will need to be done to do this automatically. I think the 
latter should be used. I propose to do this by allowing the instructions 
to do thse extra steps for complex sentences to be stored as xml in the 
.kvtml file which will 'instruct' Parley to do extra parsing on the 
sentence. I will provide two examples on how this would work:

The simplest one is a question. The generator code only produces the 
sentence but does not provide a question mark at the end. To implement 
this, the following special grammar type would be entered in the .kvtml 
file:

<special-grammar-type>
<name>question</name>
<context>sentence</context>
<position>EOS</position>
<condition>none</condition>
<action>
<type>Append></type>
<text>?</text>
</action>
</special-grammar-type>

To explain what happens, if Parley encounters a word attached to this 
grammar type, it would see that context tag is sentence so the sentence 
rather than a word is to be amended. It would then see from the position 
tag that the position where action is going to happen is at end of 
sentence (EOS). From the condition tag, there is no condition that needs 
to be meet for this to occur. From the action tag, Parley then will 
append the text ?.

To a slightly more complex example, some adverbs in Scottish Gaelic 
lenite the word after it depending on the first or second letter of that 
following word. Lention involves inserting h in the second position of 
that word. An example of this mòr but with the adverb glè before it, it 
becomes glè mhòr. To do this:

<special-grammar-type>
<name>lenition</name>
<context>word</context>
<position>+1</position>
<condition>[aeiou].*</condition>
<action>
<type>insert></type>
<position>+1,/position>
<text>h</text>
</action>
</special-grammar-type>

To explain this, from the context tag, Parley would be amending a word. 
 From the position, Parley would know it is the next word (a positive 
number is words after the word with the lenition type attached, a 
negative number means words before it). From the condition tag, only 
words that met the following condition will be amended (I've used reg-ex 
as an example and isn't the lenition rule). In the action, Parley would 
then be instructed to insert text. The position of this insertion is 
after first character (+1) and the text to be inserted is h.

In theory this sounds like it could work but I would be grateful if 
anybody sees any flaws or a better way of doing things.


More information about the Parley-devel mailing list