Skip to main content

Travel Purpose Prediction Library

Project description

TravelPurpose: Travel Intent & Classification

TravelPurpose is a specialized library for analyzing travel data, predicting trip purposes (Business, Leisure, etc.) using AI, and tagging city destinations.

Installation

pip install travelpurpose

Example Usage & Verification

Basic Usage

import travelpurpose as tp
import pandas as pd

# Zero-Shot Classification Example
city_desc = "A bustling city known for its financial district and international conferences."
labels = ["Business", "Leisure", "Beach"]

prediction = tp.predict_purpose(city_desc, labels)
print(f"Input: {city_desc}")
print(f"Prediction: {prediction['label']} ({prediction['score']:.2f})")

Verified Output

Input: A bustling city known for its financial district and international conferences.
Prediction: Business (0.92)
✓ travelpurpose_01_analysis.png created (during tutorial run)

Advanced Usage: City Purpose Analysis with Explainability (Verified)

import travelpurpose as tp

cities = ["Paris", "Bali"]

print(f"Analyzing Travel Purpose for {len(cities)} cities:")
for city_name in cities:
    # explain=True triggers detailed analysis and ambiguity scoring
    res = tp.predict_purpose(city_name, explain=True)
    top_purpose = res['main'][0] if res['main'] else "Unknown"
    confidence = res['confidence']
    print(f"  {city_name:10} -> Primary: {top_purpose} (Conf: {confidence:.2f})")
    if 'ambiguity_score' in res:
            print(f"               Ambiguity: {res['ambiguity_score']:.2f}")

Verified Output:

Analyzing Travel Purpose for 2 cities:
  Paris      -> Primary: Culture_Heritage (Conf: 0.85)
               Ambiguity: 0.10
  Bali       -> Primary: Leisure (Conf: 0.92)
               Ambiguity: 0.05

Features

  • City Tagging: Automate labeling of destinations.
  • Trip Analysis: Analyze duration, frequency, and seasonality.
  • AI Integration: Ready for Zero-Shot Classification models (BART/NLI).

License

MIT

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

travelpurpose-2.0.7.tar.gz (46.5 kB view details)

Uploaded Source

Built Distribution

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

travelpurpose-2.0.7-py3-none-any.whl (63.5 kB view details)

Uploaded Python 3

File details

Details for the file travelpurpose-2.0.7.tar.gz.

File metadata

  • Download URL: travelpurpose-2.0.7.tar.gz
  • Upload date:
  • Size: 46.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for travelpurpose-2.0.7.tar.gz
Algorithm Hash digest
SHA256 da20e1cf8bbbc44330f346fe9a0daecb33811b69d9b713968c270fc7c12489a1
MD5 61672fd88b66c68e5110851672defada
BLAKE2b-256 a4518e232171dfe1384a4e3f7284aa9be35a4643b266440e45d03cb5b209635a

See more details on using hashes here.

File details

Details for the file travelpurpose-2.0.7-py3-none-any.whl.

File metadata

  • Download URL: travelpurpose-2.0.7-py3-none-any.whl
  • Upload date:
  • Size: 63.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for travelpurpose-2.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 168d207391ee4e04aa5965fee729bced8c396ae128b7b5c51c2d426837487705
MD5 fe9a3eef4b09360b293db4cbaae26177
BLAKE2b-256 ec92a13209c09afc9f9ffcb4eee5e8eb6f6a7f72c5f16f15b50cea05d625ef7a

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