AnnotationConfiguration (Apache OpenNLP Tools 2.5.9 API)
Description: declaration: package: opennlp.tools.formats.brat, class: AnnotationConfiguration

# Class AnnotationConfiguration

java.lang.Object
opennlp.tools.formats.brat.AnnotationConfiguration

public class AnnotationConfiguration extends Object
Encapsulates a type to class mapping for entities, relations, events, etc.

Details on how a annotation configuration file should be structured can be found in the brat annotation configuration section of the official BRAT documentation.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `ATTRIBUTE_TYPE`
  `static final String`
  `ENTITY_TYPE`
  `static final String`
  `EVENT_TYPE`
  `static final String`
  `RELATION_TYPE`
  `static final String`
  `SPAN_TYPE`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AnnotationConfiguration(Map<String,String> typeToClassMap)`
  Initializes an `AnnotationConfiguration` with the specified `typeToClassMap`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `getTypeClass(String type)`
  `static AnnotationConfiguration`
  `parse(File annConfigFile)`
  Parses a given `annConfigFile` into a `AnnotationConfiguration`.
  `static AnnotationConfiguration`
  `parse(InputStream in)`
  Parses a given `annConfigFile` into a `AnnotationConfiguration`.

  ### Methods inherited from class Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### SPAN_TYPE

    public static final String SPAN_TYPE
    See Also:
      - Constant Field Values

  - ### ENTITY_TYPE

    public static final String ENTITY_TYPE
    See Also:
      - Constant Field Values

  - ### RELATION_TYPE

    public static final String RELATION_TYPE
    See Also:
      - Constant Field Values

  - ### ATTRIBUTE_TYPE

    public static final String ATTRIBUTE_TYPE
    See Also:
      - Constant Field Values

  - ### EVENT_TYPE

    public static final String EVENT_TYPE
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### AnnotationConfiguration

    public AnnotationConfiguration(Map<String,String> typeToClassMap)
    Initializes an `AnnotationConfiguration` with the specified `typeToClassMap`.
    Parameters:
      `typeToClassMap` - A type to class mapping. Must not be `null`.

- ## Method Details

  - ### getTypeClass

    public String getTypeClass(String type)
    Parameters:
      `type` - The type to get the type class for.
    Returns:
      Retrieves the class for the specified `type`, `null` if not found.

  - ### parse

    public static AnnotationConfiguration parse(InputStream in) throws IOException
    Parses a given `annConfigFile` into a `AnnotationConfiguration`.
    Parameters:
      `in` - A valid `annConfigFile` from which the config should be read. Must not be `null` and must be in the correct format, see: Brat annotation configuration
    Returns:
      A valid `AnnotationConfiguration` instance.
    Throws:
      `IOException` - Thrown if IO errors occurred during parsing.

  - ### parse

    public static AnnotationConfiguration parse(File annConfigFile) throws IOException
    Parses a given `annConfigFile` into a `AnnotationConfiguration`.
    Parameters:
      `annConfigFile` - A valid `annConfigFile` from which the config should be read. Must not be `null` and must be in the correct format, see: Brat annotation configuration
    Returns:
      A valid `AnnotationConfiguration` instance.
    Throws:
      `IOException` - Thrown if IO errors occurred during parsing.