Official Python client library for WIBA argument mining API
Project description
WIBA Python Client
Official Python client library for the WIBA (What Is Being Argued?) argument mining API.
🚀 Quick Start
Installation
pip install wiba
Basic Usage
from wiba import WIBA
# Initialize client
client = WIBA(api_token="your_api_token")
# Detect arguments
result = client.detect("Climate change requires immediate action.")
print(result.is_argument) # True
print(result.confidence) # 0.89
# Extract topics
topic = client.extract("We must invest in renewable energy now.")
print(topic.topic) # "renewable energy"
# Analyze stance
stance = client.stance("Solar power is expensive", "renewable energy")
print(stance.stance) # "Against"
# Discover arguments in longer text
segments = client.discover_arguments(long_text)
for segment in segments:
print(f"Argument: {segment.text} (confidence: {segment.confidence})")
Batch Processing
# Process multiple texts
texts = [
"Climate change is a serious threat.",
"We need renewable energy sources.",
"Nuclear power is too dangerous."
]
# Batch argument detection
results = client.detect(texts)
for result in results:
print(f"{result.text}: {result.is_argument}")
# Process DataFrames
import pandas as pd
df = pd.DataFrame({'text': texts})
df_results = client.detect(df)
print(df_results[['text', 'is_argument', 'confidence']])
🔧 Configuration
API Token
Get your API token from wiba.dev:
# Using API token
client = WIBA(api_token="your_token_here")
# Using environment variable
import os
os.environ['WIBA_API_TOKEN'] = 'your_token_here'
client = WIBA() # Will use WIBA_API_TOKEN automatically
Custom Configuration
from wiba import WIBA, ClientConfig
config = ClientConfig(
api_url="https://custom.wiba.dev",
api_token="your_token",
log_level="DEBUG"
)
client = WIBA(config=config)
📊 Features
Core Functions
detect(texts)- Argument detection in textextract(texts)- Topic extraction from argumentsstance(texts, topics)- Stance analysis (favor/against/neutral)discover_arguments(text)- Find argumentative segments in longer texts
Input Formats
- Single text:
"This is an argument" - List of texts:
["Text 1", "Text 2", "Text 3"] - pandas DataFrame: DataFrame with text column
- CSV string: Comma-separated values
Response Objects
All methods return structured response objects with:
- Results: List of prediction results
- Metadata: Request information and statistics
- Confidence scores: Model confidence for each prediction
Advanced Features
- Batch processing with progress bars
- Automatic retries with exponential backoff
- Connection pooling for better performance
- DataFrame integration for data science workflows
- Statistics tracking for usage monitoring
🧪 Examples
Check out the examples/ directory for:
- Basic usage examples
- Batch processing demonstrations
- DataFrame integration
- Advanced configuration
- Error handling patterns
🤝 Contributing
This package is part of the WIBA-ORG collaborative development setup:
- Report bugs: GitHub Issues
- Contribute code: See CONTRIBUTING.md
- Documentation: Help improve our docs
📄 License
MIT License - see LICENSE file for details.
🔗 Links
- Homepage: wiba.dev
- API Documentation: wiba.dev/docs
- Research Paper: [Link to paper]
- GitHub Organization: WIBA-ORG
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
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 wiba-0.2.3.tar.gz.
File metadata
- Download URL: wiba-0.2.3.tar.gz
- Upload date:
- Size: 16.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a7cc42dc587c04ce408cf0d5b4bc53948f712853450d65a736cf39228a42ea47
|
|
| MD5 |
4557f295e3d70c608eff5379161a8210
|
|
| BLAKE2b-256 |
1095b549b809953bd4e98b729db4814515d2b40f2ed6c94839aa6b02a2e4b104
|
File details
Details for the file wiba-0.2.3-py3-none-any.whl.
File metadata
- Download URL: wiba-0.2.3-py3-none-any.whl
- Upload date:
- Size: 12.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
927a70f8a5bc1690262bc67d6cb2ecf6aa8fe81ae9716e140e0f16efbb46c641
|
|
| MD5 |
8e80990d6c57dd17676f75bc228f2a94
|
|
| BLAKE2b-256 |
7d04b5d9c7fdc8e687a4c780afa8cd5698dd160213f5273acc0c82c5aa730b2a
|