Coder Social home page Coder Social logo

sridharreddy7 / auto-tagify Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mitchellzen/auto-tagify

0.0 2.0 0.0 60 KB

Auto tags a selection of text by removing basic stop words using NLTK

License: BSD 3-Clause "New" or "Revised" License

auto-tagify's Introduction

Auto Tagify

Auto Tagify 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_tagify 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. If generate(False) or tag_list(False) is set, then special characters will be url encoded.

Also by default, generate() will treat hyperlink text (e.g. "http://mytestsite.com") as not a taggable item. To force a hyperlink to not be treated in the same manner, pass in the False parameter, such as generate(False,False) or generate(True,False), depending on your Strict mode option.

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

auto-tagify's People

Contributors

willkg avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.