Skip to main content

Keystroke Revision Extraction and Visualisation library

Project description

K-REV

Keystroke Revision Tracking and Extraction

PyPI version [License: Academic Software License (ASL)] Python Versions


Overview

K-Rev is a Python library for detecting and analyzing revision episodes in streams of keystroke data.
It helps researchers and developers understand how writers revise their text — identifying bursts of deletion, retyping, or restructuring that reveal cognitive and editing processes during writing.

Whether you are studying writing behavior, building educational tools, or visualizing editing timelines, K-Rev makes keystroke-based revision analysis simple, reproducible, and extensible.


Features

  • Automatic detection of revision episodes from raw keystroke logs
  • Flexible data model for representing typing, pauses, and edits
  • Analytics and visualization utilities (coming soon)
  • Extensible architecture — plug in your own revision classifiers
  • Compatible with common keystroke formats (e.g., InputLog, ScriptLog, or custom JSON)

Installation

pip install krev

Quickstart

Once you extracted you keystroke data, create a list that represents the text after each keystroke and a list that keeps the cursor position after each keystroke. Example:

    text_list = [
        "The quick brown fox",
        "The quick brown fox ",
        "The quick brown fox j",
        "The quick brown fox ju",
        "The quick brown fox jum",
        "The quick brown fox jumps",
        "The quick brown fox jumps ",
        "The quick brown fox jumps o",
        "The quick brown fox jumps ov",
        "The quick brown fox jumps ove",
        "The quick brown fox jumps over",
        "The quick brown fo jumps over",
        "The quick brown f jumps over",
        "The quick brown  jumps over",
        "The quick brown c jumps over",
        "The quick brown ca jumps over",
        "The quick brown cat jumps over",
        "The quick brown cat jumps over ",
        "The quick brown cat jumps over t",
        "The quick brown cat jumps over th",
        "The quick brown cat jumps over the",
        "The quick brown cat jumps over the ",
        "The quick brown cat jumps over the d",
        "The quick brown cat jumps over the do",
        "The quick brown cat jumps over the dog",
    ]
    cursor_list = [19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 18, 17, 16, 17, 18, 19, 31, 32, 33, 34, 35, 36, 37, 38]

Then we can extract the revision events from the keystroke data.

>>> from krev.main import characterize_revisions
>>> revisions = characterize_revisions(text_list, cursor_list)

If you are working with french text, you can also already use our pipeline to classify the revision event through requesting an LLM. In order to do so, you must precise the model you want to use and an API key. You should be aware of the tokens that might be used by doing such a request. Prompts are available in the open-source code of the library.

>>> from krev.main import characterize_revisions
>>> revisions = characterize_revisions(text_list, cursor_list, "gpt-5", api_key=API-KEY)

Finally you can go through the list of revisions to observe the text before/after the revision, the revision type, where it appends in the text...

>>> for revision in revisions:
... print(revision.text_before, revision.text_end, revision.reason_start, revision.start_point, revision.type)

How it works


Next steps

Taking into account trailing text. For now, the presence of trailing text might cause problems to the revision extraction procedure. Multi-lingual pipeline for revision classification (only in French for now, but revision extraction works for any Indo-European language). Replace the API use of LLMs to classify the revision by smaller models.


License

K-Rev operates under an ASL License, and is a property of EvidenceB. It is open source for research purpose, but not open for commercial use. If you would like to use this library for a commercial purpose, please contact the owners of this repository. See the License file for further details.


Citation


Acknowledgements

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

krev-0.1.1.tar.gz (18.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

krev-0.1.1-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

Details for the file krev-0.1.1.tar.gz.

File metadata

  • Download URL: krev-0.1.1.tar.gz
  • Upload date:
  • Size: 18.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.9

File hashes

Hashes for krev-0.1.1.tar.gz
Algorithm Hash digest
SHA256 fe6921ec1451a2088b0845c2bb1d25134e4da251303740d19ba3ab439cfa6598
MD5 d0a0845558d0d157a9e87f82812a1553
BLAKE2b-256 6993e1fe77e8d49650345d1b9d2590ba594f37d37028a80e60167f24bc253d22

See more details on using hashes here.

File details

Details for the file krev-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: krev-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 16.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.9

File hashes

Hashes for krev-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 899b70d1d8f67a8c7a8f292395a46bcb28cb33d02340194bf97e639ac155f8f8
MD5 7b6f347691b2cda03b189723bbb99556
BLAKE2b-256 322294f27839f5c73ef700b17110bb04e0d1155cbd031af8b9b4232969638bcd

See more details on using hashes here.

Supported by

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