Skip to main content

A Python package for determining a piece of text's point of view (first, second, third, or unknown).

Project description

pointofview

Latest PyPI version GitHub Workflow Status

A Python package for determining a piece of text's point of view (first, second, third, or unknown).

Installation

pointofview is available on PyPI. Simply install it with pip:

pip install pointofview

You can also install it from source:

$ git clone https://github.com/prosegrinder/python-pointofview.git
Cloning into 'python-pointofview'...
...

$ cd python-pointofview
$ python setup.py install
...

Usage

pointofview guesses a text's point of view by counting point of view pronouns. The main function get_text_pov() will return 'first', 'second', 'third', or null (Python's None object):

>>> import pointofview
>>> text = "I'm a piece of text written in first person! What are you?"
>>> pointofview.get_text_pov(text)
'first'

There are two other helper functions as well.

get_word_pov() returns the point of view of a single word:

>>> pointofview.get_word_pov("I")
'first'
>>> pointofview.get_word_pov("nope")
None

parse_pov_words() returns a dict containing all first-, second-, and third-person point-of-view words:

>>> text = """
... When I try to analyze my own cravings, motives, actions and so forth, I surrender to a sort of retrospective imagination which feeds the analytic faculty with boundless alternatives and which causes each visualized route to fork and re-fork without end in the maddeningly complex prospect of my past.
... """
>>> pointofview.parse_pov_words(text)
{'first': ['i', 'i'], 'second': [], 'third': []}

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

pointofview-1.0.4.tar.gz (15.8 kB view details)

Uploaded Source

Built Distribution

pointofview-1.0.4-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

File details

Details for the file pointofview-1.0.4.tar.gz.

File metadata

  • Download URL: pointofview-1.0.4.tar.gz
  • Upload date:
  • Size: 15.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.1 CPython/3.10.6 Linux/5.15.0-1024-azure

File hashes

Hashes for pointofview-1.0.4.tar.gz
Algorithm Hash digest
SHA256 28ea310a9b19c79b0535423b059594ba125e54692acfa8d01fbffbb4b01eb07b
MD5 39fc8096058d515a1bbd7bc71b798a88
BLAKE2b-256 b420f682d86d052f34c31cd2508a441c3925c9a2568d30a3c89f3d03aac11d4e

See more details on using hashes here.

File details

Details for the file pointofview-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: pointofview-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 15.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.1 CPython/3.10.6 Linux/5.15.0-1024-azure

File hashes

Hashes for pointofview-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 cb57a9ce9422977763bdac9731423f22ef2710f03d1e32ed560c998c4e9e96d3
MD5 51468ae84e2f76570466be72421ca6f0
BLAKE2b-256 175cc2cec987ccb42b192a28f44d2295c68752a82a55cfdfc6ffade1bda6d20b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page