Interface AnnotatableType

    • Field Detail

      • ANNOTATOR_PACKAGE

        static final String ANNOTATOR_PACKAGE
        Package to look for default annotator implementations.
        See Also:
        Constant Field Values
    • Method Detail

      • valueOf

        static AnnotatableType valueOf​(String name)

        Determines the correct AnnotatableType from the given name. Checks are made in the following order:

        1. ShorthandTypeName.VALUE
          e.g. Annotation.ENTITY
        2. FullyQualifiedClassName.VALUE
          e.g. com.gengoai.hermes.morphology.POS.NOUN
        3. Already defined name in the order:
          (1) Annotation (2) Attribute (3) Relation
        Parameters:
        name - the name
        Returns:
        the AnnotatableType
      • canonicalName

        String canonicalName()
        The canonical name of the type (typically in the form of PackageName.ClassName.Name)
        Returns:
        the canonical form of the name
      • getAnnotator

        default Annotator getAnnotator​(@NonNull
                                       @NonNull Language language)
        Gets the annotator associated with this type for a given language. First, an annotator is checked for in the config using Type.Language.Name.Annotator (e.g. Annotation.ENGLISH.ENTITY.Annotator where the language is optional. If not found, it will then check for classes that meet common conventions in the following order:
        1. com.gengoai.hermes.[LANG_CODE_LOWER].[LANG_CODE_UPPER][TYPE_NAME_TITLE_CASE][ANNOTATOR], e.g. com.gengoai.hermes.en.ENEntityAnnotator
        2. com.gengoai.hermes.annotator.Default[LANG_NAME_TITLE_CASE][TYPE_NAME_TITLE_CASE][ANNOTATOR], e.g. com.gengoai.hermes.annotator.DefaultEnglishEntityAnnotator
        3. com.gengoai.hermes.annotator.Default[TYPE_NAME_TITLE_CASE][ANNOTATOR], e.g. com.gengoai.hermes.annotator.DefaultEntityAnnotator
        Parameters:
        language - the language for which the annotator is needed.
        Returns:
        the annotator for this type and the given language
        Throws:
        IllegalStateException - If no annotator is defined or the defined annotator does not satisfy this type.
      • name

        String name()
        Returns:
        The annotatable type's name (e.g. TOKEN, PART_OF_SPEECH)
      • type

        String type()
        Returns:
        The type (Annotation, Attribute, Relation)