0

Here is I think the actual computational grammar for Turkish in the Grammatical Framework framework:

I am going to read this page, which seems to explain how to read and understand those grammar code files, under “An Example of Usage”, but I am asking this question since there is not a lot of Stack Exchange-type direct question answers about GF online.

I want to select the most elemental rule from that Turkish grammar, something like S -> NP + VP. This might be the grammar definitions for basic sentences.

I then would like a small lexicon of Turkish words, with part-of-speech classification, which I can use to construct sentences, by selecting a correct lexical element for each component of some rule. Here appears to be the GF Turkish lexicon.

I was wondering if anyone could help me understand which functions and files are the most fundamental for the grammar, on which everything else builds; and provide a code sample of basically adding a rule to some set of “current rules”, with a “build-sentence” function which asks for the appropriate word from the lexicon. In Python, this is the approximate idea:

current_rules = {“NP -> D + N”, “VP -> V + N”}

lexicon = {“N”: {“book”, “plate”, “foot”}, “V”: {“run”, “swim”, “think”, “like”}, “D”: {“the”, “a”, “some”}}

def build_sentence():
  # ask the user to select a rule from the set of rules
  # ask the user to select a lexical element of the correct type for each element in the rule

I can handle the Python on my own, but the question is about locating the correct rule to start with and how to implement it, given that the format is unknown to me, in Python.

Example of the format:

Pron = ResTur.Pron ;
    Det = {s : Str; n : Number; useGen : UseGen} ;
    Num  = {s : Number => Case => Str; n : Number} ;
    Card = {s : Number => Case => Str} ;
    Ord  = {s : Number => Case => Str} ;

(there are a variety of other, different programming expressions in GF as well).

Why am I doing this

Because I have a burning curiosity to try to learn a new language as a strictly cumulative set of rules and lexical elements which you practice recombining until you feel complete competence in them, whereupon you introduce a small expansion of rules and lexical elements until that larger system feels assimilated. I am not interested in someone’s opinion about if this is a good idea, just how.

3
  • 1
    What's your goal here?
    – Draconis
    Nov 8, 2022 at 6:24
  • The ulterior motive is I actually want to study a new language in a strictly cumulative fashion. After gaining comfortability with Rule 1 and 10 words, I add Rule 2 and 10 more words. I then practice a variety of combinations of those rules and words. I will continue to do this up through the whole lexicon and set of rules, over time. (As a general note to anyone reading this, opinions about whether or not this is a good language learning method are not my question and not wished for, since I wish to explore this hypothetical idea to determine for myself how it is, even in the negative).Thanks
    – John Smith
    Nov 8, 2022 at 6:39
  • [After becoming comfortable with]
    – Lambie
    Nov 8, 2022 at 17:27

2 Answers 2

1

Looks like one potential solution would be to create grammars that are subsets of the full grammar. A level 1 grammar, a level 2 grammar, etc. This could be done completely within GF and in Python you would simply load the grammar of your choice. Obviously this solution is more limiting than your description of adding individual rules and words. But I wonder if you would end up needing certain sets of rules together anyways; e.g., "S -> VP + NP" would require rules such as "VP -> NP + V" and "NP -> Det + N".

2
  • I really appreciate the response, but it could use a teeny bit more specificity if possible, to make it more actionable. Your guidance to load the grammar into Python is in the right direction, but could you provide a code example of doing that, if even a partial one? Thank you 🙏
    – John Smith
    Nov 8, 2022 at 18:26
  • @peters I believe the specifics are covered in existing documentation available on grammaticalframework.org and the Grammatical Framework GitHub page. I've never used the Python API but I believe there is a module one installs for it.
    – Bob
    Nov 9, 2022 at 8:18
0

This is a partial answer:

http://www.grammaticalframework.org/lib/doc/synopsis/#toc127

The “hierarchical view” tree diagram shows the “constructors” of various categories. So you can see the highest category - “text” - and the many lowest, such as “AdA”.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.