diff --git a/README.md b/README.md
index d622cdc3dff25001cfd7a98a7d02a8f1e06b1849..5fec5535f9702980dca173e7bbdaab99eb421cec 100644
--- a/README.md
+++ b/README.md
@@ -1,93 +1,140 @@
-# BERT-PPPL for OCR Eval
+# Pseudo-Perplexity with BERT to Estimate OCR Quality
 
+Measuring the quality of OCR-extracted text is a challenge. Well-established OCR evaluation metrics - like character error rate (CER) and word error rate (WER) - require a ground-truth against which the extracted text can be compared. However, when applying OCR in real-world scenarios, e.g. in retro-digitalisation projects in libraries, ground-truth texts are typically not available. At the same time, historical texts pose a particular challenge to OCR software often leading to low-quality results. 
 
+To alleviate this problem, [Störbel et al. (2022)](https://arxiv.org/pdf/2201.06170) have proposed several groud-truth-free metrics to estimate the quality of OCR texts. Among other metrics, they suggest using pseudo-perplexity scores from masked language models (MLM) to estimate the quality of OCR-extracted text. In their paper, they show that the prediction with pseudo-perplexity correlates well with the actual text quality. 
 
-## Getting started
+This repository provides different approaches to calculate the pseudo-perplexity of a text snippet with a model from the BERT family.
+On the one hand, the script `compute_pppl.py` calculates word-level pseudo-perplexities. On the other hand, `run_lmppl.py` can be used to execute the [lmppl repository](https://github.com/asahi417/lmppl/tree/main) to calculate the pseudo-perplexities on sentence-level.
 
-To make it easy for you to get started with GitLab, here's a list of recommended next steps.
 
-Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
 
-## Add your files
+## Word-Level Pseudo-Perplexity with BERT
 
-- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
-- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
+A problem with OCR-extracted text is that sentence boundaries are not known. Due to errors in the extracted text, common sentence splitters like NLTK might fail at identifying sentence boundaries correctly. 
 
-```
-cd existing_repo
-git remote add origin https://gitlab.uzh.ch/zentralbibliothek-zuerich/zb-lab/bert-pppl-for-ocr-eval.git
-git branch -M main
-git push -uf origin main
-```
-
-## Integrate with your tools
-
-- [ ] [Set up project integrations](https://gitlab.uzh.ch/zentralbibliothek-zuerich/zb-lab/bert-pppl-for-ocr-eval/-/settings/integrations)
-
-## Collaborate with your team
+To circumvent the challenge of splitting bad-qualtiy text into sentences, this repository uses a sliding window that slides over the entire text token by token. The extracted text windows are of a fixed size (11 by default). Then, the token in the middle of the window is masked. This sequence with the masked target token and the context tokens on both sides (e.g. 5 tokens on the left and 5 on the right) is passed to BERT to calculate the pseudo-perplexity for the masked target token.
 
-- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
-- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
-- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
-- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
-- [ ] [Set auto-merge](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
+To calculate the pseudo-perplexities, any huggingface model from the BERT family can be used. For our experiments, we used `bert-base-multilingual-uncased`.
 
-## Test and Deploy
 
-Use the built-in continuous integration in GitLab.
+### Getting Started
 
-- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html)
-- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing (SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
-- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
-- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
-- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
+To calcualte the pseudo-perplexity per word, run:
+```
+# Installing the dependencies
+>>> pip install transformers, tqdm
 
-***
+>>> python3 compute_pppl.py -m your-model-name -i path/to/your/data -o path/to/output/directory --window-size 11
 
-# Editing this README
 
-When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thanks to [makeareadme.com](https://www.makeareadme.com/) for this template.
+```
 
-## Suggestions for a good README
+As input, the script expects a json file with the following structure: 
 
-Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
+```
+[
+    {
+        "page_id": "ocr_27812752_p1.json",
+        "content": [
+            {
+                "word": "Liebe",
+                "index": "ocr_27812752_p1_w27",
+                "error": 0
+            },
+            {
+                "word": "die",
+                "index": "ocr_27812752_p1_w28",
+                "error": 0
+            }
+        ]
+    }
+]
+```
 
-## Name
-Choose a self-explaining name for your project.
+The output are json files containing the pseudo-perplexity scores:
 
-## Description
-Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
+```
+[
+    {
+        "page_id": "ocr_27812752_p1.json",
+        "content": [
+            {
+                "word": "Liebe",
+                "index": "ocr_27812752_p1_w27",
+                "error": 0,
+                "pppl": 4852.421617633325
+            },
+            {
+                "word": "die",
+                "index": "ocr_27812752_p1_w28",
+                "error": 0,
+                "pppl": 488.1390946218524
+            }
+        ]
+    }
+]
+```
 
-## Badges
-On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
 
-## Visuals
-Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
+## Sentence-Level Pseudo-Perplexity with BERT
 
-## Installation
-Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
+To calculate the pseudo-perplexity per sentence, we use the [Language Model Perplexity (LM-PPL)](https://github.com/asahi417/lmppl) repository by Ushio & Clarke. The repository expects a list of sentences as input. Hence, the OCR text must be split into sentences beforehand. The repository then masks each token in the sentence once and calculates the pseudo-perplexity score across the entire sentence.
 
-## Usage
-Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
+### Getting Started
 
-## Support
-Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
+Install the Language Model Perplexity (LM-PPL) repository:
 
-## Roadmap
-If you have ideas for releases in the future, it is a good idea to list them in the README.
+```
+>>> pip install lmppl 
+```
 
-## Contributing
-State if you are open to contributions and what your requirements are for accepting them.
+To use the repositroy, run: 
 
-For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
+```
+>>> python3 run_lmppl.py -m your-model-name -i path/to/your/data -o path/to/output/directory
+```
 
-You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
+As input, the script expects a json file with the following structure: 
+```
+[
+    {
+        "sent_id": "ocr_26843985_p4_6",
+        "ocr": "Sonder Zweifel niemand besser, als eben Er selber.",
+        "gt": "Sonder Zweifel niemand besser, als eben Er selber.",
+        "cer": 0.0,
+        "wer": 0.0
+    },
+    {
+        "sent_id": "ocr_26843985_p4_7",
+        "ocr": "Ihn will ich also fragen; Er soll mir antworten.",
+        "gt": "Ihn will ich also fragen; Er soll mir antworten.",
+        "cer": 0.0,
+        "wer": 0.0
+    }
+]
+```
 
-## Authors and acknowledgment
-Show your appreciation to those who have contributed to the project.
+The output are json files containing the pseudo-perplexity scores:
 
-## License
-For open source projects, say how it is licensed.
+```
+[
+    {
+        "sent_id": "ocr_26843985_p4_6",
+        "ocr": "Sonder Zweifel niemand besser, als eben Er selber.",
+        "gt": "Sonder Zweifel niemand besser, als eben Er selber.",
+        "cer": 0.0,
+        "wer": 0.0,
+        "pppl": 188.4483450695001
+    },
+    {
+        "sent_id": "ocr_26843985_p4_7",
+        "ocr": "Ihn will ich also fragen; Er soll mir antworten.",
+        "gt": "Ihn will ich also fragen; Er soll mir antworten.",
+        "cer": 0.0,
+        "wer": 0.0,
+        "pppl": 22.069765228493164
+    }
+]
+```
 
-## Project status
-If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
diff --git a/run_lmppl.py b/run_lmppl.py
index d1cf92972e810a95dbce34ea7629839ad8e53de3..aefc6e38c62cf66c5d07291b924bff95bded4e8d 100644
--- a/run_lmppl.py
+++ b/run_lmppl.py
@@ -13,7 +13,7 @@ logging.basicConfig(level=logging.INFO)
 
 def parse_args():
     parser = argparse.ArgumentParser(description="Run pseudo-perplexity calculation")
-    parser.add_argument("-m", "--model-name", type=str, default="bert-base-multilingual-uncased", help="Model name")
+    parser.add_argument("-m", "--model-name", type=str, default="bert-base-multilingual-uncased", help="Model name or path")
     parser.add_argument("-i", "--input-path", type=str, default="data/sentences", help="Path to the input directory")
     parser.add_argument("-o", "--output-path", type=str, default="data/pppl_per_sent", help="Path to the output directory")
     parser.add_argument("-b", "--batch-size", type=int, default=32, help="Batch size")