### Run Kaomoji Example Source: https://github.com/keithdowd/kaomoji/blob/master/README.md Execute the kaomoji package from the command line to view a pre-fab example. ```console python -m kaomoji ``` -------------------------------- ### Install Kaomoji Package Source: https://github.com/keithdowd/kaomoji/blob/master/README.md Install the kaomoji package using pip. This command installs the package for the current user. ```console pip install --user kaomoji ``` -------------------------------- ### Run Kaomoji from Command Line Source: https://context7.com/keithdowd/kaomoji/llms.txt Execute the kaomoji module directly from the command line to see example output demonstrating random generation, specific categories, available categories, and template placeholders. ```bash # Run the example module python -m kaomoji # Expected output (emoticons vary due to random generation): # Random category: ヽ(ー_ー)ノ # Joy: \(^ω^)/ # Indifference: ¯\_(︶~︶)_/¯ # Love: ♡╰(◡‿◡)╯♡ # Categories: ['indifference', 'joy', 'love', 'sadness'] # Template placeholders: ['right_arm', 'left_eye', 'mouth', 'right_eye', 'left_arm'] ``` -------------------------------- ### Inspect Kaomoji Template Placeholders Source: https://context7.com/keithdowd/kaomoji/llms.txt Get a list of all feature placeholders used in the template string for assembling kaomoji. These include 'left_arm', 'right_arm', 'left_eye', 'right_eye', and 'mouth'. ```python from kaomoji.kaomoji import Kaomoji kao = Kaomoji() # Get template placeholders template_parts = kao.template print(f"Template placeholders: {template_parts}") # Output: Template placeholders: ['right_arm', 'left_eye', 'mouth', 'right_eye', 'left_arm'] # The default template format is: {left_arm}({left_eye}{mouth}{right_eye}){right_arm} # This creates patterns like: ╰(^▽^)ノ # │ │ │ │ └── right_arm # │ │ │ └───── right_eye # │ │ └─────── mouth # │ └────────── left_eye # └───────────── left_arm ``` -------------------------------- ### Command Line Usage Source: https://context7.com/keithdowd/kaomoji/llms.txt Instructions on how to run the kaomoji module from the command line for demonstration purposes. ```APIDOC ## Command Line Usage Run the kaomoji module directly from the command line to see example output demonstrating all available categories and features. ### Command ```bash python -m kaomoji ``` ### Expected Output ``` Random category: ヽ(ー_ー)ノ Joy: \(^ω^)/ Indifference: ¯\_(︶~︶)_/¯ Love: ♡╰(◡‿◡)╯♡ Categories: ['indifference', 'joy', 'love', 'sadness'] Template placeholders: ['right_arm', 'left_eye', 'mouth', 'right_eye', 'left_arm'] ``` ``` -------------------------------- ### create() Method Source: https://context7.com/keithdowd/kaomoji/llms.txt Explains how to use the create() method to generate kaomoji from specific categories or randomly. ```APIDOC ## create() Method Generates a procedurally generated kaomoji by randomly selecting features from a specified category or a random category if none is provided. Returns a string containing the complete emoticon assembled from left arm, eyes, mouth, and right arm components. ### Method Signature ```python create(category: str = None) -> str ``` ### Parameters #### Path Parameters - **category** (str) - Optional - The category of emotion to generate a kaomoji from (e.g., 'joy', 'sadness'). If None, a random category is chosen. ### Request Example ```python from kaomoji.kaomoji import Kaomoji kao = Kaomoji() # Generate kaomoji for specific emotions joy_kaomoji = kao.create("joy") print(f"Joy: {joy_kaomoji}") # Output: Joy: \(☆▽☆)ノ (varies - uses joy features) sadness_kaomoji = kao.create("sadness") print(f"Sadness: {sadness_kaomoji}") # Output: Sadness: .・゚゚・(╥﹏╥)・゚゚・. (varies - uses sadness features) love_kaomoji = kao.create("love") print(f"Love: {love_kaomoji}") # Output: Love: ♡╰(◕‿◕)╯♡ (varies - uses love features) indifference_kaomoji = kao.create("indifference") print(f"Indifference: {indifference_kaomoji}") # Output: Indifference: ┐( ̄ヘ ̄)┌ (varies - uses indifference features) # Generate from random category (no argument) random_kaomoji = kao.create() print(f"Random: {random_kaomoji}") # Output: Random: (any category's features) ``` ### Response #### Success Response (200) - **emoticon** (str) - A string representing the generated kaomoji. ``` -------------------------------- ### Accessing and Generating Kaomoji Source: https://context7.com/keithdowd/kaomoji/llms.txt Demonstrates how to instantiate the Kaomoji class, access internal category data, and generate kaomoji for a specific category. The `create()` method randomly selects components based on the category's features. ```python # The config.py defines the template and categories structure: # TEMPLATE: str = "{left_arm}({left_eye}{mouth}{right_eye}){right_arm}" # Example category structure (from config.py): # CATEGORIES = { # "joy": { # "description": "A feeling of great pleasure and happiness.", # "features": { # "left_arm": ["╰", "\", "٩", "<"], # "right_arm": ["ノ", "ノ", "o", "/"], # "left_eye": ["▔", "^", "¯", "☆"], # "right_eye": ["▔", "^", "¯", "☆"], # "mouth": ["▽", "ω", "ヮ", "∀"], # }, # "valence": "positive", # }, # ... # } from kaomoji.kaomoji import Kaomoji kao = Kaomoji() # Access internal categories (for inspection) print(f"Joy category features: {kao._categories['joy']['features']}") # Output shows all available joy emoticon components # Generate multiple joy kaomoji to see variety print("Joy variations:") for i in range(5): print(f" {kao.create('joy')}") # Output: Different joy emoticons each time due to random selection ``` -------------------------------- ### Instantiate Kaomoji Object Source: https://github.com/keithdowd/kaomoji/blob/master/README.md Create an instance of the Kaomoji class. This object will be used to generate kaomoji. ```python kao = Kaomoji() ``` -------------------------------- ### Import Kaomoji Class Source: https://github.com/keithdowd/kaomoji/blob/master/README.md Import the Kaomoji class from the kaomoji package to begin generating emoticons. ```python from kaomoji.kaomoji import Kaomoji ``` -------------------------------- ### Kaomoji Class Usage Source: https://context7.com/keithdowd/kaomoji/llms.txt Demonstrates how to instantiate the Kaomoji class and generate random emoticons. ```APIDOC ## Kaomoji Class The main class for procedurally generating Japanese emoticons from a collection of categorized features. It loads predefined categories (joy, sadness, love, indifference) with their associated components and uses a template string to combine them into complete kaomoji. ### Instantiation ```python from kaomoji.kaomoji import Kaomoji # Instantiate a Kaomoji object kao = Kaomoji() ``` ### Random Generation ```python # Generate a kaomoji from a random category random_kaomoji = kao.create() print(f"Random: {random_kaomoji}") # Output: Random: ╰(^ω^)ノ (varies each time) ``` ### String Conversion ```python # The Kaomoji object can be converted to string (shows last generated) print(str(kao)) print(repr(kao)) ``` ``` -------------------------------- ### template Property Source: https://context7.com/keithdowd/kaomoji/llms.txt Details the template placeholders used for constructing kaomoji. ```APIDOC ## template Property Returns a list of all feature placeholders used in the template string for assembling kaomoji. These placeholders represent the configurable parts of the emoticon: left_arm, right_arm, left_eye, right_eye, and mouth. ### Property Access ```python kao.template ``` ### Request Example ```python from kaomoji.kaomoji import Kaomoji kao = Kaomoji() # Get template placeholders template_parts = kao.template print(f"Template placeholders: {template_parts}") # Output: Template placeholders: ['right_arm', 'left_eye', 'mouth', 'right_eye', 'left_arm'] # The default template format is: {left_arm}({left_eye}{mouth}{right_eye}){right_arm} # This creates patterns like: ╰(^▽^)ノ # │ │ │ │ └── right_arm # │ │ │ └───── right_eye # │ │ └─────── mouth # │ └────────── left_eye # └───────────── left_arm ``` ### Response #### Success Response (200) - **template** (list[str]) - A list of strings representing the placeholders in the kaomoji template. ``` -------------------------------- ### categories Property Source: https://context7.com/keithdowd/kaomoji/llms.txt Shows how to access the list of available kaomoji categories. ```APIDOC ## categories Property Returns a list of all available top-level category labels that can be used with the `create()` method. The default categories include emotions like joy, sadness, love, and indifference. ### Property Access ```python kao.categories ``` ### Request Example ```python from kaomoji.kaomoji import Kaomoji kao = Kaomoji() # Get all available categories available_categories = kao.categories print(f"Available categories: {available_categories}") # Output: Available categories: ['indifference', 'joy', 'love', 'sadness'] # Iterate through all categories and generate one kaomoji each for category in kao.categories: emoticon = kao.create(category) print(f"{category.capitalize()}: {emoticon}") # Output: # Indifference: ╮( ´ _ ` )╭ # Joy: ٩(^∀^)o # Love: ♡\(˘ω˘)ノ♡ # Sadness: 。・゚(ಥ︵ಥ)・゚。 ``` ### Response #### Success Response (200) - **categories** (list[str]) - A list of strings, where each string is a valid category name. ``` -------------------------------- ### Push Feature Branch Source: https://github.com/keithdowd/kaomoji/blob/master/CONTRIBUTING.md Push your committed feature changes to the origin repository. ```console git push origin feature) ``` -------------------------------- ### Generate Random Kaomoji Source: https://github.com/keithdowd/kaomoji/blob/master/README.md Use the create() method on a Kaomoji object to generate a kaomoji from a random category. ```python kao.create() ``` -------------------------------- ### Create New Feature Branch Source: https://github.com/keithdowd/kaomoji/blob/master/CONTRIBUTING.md Use this command to create a new branch for your feature development. ```console git checkout -b feature ``` -------------------------------- ### Commit Feature Changes Source: https://github.com/keithdowd/kaomoji/blob/master/CONTRIBUTING.md Stage and commit your new feature changes to the repository. ```console git commit -am 'Added a new feature.' ``` -------------------------------- ### Instantiate Kaomoji Class and Generate Random Emoticon Source: https://context7.com/keithdowd/kaomoji/llms.txt Instantiate the Kaomoji object and generate a random emoticon. The object can also be converted to a string to display the last generated emoticon. ```python from kaomoji.kaomoji import Kaomoji # Instantiate a Kaomoji object kao = Kaomoji() # Generate a kaomoji from a random category random_kaomoji = kao.create() print(f"Random: {random_kaomoji}") # Output: Random: ╰(^ω^)ノ (varies each time) # The Kaomoji object can be converted to string (shows last generated) print(str(kao)) print(repr(kao)) ``` -------------------------------- ### Generate Kaomoji from Specific Category Source: https://github.com/keithdowd/kaomoji/blob/master/README.md Generate a kaomoji from a specific category by passing the category name to the create() method. ```python kao.create("joy") ``` -------------------------------- ### View Available Categories Source: https://github.com/keithdowd/kaomoji/blob/master/README.md Access the 'categories' attribute of a Kaomoji object to view all available categories for generation. ```python kao.categories ``` -------------------------------- ### Generate Kaomoji for Specific Emotions Source: https://context7.com/keithdowd/kaomoji/llms.txt Generate kaomoji for specific emotions like 'joy', 'sadness', 'love', or 'indifference' by passing the category name to the create() method. A random emoticon can be generated by calling create() without arguments. ```python from kaomoji.kaomoji import Kaomoji kao = Kaomoji() # Generate kaomoji for specific emotions joy_kaomoji = kao.create("joy") print(f"Joy: {joy_kaomoji}") # Output: Joy: \(☆▽☆)ノ (varies - uses joy features) sadness_kaomoji = kao.create("sadness") print(f"Sadness: {sadness_kaomoji}") # Output: Sadness: .・゚゚・(╥﹏╥)・゚゚・. (varies - uses sadness features) love_kaomoji = kao.create("love") print(f"Love: {love_kaomoji}") # Output: Love: ♡╰(◕‿◕)╯♡ (varies - uses love features) indifference_kaomoji = kao.create("indifference") print(f"Indifference: {indifference_kaomoji}") # Output: Indifference: ┐( ̄ヘ ̄)┌ (varies - uses indifference features) # Generate from random category (no argument) random_kaomoji = kao.create() print(f"Random: {random_kaomoji}") # Output: Random: (any category's features) ``` -------------------------------- ### Access Available Kaomoji Categories Source: https://context7.com/keithdowd/kaomoji/llms.txt Retrieve a list of all available top-level category labels using the 'categories' property. This list can be iterated to generate emoticons for each category. ```python from kaomoji.kaomoji import Kaomoji kao = Kaomoji() # Get all available categories available_categories = kao.categories print(f"Available categories: {available_categories}") # Output: Available categories: ['indifference', 'joy', 'love', 'sadness'] # Iterate through all categories and generate one kaomoji each for category in kao.categories: emoticon = kao.create(category) print(f"{category.capitalize()}: {emoticon}") # Output: # Indifference: ╮( ´ _ ` )╭ # Joy: ٩(^∀^)o # Love: ♡\(˘ω˘)ノ♡ # Sadness: 。・゚(ಥ︵ಥ)・゚。 ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.