Upload failed. Maybe wrong permissions?

User Tools

Site Tools




Grammar Visualizer

This is a concept of a technology to display grammar informations on words and longer portions of text, in a way that makes it easier to comprehend. The thought behind GV is to disassemble complex grammar phenomena to elements that are easy to get a grab on.
  The concept is designed as a Dokuwiki plugin, but it can be developed for other platforms of course. Actual syntax may be altered when developing actual software.

Building Bricks

To make GV work, we’ll need the following information:

  • Grammar (G) to let the system know how elements of grammar work.
  • Vocabulary (V) to fill the system with information on actual words.
  • Styles (S) is the set of CSS descriptions to be used for displaying information.
  • Text (T) is the actual wiki page using the previous ingredients to tell something about grammar.

All of these may be collected on a single wiki page or on separate ones. To refer them, we can use relative links. Let’s suppose we have the following pages on our wiki:
  latvian_grammar
  latvian_vocab
  styles
  Then, we can add a reference to each on the T page that reads

<gvinclude latvian_grammar latvian_vocab styles>

This makes the declarations made on those pages part of the page now being processed.

Grammar (G)

G is a series of grammar tables. When storing grammar information, we need to specify one or more tables for each part of speech. Let’s build a way for English verbs in a multilevel form. First, let’s declare the numbers and persons.

<gvgrammar persons
1sg 2sg 3sg 1pl 2pl 3pl
>

This will list 6 verb forms for any tense. 1sg etc. are placeholders you can choose arbitrarily. Also, persons is a placeholder referring to the contents of this table.
  Now, let’s create a table for a tense.

<gvgrammar present
simple=persons prog=persons perf=persons perfprog=persons
>

Now, we have four copies of persons in present. We can refer to them as present.simple.1sg or present.perfprog.3pl etc.
  Declaring the other tenses similarly:

<gvgrammar past
simple=persons prog=persons perf=persons perfprog=persons
>
<gvgrammar future
simple=persons prog=persons perf=persons perfprog=persons
>
<gvgrammar cond
simple=persons prog=persons perf=persons perfprog=persons
>
<gvgrammar imper>

The imperative tense has no further detail, so, it’s called simply as imper.

Now, we have a series of names for English verb forms. They will be used in the vocabulary part.

Vocabulary (V)

A V entry lists words and connects them in grammar relations.

<gvvocab [talk]
[I talk]=present.simple.1sg
[you talk]=present.simple.2sg
>

(and so on). The first word, [talk] is the dictionary form, the headword; it may be any form considered so, say, the 3rd person singular for Hungarian verbs, the infinitive for Latvian ones and so on. The other entries are the subentries. All dictionary entries are in square brackets [] because they may be several words long.
  The V listing assigns word forms to the placeholders defined in the G tables.
  A V entry may be more complex.

<gvvocab [lūgt]{en[to ask for][to pray]|hu[kér][imádkozik]}
[lūdzu]{en[please]hu[kérem]}=present.1sg cc="g>dz" ending="u"
>

This is an entry of the Latvian verb lūgt and one of its forms, lūdzu. In addition to the elements seen before, it contains the following information:

  • Translations in braces {} for any languages; they are identified with two-letter codes. For each language, several meanings may be specified in square brackets.
  • Two variable assignments that may be taken care of in any Style. Variable cc (short for consonant change) holds information about the type of the consonant change that happens in the word lūdzu: the consonant g, found in the infinitive form lūgt is changed to dz in the form lūdzu. Being there many cases when this happens in Latvian, it may be enough to display only g>dz. Variable ending holds the ending u this verb form ends with.

This way, we have forms of a word assigned to grammar terms, equipped with additional information if necessary. To make use of that, we need Styles.

Styles (S)

A style is a definition to display grammar information for a word in a formatted way. We may display words of different languages, different parts of speech etc. in different ways, we may want to choose more or less verbose listings, and so on. Therefore, we may define any number of styles for different purposes.

<gvstyle env tooltip
~ ← ~! (#)
$
>

This mystical piece defines a short style for English verbs (its name env stands for this). When a word is displayed in this style, the following happens:

  • First, the word itself is displayed: ~ stands for the word the style was called with.
  • The left-pointing arrow has no special meaning, it’ll be displayed normally.
  • Symbol ~! is for the headword the word is belonging to.
  • The symbol # is for the grammar description for the word, with dots replaced by spaces. Here, it’s enclosed in parentheses.
  • In the next line, $ is a command to list the translations provided for the word.

And all of these ar shown in a tooltip when pointing to the word with the mouse.
  So, if we call the style with the word I talk, we’ll get the following in a tooltip:

I talk ← talk (present simple 1sg)

No translations provided, so they won’t appear.
  We can make decisions to display or skip parts of the style:

<gvstyle env tooltip
~ subentry[← ~!] (#)
$
>

subentry is a question. Is it a subentry? I mean, is it specified in a subsequent line of a V entry and not as a headword? If not (so, it is a headword), the part between the square brackets [] are omitted to avoid talk ← talk if the style is called with the headword talk.
  Making use of variables defined in the V part:

<gvstyle lvv
~ subentry[← ~!] (#)
defined[Consonant change: %cc%] 
defined[Ending: %ending%]
>

defined is another question which allows the part in brackets to be displayed only if the variable mentioned in it (between percent signs %) is defined.
  Returning to the previously mentioned setting tooltip, this will make the text to appear as a normal word, part of the text on the page, and upon mouseover, the contents of the style will appear on a CSS tooltip. Other methods include:
  normal – the style appears as part of the page
  image – it appears on an image

Text (T)

To make use of all the above, we need to display some text. This may be a single word or multiple words, even a pageful of text. For any word included in the text, the explanation belonging to it appears.

<gv Now I talk in Latvian. Lūdzu means please.>

This command will display these two short sentences, and both I talk and Lūdzu will appear with their respective explanations.

»»»»»»