Skip to main content

Categorizes Text Based On A Dictionary Of Lists Of Strings And Callbacks If Needed. Essentially A Template Is Created And Then It Does Its Work. It Then Moves The File Or File Into A Directory And Accompanying Sub-Directories Based From The Root Directory Provided, Followed By The Categories Decided Upon, And Lastly The Final Directory With All Its Contents Will Be In Placed Into The Last Sub Category.

Project description

Categorizer

Categorizes Text Based On A Dictionary Of Lists Of Strings And Callbacks If Needed. Essentially A Template Is Created And Then It Does Its Work. It Then Moves The File Or File Into A Directory And Accompanying Sub-Directories Based From The Root Directory Provided, Followed By The Categories Decided Upon, And Lastly The Final Directory With All Its Contents Will Be In Placed Into The Last Sub Category.

The End Result Will Look Like:

<root_dir>/[...categories]/<categorized_folder_name>/[...files_within_folder]

Use Cases

  • Movies
  • Images
  • Songs
  • Anything With A Descriptive Title

Categories Are User Defined

NOTE

It Is Recommended To Use collections.OrderedDict So That The Flow Will Definitely Run In The Order You Specify, But This Is Optional.

Brief

Each Category can have "verify", "sub", "callback", "except"

  • 'verify' is explained below in more detail
  • 'sub' is a sub category with the same exact structure as the main category and it can continue going down until the end
  • 'callback' is a callback function for more precise matching, perhaps with regex or the like
  • 'except' will be a list of items that are exceptions to verify and will continue on even if there was a match in 'verify'

Each verify Can Have "main", "word", and/or "phonics"

  • 'main' Match Based On The Word Just Existing In Title (Case Insensitive) - it will be converted to title case in any case
  • 'word' Matches A Word Exactly Within The Title ( Case Insensitive )
  • 'phonics' Matches For The Sound or sub_string Within Each Word In The Directory Name (Case Sensitive) - It Does Not Convert Any Text To Another Case To Find The Match, But It Will Most Likely Be Lower Case
  • Lastly, Verify Can Be A Simple List or Tuple To Check Through. It Will Work Just The Same As The Dictionary But Will Check It As If It Were 'main'

Special Keywords For sub

  • if 'sub' is set to "_ _ EMPTY _ _" the behavior is such that it will continue categorization after but will always finish after the current sub-category level. Mostly Used For When You're At The Last Sub-Category So That It Will Continue On To The Other Sub-Categories If No Match Is Found, Otherwise It Will Stop And End The Categorization For That Directory
  • if 'sub' is set to "_ _ DIRECTORY _ _" it will end the categorization process returning the current category and subcategories of the current target directory for further processing. You may then pass the returned data back in after processing and continue with like that. Or it could just be used to check what it has done so far.
  • if 'sub' is set to "_ _ STOP _ _" then all execution is complete. This Is Mostly Just Reserved For The Last Sub Category Meaning There Is Nothing More And Should Be Used As Such To Decrease Chances Of Infinite Loops

Perhaps Unintuitive Until Explained:

  • if you want a category to be skipped, perhaps for use at another time, simply set it to an empty list and set sub to whatever you would normally want it to be or just use another Template Or Just Simply None.

EXAMPLE CATEGORIZATION TEMPLATE

Look At The example.py To See An Example

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

Merkurial_Categorizer-0.0.2.tar.gz (18.2 kB view details)

Uploaded Source

Built Distribution

Merkurial_Categorizer-0.0.2-py3-none-any.whl (18.5 kB view details)

Uploaded Python 3

File details

Details for the file Merkurial_Categorizer-0.0.2.tar.gz.

File metadata

  • Download URL: Merkurial_Categorizer-0.0.2.tar.gz
  • Upload date:
  • Size: 18.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for Merkurial_Categorizer-0.0.2.tar.gz
Algorithm Hash digest
SHA256 697209bbfc5fb789a8776768574e8e217e72568f163b0cbbdbfe5705368fdffb
MD5 dcfed743ba12f91b26f5ab69224e98ae
BLAKE2b-256 04264b353ca7f0033e93550a66ec72ff7013b25a623c10e194181d3cf691ffd2

See more details on using hashes here.

File details

Details for the file Merkurial_Categorizer-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for Merkurial_Categorizer-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 72d4da63de1249b091dc1f724a6f770c74099698c29235fdc3b5c0b2f460d2bf
MD5 45db6c92bad8e864d33fef8956c66879
BLAKE2b-256 4d2ead096b3d14f5e6717eeea76339148b65ee7a6863715754794d9c2b27a51a

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