Skip to main content

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 text
  • extract(texts) - Topic extraction from arguments
  • stance(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:

  1. Report bugs: GitHub Issues
  2. Contribute code: See CONTRIBUTING.md
  3. Documentation: Help improve our docs

📄 License

MIT License - see LICENSE file for details.

🔗 Links

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

wiba-0.2.2.tar.gz (15.5 kB view details)

Uploaded Source

Built Distribution

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

wiba-0.2.2-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

Details for the file wiba-0.2.2.tar.gz.

File metadata

  • Download URL: wiba-0.2.2.tar.gz
  • Upload date:
  • Size: 15.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.2

File hashes

Hashes for wiba-0.2.2.tar.gz
Algorithm Hash digest
SHA256 799d3063d4a8b791af99885843bff46ffce140e3fa9b6741e881421b68b86f06
MD5 b60618d7a13915f7009ee5cea9f3a189
BLAKE2b-256 4729f972fb6bfbcd2dcab9fff40ff5023133f765fd477bffb08028164ebbf2fb

See more details on using hashes here.

File details

Details for the file wiba-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: wiba-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 12.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.2

File hashes

Hashes for wiba-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ebc5e6c751d407b7d20e1d0b043a3026b3f70b9c31a24b56a296c27da53120bc
MD5 456e7a904cd27ae56e912324928ff5d5
BLAKE2b-256 43610f32a316508fcf8f16f9784a017d17827e2310efdad816fc20adbd5f3717

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