# Path: languk/corpus/mongodb.py
# def with_reconnect(func):
#     def _reconnector(*args, **kwargs):
#     def __init__(self, collection):
#     def __getattr__(self, func):
#     def __repr__(self):
#     def __str__(self):
#     def __init__(self, database):
#     def __getattr__(self, func):
#     def __getitem__(self, func):
#     def __repr__(self):
#     def __str__(self):
#     def __init__(self, connection, default=None):
#     def __getattr__(self, alias):
#     def __repr__(self):
#     def __str__(self):
#     def __init__(self, databases):
#     def __getitem__(self, alias):
# def get_db():
# class ConnectionDoesNotExist(Exception):
# class CollectionWrapper(object):
# class DatabaseWrapper(object):
# class ConnectionWrapper(object):
# class MongoHandler(object):


from collections import defaultdict
from typing import Tuple
from django import forms
from django.core import exceptions
from django.db import models
from django.contrib.postgres.fields import ArrayField
from django.conf import settings
from django_task.models import TaskRQ
from .mongodb import db
        from .jobs import ExportCorpusJob
        from .jobs import TagWithUDPipeJob
        from .jobs import BuildFreqVocabJob



_CORPORA_CHOICES: Tuple[Tuple[str, str]] = (
    ("news", "News and magazines"),
    ("wikipedia", "Ukrainian Wikipedia"),
    ("fiction", "Fiction"),
    ("court", "Sampled court decisions"),
    ("laws", "Laws and bylaws"),
)

_FILTERING_CHOICES: Tuple[Tuple[str, str]]  = (
    ("rus", "Filter out texts with a lot of russian words"),
    ("short", "Filter out texts, where title and body combined are too short"),
)




# Path: languk/corpus/mongodb.py
# def with_reconnect(func):
#     def _reconnector(*args, **kwargs):
#     def __init__(self, collection):
#     def __getattr__(self, func):
#     def __repr__(self):
#     def __str__(self):
#     def __init__(self, database):
#     def __getattr__(self, func):
#     def __getitem__(self, func):
#     def __repr__(self):
#     def __str__(self):
#     def __init__(self, connection, default=None):
#     def __getattr__(self, alias):
#     def __repr__(self):
#     def __str__(self):
#     def __init__(self, databases):
#     def __getitem__(self, alias):
# def get_db():
# class ConnectionDoesNotExist(Exception):
# class CollectionWrapper(object):
# class DatabaseWrapper(object):
# class ConnectionWrapper(object):
# class MongoHandler(object):


# Path: languk/corpus/models.py
from collections import defaultdict
from typing import Tuple
from django import forms
from django.core import exceptions
from django.db import models
from django.contrib.postgres.fields import ArrayField
from django.conf import settings
from django_task.models import TaskRQ
from .mongodb import db
        from .jobs import ExportCorpusJob
        from .jobs import TagWithUDPipeJob
        from .jobs import BuildFreqVocabJob




_CORPORA_CHOICES: Tuple[Tuple[str, str]] = (
    ("news", "News and magazines"),
    ("wikipedia", "Ukrainian Wikipedia"),
    ("fiction", "Fiction"),
    ("court", "Sampled court decisions"),
    ("laws", "Laws and bylaws"),
)

_FILTERING_CHOICES: Tuple[Tuple[str, str]]  = (
    ("rus", "Filter out texts with a lot of russian words"),
    ("short", "Filter out texts, where title and body combined are too short"),
)




class ChoiceArrayField(ArrayField):