Parsing Engine

danbikel.parser
Class Language

java.lang.Object
  extended bydanbikel.parser.Language
All Implemented Interfaces:
Serializable

public class Language
extends Object
implements Serializable

Provides objects that perform functions specific to a particular language and/or Treebank. When the static method setLanguage() is called, several objects from a language package are created and stored statically by this class. This scheme means that Language.setLanguage should be called before any language-specific resources or methods are required, typically early in the execution of a program. A language package must provide implementations for the following interfaces:

Upon initialization, this class will set the language to be the default language, which is English, using classes from the default language package, danbikel.parser.english, using the method setLanguage().

See Also:
setLanguage(), Settings, Settings.language, Settings.languagePackage, Serialized Form

Method Summary
static String encoding()
          Gets the file encoding for the current language.
static String getLanguage()
          Gets the name of the current language.
static String getLanguagePackage()
          Gets the name of the current language package.
static HeadFinder headFinder()
          Gets the HeadFinder object for the current language.
static void setLanguage()
          Sets the language and language package using the values obtained from the Settings class.
static Training training()
          Gets the Training object for the current language.
static Treebank treebank()
          Gets the Treebank object for the current language.
static WordFeatures wordFeatures()
          Gets the WordFeatures object for the current language.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

wordFeatures

public static final WordFeatures wordFeatures()
Gets the WordFeatures object for the current language.


headFinder

public static final HeadFinder headFinder()
Gets the HeadFinder object for the current language.


treebank

public static final Treebank treebank()
Gets the Treebank object for the current language.


training

public static final Training training()
Gets the Training object for the current language.


encoding

public static final String encoding()
Gets the file encoding for the current language.
If the value Settings.get(Settings.fileEncodingPrefix + Settings.language) is non-null, then it is used as the file encoding; otherwise, the file encoding is to be the value of
System.getProperty("file.encoding").

See Also:
Settings.fileEncodingPrefix, Settings.language

setLanguage

public static void setLanguage()
Sets the language and language package using the values obtained from the Settings class. The language to be set is determined by the value of the parser.language property stored in Settings. The language package to be set is determined by the value of the parser.language.package property stored in Settings.

A language package is required to provide concrete subclasses of the following abstract classes:

  1. WordFeatures
  2. Treebank
  3. HeadFinder
  4. Training
This method will create one object of each of the required language package classes using the classes' respective default constructors. The objects are created in the order listed above, so any dependencies in a language package must be from later-instantiated to earlier-instantiated classes.

The class names of the concrete classes in a language package are assumed to be identical to those listed above, prepended with the string

Settings.get(Settings.languagePackage) + "."
If a particular concrete subclass has a different name from the abstract class it extends, the appropriate Settings property must be set containing the fully-qualified version of the class name:


getLanguage

public static final String getLanguage()
Gets the name of the current language.


getLanguagePackage

public static final String getLanguagePackage()
Gets the name of the current language package.


Parsing Engine

Author: Dan Bikel.