Skip to main content

Perspectives: Pandas-based library for emotion graphing and semantic search with LMs

Overview

The Perspectives library offers an easy way to extract perspectives (emotion events with a speaker, emotion, object, and reason) at scale with its cutting-edge emotion extraction model. It is built on top of the powerful pandas DataFrame functionality, with added support for semantic search. The library introduces several novel methods for text analytics, perfect for dealing with customer feedback, analyzing semantic trends, or profiling entities within a text. image Graph generated from extracted perspectives

image Semantic search dashboard built on top of pandas

Main Features

  1. Easily extract perspectives from text: The get_perspectives() function allows you to extract the speaker's identity, emotions, and the object of these emotions, giving you useful insights about the emotions in your text.

  2. Powerful search capabilities: You can perform semantic search on the dataset based on any column or combination of columns in the dataset (including columns generated from perspective extraction) . The search method leverages the sentence transformer models for semantic search functionality, providing you with outputs that are spot-on.

  3. Improved machine learning models: The library efficiently interfaces with specialized model bart-perspectives for extraction and the mpnet-base model for search.

  4. Structured emotional outcomes: All outputs are neatly structured in DataFrame format, allowing for easy downstream analysis and visualizations.

Installation

pip install perspectives

Usage

from perspectives import DataFrame

# Load DataFrame
df = DataFrame(texts = [list of sentences]) 

# Get perspectives
df.get_perspectives()

# Semantic search on any combination of columns
df.search(speaker='...', emotion='...')

# Profile
df.graph(speaker='...')

Demo

Video demo

Colab demo for profiling

Colab demo for analyzing customer reviews

About me

I'm a recent grad of Ohio State University where I did an undergraduate thesis on Synthetic Data Augmentation using LLMs. I've worked as an NLP consultant for a couple awesome startups, and now I'm looking for a role with an inspiring company who is as interested in the untapped potential of LMs as I am! Here's my LinkedIn.

Contributing and Support

Contributions are welcome! Please raise a GitHub issue for any problems you encounter.

Buy me a coffee!

Licence

The library is open source, free to use under the MIT license.

Please note that this library is still under active development, hence you may see regular updates and improvements. Feel free to contribute!

Metadata

Release files for perspectives 1.0.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for perspectives 1.0.8
File Size Uploaded
perspectives-1.0.8.tar.gz 6.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for perspectives 1.0.8
File Interpreter ABI Platform
perspectives-1.0.8-py3-none-any.whl Python 3 none any Details

Total release size: 12.5 kB

Release files / perspectives-1.0.8.tar.gz

Download URL perspectives-1.0.8.tar.gz
Size 6.2 kB
Tags Source
SHA-256 checksum
How to use checksums
daf6caa032a1f05347c0900fe0d95db5ff37a9426d85d6ab3b599516dd7020a2
BLAKE2b-256 checksum
How to use checksums
ddfdf6657c98bea2b053dac56d44f22be0dcdc6424922b3d5b7134528487e0ba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.12

Release files / perspectives-1.0.8-py3-none-any.whl

Download URL perspectives-1.0.8-py3-none-any.whl
Size 6.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d8d9aff4c8dde355cdf3f7f394e341f666bf84c2c04e3aff94bdd429e65453aa
BLAKE2b-256 checksum
How to use checksums
7530109d56f4bf405cdfae67a483daf672517837afcd462e24ccc5d60537bfa5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.12

Release history Release notifications | RSS feed

This release

1.0.8 This release

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.1.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page