Skip to content

Python package for characterization and quantification of concise humour using 10 distinct computational features, inspired by Ritchie's Incongruity-Resolution Theory.

License

Notifications You must be signed in to change notification settings

mellon-collie/pyhumour

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Python package for characterization and quantification of concise humour using 10 distinct computational features, inspired by Ritchie's Incongruity-Resolution Theory.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages