Skip to main content

cs.tags Package Readme

Overview

This package provides an engine that allows users to assign tags to items.

Clouds Engine

Use this package if you want to draw tag clouds or want to retrieve othe info related to tagging.

>>> from cs.tags.clouds import CloudsEngine

The clouds engine stores the tags that each user assigns to an item. Tags, users and items info is stored according a model in order to speed up retrieval. This mean that the data structures will conteins precalculated tag clouds prepeared to be drawed as fast as possible.

>>> clouds_engine = CloudsEngine()
>>> clouds_engine
<CloudsEngine tags=0>

In the beggining, the clouds engine doesn’t contain anything:

>>> clouds_engine.getCloud()
([], 0, 0)

Each user can add to the engine his set of tags assignated to a given item. For this proposal, the update() method mantains the user-centric relations between items and tags:

>>> clouds_engine.update(item=1, user='Nando Quintana', tags=['simple','green','energy'])
>>> clouds_engine.update(item=2, user='Nando Quintana', tags=['complex','energy'])
>>> clouds_engine.update(item=3, user='Erral', tags=['mineral','sources'])
>>> clouds_engine.update(item=3, user='Nando Quintana', tags=['nuclear','power'])

The engine is now able of returning a tag cloud information, based on the updates mades until this moment:

>>> clouds_engine.getCloud()
([('energy', 2), ('complex', 1), ('green', 1), ('mineral', 1), ('nuclear', 1), ('power', 1), ('simple', 1), ('sources', 1)], 9, 8)

The getCloud() method returns this peculiar data structure. Showed info is composed by a tag lists and two numbers. The tag list is indeed a list of tuples, that contains the string tag and the weight in the cloud. Second number means the number of tagged items, and third, the number of tags in the clouds.

Optionally, you can give a maximum number of tag you want to include in your tag cloud:

>>> clouds_engine.getCloud(n=5)
([('energy', 2), ('complex', 1), ('green', 1), ('mineral', 1), ('nuclear', 1)], 9, 5)

If you want to draw a clouds of tags, posted by a single user, you can tell the getCloud() method which is the user you want to use as filter:

>>> clouds_engine.getCloud(users='Nando Quintana')
([('energy', 2), ('complex', 1), ('green', 1), ('nuclear', 1), ('power', 1), ('simple', 1)], 7, 6)

You can also filter the cloud by item:

>>> clouds_engine.getCloud(items=3, users='Nando Quintana', n=5)
([('nuclear', 1), ('power', 1)], 2, 2)

Or ask the engine a tag cloud in relation to a single item:

>>> clouds_engine.getCloud(items=3, n=5)
([('mineral', 1), ('nuclear', 1), ('power', 1), ('sources', 1)], 4, 4)

Implicit knowledge

There is more information you can extract from the engine. For example, you can draw a cloud with the tags that have been inserted in common items. Doing this, you can build implicit knowledge from the users tagging habits.

>>> clouds_engine.update(item=4, user='Nando Quintana', tags=['nuclear','power'])
>>> clouds_engine.update(item=5, user='Nando Quintana', tags=['nuclear','flower','power'])
>>> clouds_engine.update(item=5, user='Erral', tags=['black','power'])
>>> clouds_engine.getRelatedTags(tag='power')
([('nuclear', 3)], 3, 1)

Other info you can build from the tagging behaviour is the relation between items:

>>> clouds_engine.getRelatedItems(item=3)
([(4, 2), (5, 2)], 4, 2)

So in this example, item 3 has 2 tags in common wiht item 4, and other 2 wich item 5.

As in the case of tags and items, you can also discover the implicit relations between users, according to the tagging history:

>>> clouds_engine.getRelatedUsers(user='Erral')
([('Nando Quintana', 1)], 1, 1)

The results show that Erral and Nando Quintana have a tag in common.

Metadata

Release files for cs.tags 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cs.tags 0.1.1
File Size Uploaded Provenance Actions
cs.tags-0.1.1.tar.gz 15.1 kB Without provenance Details for cs.tags-0.1.1.tar.gz

Release files / cs.tags-0.1.1.tar.gz

Download URL cs.tags-0.1.1.tar.gz
Size 15.1 kB
Tags Source
SHA-256 checksum
How to use checksums
ddba21e800496460cf045f3b596fb263b6eae93bcb278c3332a82603e628e05a
BLAKE2b-256 checksum
How to use checksums
cff6b8c445df65fb3739a9a190fe045e287113621a6cf20e1fda32997e7ff858
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for cs.tags 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page