Python package to enhance programming experience with AI LLM capabilities
Project description
Akihiro
Akihiro is a Python utility library that enhances the traditional programming experience using advanced language model capabilities.
It allows developers to integrate intelligent behaviors such as summarization, translation, entity extraction, contextual evaluation, and data generation directly into their code. Simplifying complex logic through natural language understanding.
✨ Features
- 🧠 Contextual Evaluation – Evaluate if a variable satisfies a condition using plain language.
- 📄 Text Summarization – Generate concise summaries from long text input.
- 🌐 Natural Translation – Translate text accurately into different languages.
- 🔍 Entity Extraction – Identify and classify entities (e.g., people, places, organizations) from structured or unstructured data.
- 🎯 Context Extraction – Extract specific information from data using natural language queries.
- 📊 Sentiment Analysis – Analyze the emotional tone and sentiment of text.
- 🎲 Data Generation – Generate realistic fake data for testing and development.
- 🏷️ Auto Tagging – Automatically generate context-aware tags for any text.
- 🤝 Contextual Compare – Compare two texts/data for contextual similarity (not just exact match).
🔧 Installation
pip install akihiro
🚀 Quick Start
from akihiro import (
isContext, summarizeText, translateText, extractEntities,
extractContext, analyzeSentiment, generate_fullname, generate_email_from_username
, autoTag, contextualCompare
)
# Check if a variable meets a condition
result = isContext("John Doe", "is a person's name")
print(result) # True
# Extract specific context
colors = extractContext("I have red and blue balloons", "colors")
print(colors) # ['red', 'blue']
# Generate fake data
name = generate_fullname()
email = generate_email_from_username("john_doe")
print(f"{name}: {email}")
# Analyze sentiment
sentiment = analyzeSentiment("I love this amazing product!")
print(sentiment)
📚 Get Help and Tutorials
import akihiro
akihiro.info() # Display comprehensive tutorials for all functions
📚 Detailed Examples
1. Contextual Evaluation (isContext)
Evaluate if a variable satisfies a condition using natural language.
from akihiro import isContext
# Check if a string is a name
result = isContext("John Doe", "is a person's name")
print(result) # True
# Check if a number is positive
result = isContext(42, "is a positive number")
print(result) # True
# Check if a string contains specific text
result = isContext("Hello world", "contains the word 'hello'")
print(result) # True
# Check if a list has specific properties
result = isContext([1, 2, 3], "contains only numbers")
print(result) # True
# Check complex conditions
result = isContext("user@example.com", "is a valid email address")
print(result) # True
Expected Output:
True
True
True
True
True
2. Context Extraction (extractContext)
Extract specific information from data using natural language queries.
from akihiro import extractContext
# Extract colors from text
text = "I have a red and blue balloon, and also a black cloth"
colors = extractContext(text, "colors")
print(colors) # ['red', 'blue', 'black']
# Extract only balloon colors
balloon_colors = extractContext(text, "balloon colors")
print(balloon_colors) # ['red', 'blue']
# Extract numbers from text
text_with_numbers = "I have 5 apples, 3 oranges, and 10 bananas"
numbers = extractContext(text_with_numbers, "numbers")
print(numbers) # ['5', '3', '10']
# Extract names from text
text_with_names = "John works with Sarah and Mike at the office"
names = extractContext(text_with_names, "names")
print(names) # ['John', 'Sarah', 'Mike']
Expected Output:
['red', 'blue', 'black']
['red', 'blue']
['5', '3', '10']
['John', 'Sarah', 'Mike']
3. Text Summarization (summarizeText)
Generate concise summaries from long text with customizable length.
from akihiro import summarizeText
# Summarize a long article
long_text = """
Artificial Intelligence (AI) has revolutionized the way we approach problem-solving in modern computing.
Machine learning algorithms can now process vast amounts of data to identify patterns and make predictions
with remarkable accuracy. Deep learning, a subset of machine learning, uses neural networks with multiple
layers to model complex relationships in data. These technologies are being applied across various industries,
from healthcare diagnostics to autonomous vehicles, transforming how we work and live.
"""
summary = summarizeText(long_text, max_length=30)
print(summary)
Expected Output:
AI revolutionizes problem-solving through machine learning and deep learning, transforming industries from healthcare to autonomous vehicles.
4. Text Translation (translateText)
Translate text to different languages with natural accuracy.
from akihiro import translateText
# Translate to Spanish
spanish = translateText("Hello, how are you today?", "Spanish")
print(spanish) # ¡Hola! ¿Cómo estás hoy?
# Translate to French
french = translateText("The weather is beautiful today", "French")
print(french) # Le temps est magnifique aujourd'hui
# Translate to Japanese
japanese = translateText("Thank you very much", "Japanese")
print(japanese) # どうもありがとうございます
# Translate to German
german = translateText("I love programming", "German")
print(german) # Ich liebe das Programmieren
Expected Output:
¡Hola! ¿Cómo estás hoy?
Le temps est magnifique aujourd'hui
どうもありがとうございます
Ich liebe das Programmieren
5. Entity Extraction (extractEntities)
Extract and classify named entities from text or structured data.
from akihiro import extractEntities
# Extract entities from text
text = "John Smith works at Microsoft in Seattle. He previously worked at Google in Mountain View."
entities = extractEntities(text)
print(entities)
Expected Output:
[
{"entity": "John Smith", "type": "Person"},
{"entity": "Microsoft", "type": "Organization"},
{"entity": "Seattle", "type": "Location"},
{"entity": "Google", "type": "Organization"},
{"entity": "Mountain View", "type": "Location"}
]
6. Sentiment Analysis (analyzeSentiment)
Analyze the emotional tone and sentiment of text.
from akihiro import analyzeSentiment
# Analyze positive sentiment
positive_text = "I absolutely love this product! It's amazing and works perfectly."
sentiment = analyzeSentiment(positive_text)
print(sentiment)
# Analyze negative sentiment
negative_text = "This is the worst experience I've ever had. Terrible service!"
sentiment = analyzeSentiment(negative_text)
print(sentiment)
# Analyze neutral sentiment
neutral_text = "The weather is cloudy today with a chance of rain."
sentiment = analyzeSentiment(neutral_text)
print(sentiment)
Expected Output:
{
"sentiment": "positive",
"confidence": 0.95,
"emotion": "happy"
}
{
"sentiment": "negative",
"confidence": 0.88,
"emotion": "angry"
}
{
"sentiment": "neutral",
"confidence": 0.72,
"emotion": "calm"
}
7. Data Generation Functions
Generate realistic fake data for testing and development.
from akihiro import (
generate_comment, generate_email_from_username, generate_fullname,
generate_paragraph, generate_sentence, generate_username_from_fullname
)
# Generate random comment
comment = generate_comment()
print(comment)
# Generate email from username
email = generate_email_from_username("john_doe")
print(email) # john_doe@gmail.com
# Generate full name
fullname = generate_fullname()
print(fullname) # Dr. John Smith
# Generate paragraph
paragraph = generate_paragraph(sentences=2)
print(paragraph)
# Generate sentence
sentence = generate_sentence()
print(sentence)
# Generate username from full name
username = generate_username_from_fullname("John Michael Smith")
print(username) # johnmichaelsmith
Expected Output:
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore.
john_doe@gmail.com
Dr. John Smith
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
The quick brown fox jumps over the lazy dog.
johnmichaelsmith
8. Auto Tagging (autoTag)
Automatically generate context-aware tags for any text.
from akihiro import autoTag
text = "The stock market crashed yesterday due to global economic concerns."
tags = autoTag(text)
print(tags) # ["finance", "news", "stock market"]
Expected Output:
["finance", "news", "stock market"]
9. Contextual Compare (contextualCompare)
Compare two texts/data for contextual similarity (not just exact match).
from akihiro import contextualCompare
# Compare two sentences for emotion similarity
result = contextualCompare("I am happy", "I feel joyful", context="emotion")
print(result) # True
# Compare two topics
result = contextualCompare("Artificial Intelligence", "Machine Learning", context="topic")
print(result) # True/False (depending on LLM judgment)
Expected Output:
True
True
🔧 Advanced Usage
Error Handling
from akihiro import summarizeText, translateText, extractContext
try:
# Handle potential API errors
summary = summarizeText("Your text here", max_length=10)
print(summary)
except Exception as e:
print(f"Error: {e}")
try:
colors = extractContext("Red and blue items", "colors")
print(colors)
except Exception as e:
print(f"Extraction error: {e}")
Custom Data Generation
from akihiro import generate_fullname, generate_email_from_username
# Generate multiple test users
for i in range(5):
name = generate_fullname()
username = generate_username_from_fullname(name)
email = generate_email_from_username(username)
print(f"User {i+1}: {name} ({email})")
Sentiment Analysis for Social Media
from akihiro import analyzeSentiment
# Analyze customer reviews
reviews = [
"Amazing product! Highly recommend!",
"Terrible quality, waste of money",
"It's okay, nothing special",
"Best purchase ever! Love it!"
]
for review in reviews:
sentiment = analyzeSentiment(review)
print(f"Review: {review}")
print(f"Sentiment: {sentiment['sentiment']} ({sentiment['confidence']:.2f})")
print("---")
8. Library Information (info)
Get comprehensive tutorials and examples for all functions.
import akihiro
# Display complete function tutorials
akihiro.info()
Expected Output:
================================================================================
🎯 AKIHIRO LIBRARY - COMPLETE FUNCTION TUTORIAL
================================================================================
1️⃣ CONTEXTUAL EVALUATION (isContext)
--------------------------------------------------
Evaluate if a variable satisfies a condition using natural language.
📝 Usage:
result = isContext(variable, condition)
💡 Examples:
isContext('John Doe', 'is a person's name') → True
isContext(42, 'is a positive number') → True
...
[Complete tutorial for all functions...]
🛠️ Requirements
- Python 3.6+
requestslibraryfakerlibrary- Internet connection (for API calls)
📝 License
This project is licensed under the MIT License - see the LICENSE file for details.
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
📞 Support
If you encounter any issues or have questions, please open an issue on GitHub.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file akihiro-1.6.0.tar.gz.
File metadata
- Download URL: akihiro-1.6.0.tar.gz
- Upload date:
- Size: 16.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d192d29f9897f6362dd4bfb17b6c42b868e9b0ae5b193f8bbfebc1907d55baf6
|
|
| MD5 |
a95d066f0ac2050c6c7c2e0da79fc4c3
|
|
| BLAKE2b-256 |
01e9dd289c331e7bee11f9873ea0492fa252e2bdcb4023de2b0337b5ed467aa8
|
File details
Details for the file akihiro-1.6.0-py3-none-any.whl.
File metadata
- Download URL: akihiro-1.6.0-py3-none-any.whl
- Upload date:
- Size: 12.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c96ae53e817adc85c45dbd19cca02a96212472392884bb4f14f36284c03a5aeb
|
|
| MD5 |
54d6fc291dd97b6beb95f41019234d06
|
|
| BLAKE2b-256 |
c5502a9f45cdf905d66110bf2e5153db8e69d12659272aec45bf02bf5f94306c
|