mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-09 00:05:21 +01:00
Merge branch 'machine-learning' into dev
This commit is contained in:
commit
46a5bc00d7
7 changed files with 66 additions and 45 deletions
|
|
@ -9,7 +9,7 @@ from django.contrib.contenttypes.models import ContentType
|
|||
from django.utils import timezone
|
||||
|
||||
from documents.classifier import DocumentClassifier
|
||||
from ..models import Correspondent, Document, Tag, DocumentType
|
||||
from ..models import Document, Tag
|
||||
|
||||
|
||||
def logger(message, group):
|
||||
|
|
@ -23,11 +23,14 @@ def classify_document(sender, document=None, logging_group=None, **kwargs):
|
|||
global classifier
|
||||
try:
|
||||
classifier.reload()
|
||||
classifier.classify_document(document, classify_correspondent=True, classify_tags=True, classify_type=True)
|
||||
classifier.classify_document(document, classify_correspondent=True, classify_tags=True, classify_document_type=True)
|
||||
except FileNotFoundError:
|
||||
logging.getLogger(__name__).fatal("Cannot classify document, classifier model file was not found.")
|
||||
|
||||
|
||||
def add_inbox_tags(sender, document=None, logging_group=None, **kwargs):
|
||||
inbox_tags = Tag.objects.filter(is_inbox_tag=True)
|
||||
document.tags.add(*inbox_tags)
|
||||
|
||||
|
||||
def run_pre_consume_script(sender, filename, **kwargs):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue