Skip to main content

Simple reporter for characters used in a file

Project description

This is a simple command line script that creates a list of all characters contained in a given document.

Download, Installation

repchar is available on PyPI <https://pypi.python.org/pypi/repchar/>.

Install with pip install repchar.

Usage

repchar [-h] -o OUTFILENAME [-v] [-c] INFILENAME

positional arguments:

INFILENAME Filename

optional arguments:
-h, --help

show this help message and exit

-o OUTFILENAME, --outfile OUTFILENAME, --out OUTFILENAME

Filename for report

-v, --verbose

Set log level to INFO.

--version

show program’s version number and exit

-c, --comb, --combining

Create special report for combining characters

The Reporter class

You can also use the CharReporter class in your own code:

>>> from repchar import CharReporter
>>> s = u"ABCD"
>>> r = CharReporter()
>>> r.feed(s)
>>> print(r.report())
chr hex     count   unicode
A   0041    1       LATIN CAPITAL LETTER A
B   0042    1       LATIN CAPITAL LETTER B
C   0043    1       LATIN CAPITAL LETTER C
D   0044    1       LATIN CAPITAL LETTER D

The count of each letter is stored in CharReporter.chars:

>>> r.chars
{u'A': 1, u'C': 1, u'B': 1, u'D': 1}

Special information about combining characters can be collected in CharReporter.combdir if you say so at instantiation:

>>> from repchar import CharReporter
>>> r2 = CharReporter(combining=True)
>>> s = u"Caffe\u0300"
>>> r2.feed(s)
>>> print(r2.report().encode("UTF-8"))
chr hex     count   unicode
C   0043    1       LATIN CAPITAL LETTER C
a   0061    1       LATIN SMALL LETTER A
e   0065    1       LATIN SMALL LETTER E
f   0066    2       LATIN SMALL LETTER F
 ̀  0300    1       COMBINING GRAVE ACCENT
                        1 with: LATIN SMALL LETTER E
>>> r2.combdir
{u'\u0300': {u'e': 1}}

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

repchar-1.0.2.tar.gz (4.7 kB view details)

Uploaded Source

Built Distributions

repchar-1.0.2-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

repchar-1.0.2-py2-none-any.whl (4.5 kB view details)

Uploaded Python 2

File details

Details for the file repchar-1.0.2.tar.gz.

File metadata

  • Download URL: repchar-1.0.2.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for repchar-1.0.2.tar.gz
Algorithm Hash digest
SHA256 406f300e39828ffb389d7b4c1f1a381c7035fb288b3ec5b4d6351b707c8347f2
MD5 f56a33e8027ed5a099707afcafd71e5f
BLAKE2b-256 1140e7f1b96b29cae49a1f26c1551dbe621768bbe43ab0fdebf11e2b29178ce2

See more details on using hashes here.

File details

Details for the file repchar-1.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for repchar-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 db415c57ce9e0e3ea5da4e9a49789db9369d6c32c4fe8c96b73de646c68c8646
MD5 d627e97a7f52626a9d1291ade35d4eaf
BLAKE2b-256 499b398cfbcd75c6d125f8a834a56170d53cf1263db4d36f0444d1ee7355cbb8

See more details on using hashes here.

File details

Details for the file repchar-1.0.2-py2-none-any.whl.

File metadata

File hashes

Hashes for repchar-1.0.2-py2-none-any.whl
Algorithm Hash digest
SHA256 96e57b5df90eb64f052ee57c6a419e8f3c0a998da070a5e74e3a64a09fb3fb7b
MD5 45b2cb5dafec161fe47825b1960f5e24
BLAKE2b-256 93033113ddf98e90893347069be488302b7f0cbaab7a1b71e48643091056c735

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