Grammar Reference > Create and Edit Grammar Files > Eduction Grammar Syntax

Eduction Grammar Syntax
The tables in this section describe the Eduction grammar syntax defined in the edk.dtd (see Eduction Grammar DTD).
In the tables, terms shown in italics are deprecated, but are kept for backward compatibility. The terms in angled brackets <> describe the value that must be inserted. Note that the XML elements, attributes, and values are defined in lower case. Although the Eduction compiler accepts uppercase element and attribute names, this functionality is deprecated, but retained for backward compatibility. The edk.dtd file represents the current definition for Eduction grammar files, and must be followed for all Eduction grammars.
 
NOTE Two deprecated elements are missing from the tables below: dictionary and entryset. These are synonymous with grammar and entity respectively, and, although not documented, are retained for backward compatibility.
<grammars>
Element: grammars
Child Elements: include, grammar
Description: This is the top-level element in an Eduction grammar.
.
Determines whether a match is case sensitive. The value inherited takes the value from the application level, which in the case of Eduction applications is usually sensitive.
Displays verbose information for the grammars element while edktool compiles the grammar.
<include>
Element: include
Child Elements: publish
Description: References another Eduction grammar file for inclusion.
 
The default setting of public allows entities in included XML grammars to retain their private/public visibility. (Included ECR grammars, by definition of a compiled grammar, only contain public entities.) Setting the type attribute to private hides the included public entities from being visible in the file that includes the grammar.
<publish>
Element: publish
Child Elements: <none>
Description: Makes a private entity public. The entity can be anywhere in an included XML file chain. Note that private entities cannot be accessed in a compiled ECR file, so that even if the name of the private entity is known, publish is not able to make it public.
 
<grammar>
Element: grammar
Child Elements: extern, entity
Description: Defines a grammar, which is a collection of entities. Entities are used for matching.
 
Determines whether a match is case sensitive. The value inherited accepts the case matching mode of the grammars parent.
Extends or replaces an existing grammar definition, or disallows this if one already exists.
Displays verbose information for the dictionary element during compilation. The value inherited accepts the debug mode of the grammars parent.
<extern>
Element: extern
Child Elements: <none>
Description: Identifies an external grammar by name so that the entities contained by the grammar do not have to explicitly name the grammar. For example, if another grammar is grammar1 and an entity within it is entity1, then in the current grammar, the entity can be referred to as simply entity1 rather than grammar1/entity1.
 
<entity>
Element: entity
Child Elements: entry, pattern
Description: Defines an entity used for matching.
 
Determines whether a match is case sensitive. The value inherited accepts the case matching mode of the grammars parent.
Displays verbose information for the entity element during compilation. The value inherited accepts the debug mode of the grammar parent.
<entry>
Element: entry
Child Elements: headword, synonym
Description: An entry represents an individual entry that is matched in an entity. The entry has one or more attributes such as the actual phrase that is returned (the headword), the case, and so on.
 
The dictionary entry. Headword can be an attribute or a subelement, but it must be one or the other.
*
A score of 1 is the default score.
*
A score of 0 always excludes the matching tag from the results, and can be used to specify exceptions to grammar rules.
*
They can represent the confidence the grammar author has in the accuracy of the match (where a value of 1 represents certainty, and lower values represent lesser confidence).
*
They can represent the importance of a match - for example, in the sentiment grammars the scoring represents the strength of the sentiment in the match.
Multiple scores are multiplied. For example, if a match on an entity has a score of 1.5, and that entity is used in another entity that also has a score of 0.4, the resulting score is 0.6.
If a minimum score is specified during extraction, only those matches with a sufficiently high score are extracted. You can also display the exact scores of any match during extraction.
Determines whether a match is case sensitive. The value inherited accepts the case matching mode of the entryset parent.
Displays verbose information for the entry element during compilation. The value inherited accepts the debug mode of the entryset parent.
<headword>
Element: headword
Child Elements: <none>
Description: A headword is the sequence of characters that produce an entity match.
 
<element contents>
The headword value. Note that if the entry element contains a headword attribute, it cannot have a headword subelement.
Determines whether a match is case sensitive. The value inherited accepts the case matching mode of the entry parent.
<synonym>
Element: synonym
Child Elements: <none>
Description: A synonym is an alternative sequence of characters to a headword. Synonym matching produces an entity match, but returns the headword in place of the matching synonym. For example, if you search for dog with the synonym canine enabled, matches for canine return as if they matched dog.
 
<element contents>
Determines whether a match is case sensitive. The value inherited accepts the case matching mode of the entry parent.
<pattern>
Element: pattern
Child Elements: <none>
Description: Defines a pattern used for matching.
 
Determines whether a match is case sensitive. The value inherited accepts the case matching mode of the grammars parent.
Displays verbose information for the pattern element during compilation. The value inherited accepts the debug mode of the entity parent.