Module gatenlp.processing.gazetteer.base

Base class for all gazetteer annotators

Expand source code
"""
Base class for all gazetteer annotators
"""
from typing import Union, List, Set
from dataclasses import dataclass
from gatenlp import Document
from gatenlp.processing.annotator import Annotator


class GazetteerBase(Annotator):
    """
    Gazetteer base class.
    """
    def __call__(self, doc: Document, **kwargs) -> Union[Document, List[Document], None]:
        raise RuntimeError("Not implemented in Gazetteer base class")

# NOTE: slots=True is supported from 3.10 only
@dataclass()
class GazetteerMatch:
    """
    A description of a match.
    """
    start: int
    end: int
    match: str
    features: dict
    type: str

Classes

class GazetteerBase

Gazetteer base class.

Expand source code
class GazetteerBase(Annotator):
    """
    Gazetteer base class.
    """
    def __call__(self, doc: Document, **kwargs) -> Union[Document, List[Document], None]:
        raise RuntimeError("Not implemented in Gazetteer base class")

Ancestors

Subclasses

Inherited members

class GazetteerMatch (start: int, end: int, match: str, features: dict, type: str)

A description of a match.

Expand source code
class GazetteerMatch:
    """
    A description of a match.
    """
    start: int
    end: int
    match: str
    features: dict
    type: str

Class variables

var end : int
var features : dict
var match : str
var start : int
var type : str