Detect implicit intent vs tone in short conversational turns
Project description
Implicature Intent
Detect implicit intent vs. tone in short conversational turns.
implicature-intent is a lightweight, zero-dependency Python library designed to separate what someone means (Intent) from how they say it (Tone). It is deterministic, explainable, and fast.
Why Intent ≠ Sentiment?
Sentiment analysis often conflates "tone" with "intent":
| Response | Sentiment Tools Say | Actual Intent |
|---|---|---|
| "I'd love to, but I'm swamped." | Positive ("love") | NO |
| "Fine, I'll do it." | Negative | YES |
| "How about Tuesday instead?" | Neutral | Counter-offer |
| "I guess so, if I have to." | Negative | YES (reluctant) |
This library disentangles these signals.
Features
- Zero Dependencies: Fast, heuristic-based scoring
- Explainable: Returns evidence phrases and confidence scores
- Actionable Output: Commitment level, needs_clarification flags, response types
- Offline-First: No API calls, no network required
Installation
pip install implicature-intent
Quick Start
from implicature_intent import analyze_intent
result = analyze_intent("I'd love to, but I have a conflict.")
print(result["orientation"]) # "NO"
print(result["sentiment_tone"]) # "positive"
print(result["intent_type"]) # "polite_reject"
print(result["mismatch"]) # True (tone contradicts intent)
Output Schema
{
# Core Intent
"orientation": "YES" | "NO" | "NON_COMMITTAL" | "UNKNOWN",
"intent_type": "direct_accept" | "polite_reject" | "angry_agreement" |
"reluctant_yes" | "conditional_yes" | "counter_offer" |
"soft_deferral" | "delegation" | ...,
# Response Classification
"response_type": "direct" | "conditional" | "counter_offer" |
"deferral" | "delegation" | "question",
# Sentiment & Tone
"sentiment_tone": "positive" | "negative" | "neutral" | "mixed",
"sentiment_score": -1.0 to 1.0,
# Actionable Signals
"commitment_level": 0.0 to 1.0, # How firm is this response?
"needs_clarification": bool, # Should you follow up?
"mismatch": bool, # Tone contradicts intent?
# Politeness
"politeness": "low" | "medium" | "high",
"politeness_score": 0.0 to 1.0,
# Explainability
"confidence": 0.0 to 1.0,
"evidence_phrases": list[str],
"explanation": str
}
Examples
Detecting Hidden "No"
analyze_intent("Thanks for thinking of me, but I'm slammed this week.")
# → orientation: "NO", intent_type: "polite_reject", sentiment_tone: "positive"
Angry Agreement
analyze_intent("It's a stupid idea, but fine, I'll do it.")
# → orientation: "YES", intent_type: "angry_agreement", mismatch: True
Counter-Offer
analyze_intent("How about we push it to next Tuesday instead?")
# → orientation: "NO", response_type: "counter_offer", needs_clarification: True
Conditional Yes
analyze_intent("Sure, as long as we can wrap up by 5pm.")
# → orientation: "YES", response_type: "conditional", intent_type: "conditional_yes"
Low Commitment
analyze_intent("I'll try my best, hopefully I can make it work.")
# → orientation: "YES", commitment_level: 0.2, needs_clarification: True
Use Cases
- Sales CRM: Detect when a lead is politely declining vs. genuinely interested
- Customer Support: Identify frustrated agreement vs. satisfied resolution
- Meeting Scheduling: Parse conditional availability and counter-offers
- Chatbots: Understand user intent beyond keyword matching
- Email Analysis: Flag responses that need follow-up
Limitations
- Sarcasm: Hard to detect without audio/visual cues or deeper context
- Domain-Specific Language: "I'll table this" might be YES or NO depending on culture
- Very Short Responses: "Ok" is ambiguous without context
Development
# Install dev dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Build for distribution
python -m build
Roadmap
- v0.2: Evaluation harness with benchmark dataset
- v0.3: Domain tuning (sales, support, scheduling)
- v0.4: Optional LLM adapter for complex cases
License
MIT
Built by Loom Labs
Research Inspiration
This library is inspired by the research paper Disentangling Intent from Tone in Conversational Agents.
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 implicature_intent-0.1.1.tar.gz.
File metadata
- Download URL: implicature_intent-0.1.1.tar.gz
- Upload date:
- Size: 13.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c88d3050fab3cdaec4898c6ed37b66a7ba90b75d8b36d5f1d38c22db9f73fcac
|
|
| MD5 |
5842cd3abec9d57f97d2e2386c2870a0
|
|
| BLAKE2b-256 |
37fa24c945d75e1c46784ce96bc344d2d81082d2d2a5804cd963f42721870ef6
|
File details
Details for the file implicature_intent-0.1.1-py3-none-any.whl.
File metadata
- Download URL: implicature_intent-0.1.1-py3-none-any.whl
- Upload date:
- Size: 11.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ec21f4bf80ccaed84c7dde483a4e6ed4c8dc5c30b3281db94e2c0aa1da959eb
|
|
| MD5 |
35866f0d1821e19f96b55768f4bfa465
|
|
| BLAKE2b-256 |
34e6f78cc72ba0fa5666803f078a635197a6fe0c6da324dfdd200b639b412357
|