Takes a given block of text and tags it according to Django models and fields defined in settings
Project description
Autotagger
=====
Autotagger helps automatically create text links between related objects in Django applications as well as cross-reference by arbitrary admin-defined strings.
Takes a given block of text and tags it according to models and fields defined in settings.
### Installation
``` pip install tango-autotagger ```
### SETUP
Example:
AUTOTAG_CONTENT = (
{
'model' : 'schools.school',
'field' : 'school',
'check' : 'is_active',
'm2m_field' : 'articles',
'reverse_m2m': 'politicians',
},
... etc ...
)
THE FIELDS...
model:
the app and model to check
field:
the particular field/value you are matching in the text
check:
an optional field to filter by. Maybe. If we can figure out how to do it...
m2m_field:
Optional. Will add the current object to a m2m field on the remote object.
For example, if you are auto_tagging schools in articles
you can add the article to the schools "articles" field.
reverse_m2m:
Optional. Will add the remote object to a m2m field on the current object.
For example, politicians can be a m2m on articles in some cases.
If you were tagging politicians in articles, this would add the politician
to the article's "politicians" field.
Do NOT attempt to use both m2m and reverse_m2m on the same setting.
To insert links to matching objects:
from autotagger.autotag_content import autotag
tagged_text = autotag(article.text)
=====
Autotagger helps automatically create text links between related objects in Django applications as well as cross-reference by arbitrary admin-defined strings.
Takes a given block of text and tags it according to models and fields defined in settings.
### Installation
``` pip install tango-autotagger ```
### SETUP
Example:
AUTOTAG_CONTENT = (
{
'model' : 'schools.school',
'field' : 'school',
'check' : 'is_active',
'm2m_field' : 'articles',
'reverse_m2m': 'politicians',
},
... etc ...
)
THE FIELDS...
model:
the app and model to check
field:
the particular field/value you are matching in the text
check:
an optional field to filter by. Maybe. If we can figure out how to do it...
m2m_field:
Optional. Will add the current object to a m2m field on the remote object.
For example, if you are auto_tagging schools in articles
you can add the article to the schools "articles" field.
reverse_m2m:
Optional. Will add the remote object to a m2m field on the current object.
For example, politicians can be a m2m on articles in some cases.
If you were tagging politicians in articles, this would add the politician
to the article's "politicians" field.
Do NOT attempt to use both m2m and reverse_m2m on the same setting.
To insert links to matching objects:
from autotagger.autotag_content import autotag
tagged_text = autotag(article.text)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file tango-autotagger-0.3.0.tar.gz
.
File metadata
- Download URL: tango-autotagger-0.3.0.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e0fbcf79a4a6847a68782f2cb3827fd675b5bceb78486d483e83b20d368c3ff8 |
|
MD5 | 5fdc39269316312cfe7458a4663a960a |
|
BLAKE2b-256 | 56f2355b87051ab0fd2f82f30b3d9a67463fd4cd729954e413691aa003c25e0d |
File details
Details for the file tango_autotagger-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: tango_autotagger-0.3.0-py3-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 71f1a0e1fcb9b176178320ad99bfc856be83a23ad05747a6426c3dd3af3e02ae |
|
MD5 | 668cabaebf19c64f4b306d9dfb0983cf |
|
BLAKE2b-256 | c4002ebe505b742ace1c88048f1b8cc1bf1e126de2f7df3151886412c16653df |