mirror of
https://github.com/qurator-spk/dinglehopper.git
synced 2025-07-01 14:40:00 +02:00
Merge pull request #139 from bertsky/allow-uniseg-py38
re-allow uniseg 0.8 and py38
This commit is contained in:
commit
3d7c7ee1e3
4 changed files with 9 additions and 4 deletions
2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
|
@ -25,7 +25,7 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13" ]
|
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12", "3.13" ]
|
||||||
|
|
||||||
runs-on: "ubuntu-latest"
|
runs-on: "ubuntu-latest"
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ authors = [
|
||||||
description = "An OCR evaluation tool"
|
description = "An OCR evaluation tool"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
license.file = "LICENSE"
|
license.file = "LICENSE"
|
||||||
requires-python = ">=3.9"
|
requires-python = ">=3.8"
|
||||||
keywords = ["qurator", "ocr", "evaluation", "ocr-d"]
|
keywords = ["qurator", "ocr", "evaluation", "ocr-d"]
|
||||||
|
|
||||||
dynamic = ["version", "dependencies", "optional-dependencies"]
|
dynamic = ["version", "dependencies", "optional-dependencies"]
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
click
|
click
|
||||||
jinja2
|
jinja2
|
||||||
lxml
|
lxml
|
||||||
uniseg >= 0.9.1
|
uniseg >= 0.8.0
|
||||||
numpy
|
numpy
|
||||||
colorama
|
colorama
|
||||||
MarkupSafe
|
MarkupSafe
|
||||||
|
|
|
@ -21,10 +21,15 @@ def patch_word_break():
|
||||||
https://www.unicode.org/Public/UCD/latest/ucd/auxiliary/WordBreakProperty.txt
|
https://www.unicode.org/Public/UCD/latest/ucd/auxiliary/WordBreakProperty.txt
|
||||||
"""
|
"""
|
||||||
old_word_break = uniseg.wordbreak.word_break
|
old_word_break = uniseg.wordbreak.word_break
|
||||||
|
if hasattr(uniseg.wordbreak, 'Word_Break'):
|
||||||
|
aletter = uniseg.wordbreak.Word_Break.ALetter
|
||||||
|
else:
|
||||||
|
# uniseg<0.9
|
||||||
|
aletter = uniseg.wordbreak.WordBreak.ALETTER
|
||||||
|
|
||||||
def new_word_break(c):
|
def new_word_break(c):
|
||||||
if 0xE000 <= ord(c) <= 0xF8FF: # Private Use Area
|
if 0xE000 <= ord(c) <= 0xF8FF: # Private Use Area
|
||||||
return uniseg.wordbreak.Word_Break.ALetter
|
return aletter
|
||||||
else:
|
else:
|
||||||
return old_word_break(c)
|
return old_word_break(c)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue