Skip to main content

pyhumour

This is a module for the characterization and quantification of concise humour using 10 distinct computational features. These features were inspired by Ritchie's Incongruity-Resolution Theory, and are formulated as follows:

  1. Obviousness (obviousness)
  2. Compatibility (compatibility)
  3. Inappropriateness (inappropriateness)
  4. Humorous Conflict (humorous_conflict)
  5. Non-humorous Conflict (non_humorous_conflict)
  6. Adjective Absurdity (adjective_absurdity)
  7. Humorous Noun Absurdity (humorous_noun_absurdity)
  8. Non-humorous Noun Absurdity (non_humorous_noun_absurdity)
  9. HMM Probability (hmm_probability)
  10. N-Gram Probability (ngram_probability)

Example

import pyhumour
a = pyhumour.PyHumour([<humorous_corpus>], [<non_humorous_corpus>])
a.fit()
a.obviousness('this is an obvious statement')

Installation

Run the following to install:

pip install pyhumour

Usage

Developing pyhumour

To install pyhumour, along with the tools you need to develop and run tests, run the following in your virtualenv:

pip install -e .[dev]

Distributing pyhumour

python setup.py bdist_wheel
python setup.py sdist

Pushing pyhumour (to pypi)

pip install twine
twine upload dist/*

Pushing to testpypi

twine upload --repository testpypi dist/*

Testing in different distributions of python

pip install tox
tox

Unit tests developed with unittest

Running Unit Tests

Use the following command inside of git root directory to run the unit tests:

nosetests -w ./ --with-coverage --cover-html --cover-package=./ --cover-erase --with-timer --timer-top-n 10

A folder called cover will be created in src post running the command. You can open cover/index.html to view the lines (if any) that need to be additionally covered in the unit tests.

Metadata

Release files for pyhumour 0.1.1

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

Source distribution (sdist)

Source distribution for pyhumour 0.1.1
File Size Uploaded Provenance Actions
pyhumour-0.1.1.tar.gz 205.2 kB Without provenance Details for pyhumour-0.1.1.tar.gz

Built distribution (wheel)

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

Total release size: 417.6 kB

Release files / pyhumour-0.1.1.tar.gz

Download URL pyhumour-0.1.1.tar.gz
Size 205.2 kB
Tags Source
SHA-256 checksum
How to use checksums
599b096d622e08b6b4eadd1d5aee51c5d58ca6f3fd047062cd8d223ed8173a00
BLAKE2b-256 checksum
How to use checksums
4ae08d432ef52751c076d5ac116ef4d98c7fac0faf398a17d3d540c3b391e132
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.7.10

Release files / pyhumour-0.1.1-py3-none-any.whl

Download URL pyhumour-0.1.1-py3-none-any.whl
Size 212.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0e5dd830cba6687af2486cecdc3a5cf09521bd7282cd7edb92b71e80b9a7dd6e
BLAKE2b-256 checksum
How to use checksums
80dec025adeaf499bc26692fe7f1b5607a4d9abd7f6d7232afb6a7ee000f40d3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.7.10

Security for pyhumour 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

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