mirror of https://github.com/doccano/doccano.git
pythondatasetsactive-learningtext-annotationdatasetnatural-language-processingdata-labelingmachine-learningannotation-tool
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
421 B
18 lines
421 B
import abc
|
|
from typing import Any, Dict, Protocol
|
|
|
|
from labels.models import Category
|
|
|
|
|
|
class ExportedLabel(Protocol):
|
|
@abc.abstractmethod
|
|
def dict(self) -> Dict[str, Any]:
|
|
raise NotImplementedError("Please implement this method in the subclass.")
|
|
|
|
|
|
class ExportedCategory(Category):
|
|
def dict(self) -> Dict[str, Any]:
|
|
return {"category": self.label.text}
|
|
|
|
class Meta:
|
|
proxy = True
|