Skip to main content

AfterCopy

有时候需要从 PDF、CAJ 等文件的阅读器窗口中复制出大段文字,但是这样得到的文字粘贴到 Word 里往往不尽人意:原排版的每一行都会被“另起一段”,有些中文标点变成了带有空格的英文标点……手动调整比较烦琐,因此我写了一个简单的脚本来处理这件事。

Quick Start

pip install aftercopy
aftercopy -v

然后去阅读器中复制文字,再粘贴时得到的已经是处理好(去掉换行、替换标点)的结果了。由于无法识别分段,段落之间需要使用者手动分开。

使用完毕后请记得关闭,避免影响常规的复制粘贴的使用。

用法

aftercopy --help
Usage: aftercopy [OPTIONS]

Options:
  -p, --passive       Disable active reading from clipboard. Instead you can
                      paste into and copy from terminal. End your input with
                      Ctrl-Z + Enter (Windows) or Ctrl-D + Enter.

  -v, --verbose       Display the concrete re-copied text and more info.
  -l, --lang [cn|en]  Switch type of language in text. This will influence the
                      rule set used. (Chinese by default)

  --help              Show this message and exit.

原理

每隔 0.01 秒读一次剪贴板(性能影响可忽略不计),若发生改变则对新读入的文字作相应的处理,将结果重新写入剪贴板。

TODO

  • 替换规则。目前对于标点的替换规则是硬编码的,显然这种做法大大降低了使用的灵活性。但是我还没有想到在每次运行 / 在安装时指定规则文件的较好办法。
  • 错别字识别。没找到这方面便捷的库。

One more thing...

请勿用于抄袭等侵犯他人著作权的用途。

Metadata

Release files for aftercopy 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 aftercopy 0.1.1
File Size Uploaded Provenance
aftercopy-0.1.1.tar.gz 3.7 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 8.5 kB

Release files / aftercopy-0.1.1.tar.gz

Download URL aftercopy-0.1.1.tar.gz
Size 3.7 kB
Tags Source
SHA-256 checksum
How to use checksums
74e6c723669d2afd9339f3f40682e58f53373c2b4c8aab049f58392d07f10b72
BLAKE2b-256 checksum
How to use checksums
9fcd2c2976b009e31037fc81f8225c112abaf53aca0df802703c9bf53e854de3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3

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

Download URL aftercopy-0.1.1-py3-none-any.whl
Size 4.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9dcfe1878c05270f4af680e9f2b0f9d4d3a3d4e059cd95689a8b4e89ec0a3805
BLAKE2b-256 checksum
How to use checksums
679a09badcbc4f30f5d4d7f6d0af4fa21f104b4df5f336a9dd221513003f364f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3

Security for aftercopy 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