Skip to main content

Machine learning utilities by DEJAN.

Project description

Dejan: SEO Machine Learning Utilities

Dejan is a growing collection of SEO-related machine learning utilities designed to assist with various tasks in the field of search engine optimization. This repository will be continuously updated with new tools and features aimed at helping SEO professionals streamline their workflows using advanced ML techniques.

Installation

You can install the package using pip:

pip install dejan

Current Utilities

roo

Purpose: Fetches and processes data from the Algoroo API, providing insights into search engine fluctuations.

Search Engine Options:

  • 2: Google.com (Desktop)
  • 3: Google.com.au (Desktop)
  • 4: Google.com (Mobile)
  • 5: Google.com.au (Mobile)

Output: The data can be returned either as a raw JSON object or as a pandas DataFrame for further analysis.

Example Usage:

from dejan import roo

def main():
    # Mapping of search engines to their corresponding identifiers
    search_engines = {
        2: "google.com/desktop",
        3: "google.com.au/desktop",
        4: "google.com/mobile",
        5: "google.com.au/mobile"
    }
    
    # Choose the search engine by setting the appropriate identifier
    search_engine = 2  # Change this number to select a different search engine:
                       # 2: google.com/desktop
                       # 3: google.com.au/desktop
                       # 4: google.com/mobile
                       # 5: google.com.au/mobile
    
    # Fetch data as a pandas DataFrame
    roo_data = roo.get_roo(search_engine, as_dataframe=True)
    
    # Display the first few rows of the DataFrame
    print(f"Data for search engine {search_engine} ({search_engines[search_engine]}):")
    print(roo_data.head())

if __name__ == "__main__":
    main()

linkbert

Purpose: Uses the LinkBERT model to predict link tokens in the provided text, useful for analyzing link placement within content.

Grouping Modes:

  • subtoken: Returns individual subword tokens classified as links.
  • token: Merges any subtokens into whole tokens (words).
  • phrase: Groups predictions into phrases, treating the entire phrase as a link if any part of it is classified as a link.

Example Usage:

from dejan import linkbert

def main():
    # Initialize the LinkBERTInference model
    model = linkbert.LinkBERTInference()

    # Sample text for prediction
    text = "LinkBERT is a model developed by Dejan Marketing designed to predict natural link placement within web content."

    print("Input Text:")
    print(text)
    print("-" * 50)

    # Group by subtoken
    links_subtoken = model.predict_link_tokens(text, group="subtoken")
    print(f"Predicted link tokens (subtoken): {links_subtoken}")

    # Group by token
    links_token = model.predict_link_tokens(text, group="token")
    print(f"Predicted link tokens (token): {links_token}")

    # Group by phrase
    links_phrase = model.predict_link_tokens(text, group="phrase")
    print(f"Predicted link tokens (phrase): {links_phrase}")

if __name__ == "__main__":
    main()

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dejan-1.2-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

File details

Details for the file dejan-1.2-py3-none-any.whl.

File metadata

  • Download URL: dejan-1.2-py3-none-any.whl
  • Upload date:
  • Size: 13.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.0

File hashes

Hashes for dejan-1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c2a736311ecb33c6f2852a87c06949043ea57d76e02c092a6baac845fa1368cf
MD5 a036e1c2128545ffbb809c1ac0ab72a4
BLAKE2b-256 619fbab08d11b175065fa24dbc0053b477280da9891fceb2f7751c921b4d79a1

See more details on using hashes here.

Supported by

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