<?xml version="1.0" encoding="UTF-8"?>
<patterns type="Common Error">
  <pattern classes="OCR;" name="Letter &quot;O&quot; in a number" description="Replace letter &quot;O&quot; with a zero in a number">
    <rule replacement="\1\060" repeat="True" regex="((?&lt;![^\W\d])(\d|\d[,.]))[oO]" flags="DOTALL;MULTILINE;UNICODE;"/>
    <rule replacement="\060\1" repeat="True" regex="[oO]((?!2\W)(\d|[,.]\d)(?![^\W\d]))" flags="DOTALL;MULTILINE;UNICODE;"/>
  </pattern>
  <pattern classes="OCR;" name="Double apostrophe" description="Replace a double apostrophe with a quotation mark">
    <rule replacement="&quot;" repeat="False" regex="''" flags="DOTALL;MULTILINE;UNICODE;"/>
  </pattern>
  <pattern classes="Human;OCR;" name="Spaces around brackets" description="Add or remove spaces around parentheses and square brackets">
    <rule replacement="\1 \2" repeat="False" regex="(\S)(\(|\[)" flags="DOTALL;MULTILINE;UNICODE;"/>
    <rule replacement="\1 \2" repeat="False" regex="(\)|\])(\w)" flags="DOTALL;MULTILINE;UNICODE;"/>
    <rule replacement="\1" repeat="False" regex="(\(|\[)( )" flags="DOTALL;MULTILINE;UNICODE;"/>
    <rule replacement="\2" repeat="False" regex="( )(\)|\])" flags="DOTALL;MULTILINE;UNICODE;"/>
  </pattern>
  <pattern classes="Human;OCR;" name="Space after a dialogue dash" description="Add space after a dialogue dash">
    <rule replacement="- \1" repeat="False" regex="^-([^-\s])" flags="DOTALL;MULTILINE;UNICODE;"/>
  </pattern>
  <pattern classes="Human;OCR;" name="Space before punctuation marks" description="Remove space before various punctuation marks">
    <rule replacement="\1" repeat="False" regex=" +([&quot;'«»]?(?!\.\.)([,;:.?!])(?!\d))" flags="DOTALL;MULTILINE;UNICODE;"/>
  </pattern>
  <pattern classes="Human;OCR;" name="Space after punctuation marks" description="Add space after various punctuation marks">
    <rule replacement="\1 \3" repeat="False" regex="((\w|^|[&quot;'«»]) ?[,;:?!])(?![&quot;'«»])([^\W\d][\w\s])" flags="DOTALL;MULTILINE;UNICODE;"/>
  </pattern>
  <pattern classes="Human;OCR;" name="Space after an ellipsis" description="Add space after an ellipsis">
    <rule replacement="\1 \2" repeat="False" regex="(\w[^\w\s]*?\.\.\.)([&quot;'«»]?\w)" flags="DOTALL;MULTILINE;UNICODE;"/>
  </pattern>
  <pattern classes="Human;OCR;" name="Space after a starting ellipsis" description="Remove space after an ellipsis that starts a line">
    <rule replacement="\1" repeat="False" regex="(^\W*?\.\.\.)( +)" flags="DOTALL;MULTILINE;UNICODE;"/>
  </pattern>
  <pattern classes="OCR;" name="Spaces around a quotation mark" description="Remove space after a starting- and before an ending quotation mark">
    <rule replacement="\1&quot;\3" repeat="False" regex="(\A[^&quot;]*)(&quot; +)([^&quot;]*&quot;[^&quot;]*\Z)" flags="DOTALL;MULTILINE;UNICODE;"/>
    <rule replacement="\1&quot;\3" repeat="False" regex="(\A[^&quot;]*&quot;[^&quot;]*)( +&quot;)([^&quot;]*\Z)" flags="DOTALL;MULTILINE;UNICODE;"/>
    <rule replacement="\1" repeat="False" regex="^(\W*?[&quot;'])( +)" flags="DOTALL;MULTILINE;UNICODE;"/>
    <rule replacement="\2" repeat="False" regex="( +)([&quot;']\W*?)$" flags="DOTALL;MULTILINE;UNICODE;"/>
  </pattern>
  <pattern classes="Human;" name="Multiple question- and exclamation marks" description="Replace multiple consecutive question- and exclamation marks with only one">
    <rule replacement="\1?" repeat="False" regex="(\w\W*)(?&lt;!^)(?&lt;!\?)\?{2,}" flags="DOTALL;MULTILINE;UNICODE;"/>
    <rule replacement="\1!" repeat="False" regex="(\w\W*)(?&lt;!^)(?&lt;!\!)\!{2,}" flags="DOTALL;MULTILINE;UNICODE;"/>
  </pattern>
  <pattern classes="OCR;" name="Periods around a punctuation mark" description="Remove period before or after various punctuation marks">
    <rule replacement="" repeat="False" regex="(?&lt;=[:?!])\.(?!\.)" flags="DOTALL;MULTILINE;UNICODE;"/>
    <rule replacement="" repeat="False" regex="(?&lt;!\.\w)(?&lt;!\.)\.(?=[:?!])" flags="DOTALL;MULTILINE;UNICODE;"/>
  </pattern>
</patterns>