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.1.tar.gz (15.4 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.1-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: wiba-0.2.1.tar.gz
  • Upload date:
  • Size: 15.4 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.1.tar.gz
Algorithm Hash digest
SHA256 92a737641a058e35d8849c7c4af000202b1ab5d148ea1b49de9cb86544e780dc
MD5 ac69e2be46db609f60214c720ee0ca9e
BLAKE2b-256 d359d67ec024c5977440ee9bbb407761ce0e8e113c19f3d65a2afc720f5a03ee

See more details on using hashes here.

File details

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

File metadata

  • Download URL: wiba-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 12.1 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f7c9bba53ade7bb283a843385ef1454f289dad517c70bae2de9dd92f47aee080
MD5 757a9fedb5fa8b19eabf94d7f3e5740b
BLAKE2b-256 e94f05a45e318a888f56fb0e62199184f214990694080ee20ded51677866d47b

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