Skip to main content

Auto-tags a selection of text and generates links to the tagified versions of the words

Project description

Auto Tagify2 is a simple auto tagging module that uses NLTK to generate tags out of a selection of text. Any text that is less than 3 characters long or matches a particular POS (part-of-speech) will be ignored.

There are two operations Auto Tagify performs - one returns the selection of text with links embedded in the string and the other returns a list of all the taggable words as the stem word (using lemmatization).

For the first operation, everything is optional, but it is most effective to enter some text. Optional parameters you can set are the paths for tag links and the css classes for link. For instance, if you set your tag routing to a relative path such as /tags/<tagged_word> and want to use the css class named “tagged”:

from auto_tagify2 import AutoTagify

t = AutoTagify()

t.text = “This is the text to display!”

t.link = “/tags”

t.css = “tagged”

t.generate()

The result will be: This is the <a href=”/tags/text” class=”tagged”>text</a> to <a href=”/tags/display” class=”tagged”>display!</a>

If no link is set, the default path is “/<tagged word>”, such as “/text”.

For the second operation, you will only receive a list of all your taggable words from the text. You can call it like so:

t.text = “This text is tagged kittens”

t.tag_list()

The result will be a list: [‘text’, ‘tag’, ‘kitten’]

By default, generate() and tag_list() will be in strict mode, which means all special characters will be stripped and lemmatization will be enforced. If generate(strict=False) or tag_list(strict=False) is set, then special characters will be url encoded and lemmatization will be ignored.

These two operations are sufficient for you to maintain tag counts and tag references to text in your application.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

auto_tagify2-1.4.3.tar.gz (3.1 kB view details)

Uploaded Source

File details

Details for the file auto_tagify2-1.4.3.tar.gz.

File metadata

  • Download URL: auto_tagify2-1.4.3.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.23.1 CPython/3.6.5

File hashes

Hashes for auto_tagify2-1.4.3.tar.gz
Algorithm Hash digest
SHA256 511d999948231c22429dd0767450a08e6deccdd9e514967a417e568722e20701
MD5 c1635c2643ed173b90809afd6a68eb08
BLAKE2b-256 de85bdc15a586aef64935d4950d71cb53638d3b589b5b5f003074c91d445cf78

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page