Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ repos:
rev: 5.0.4
hooks:
- id: flake8
args: [ "--max-line-length=2200", "--ignore=E131,E125,W503,W504,E203,E231,E702,E128" ]
args: [ "--max-line-length=2200", "--ignore=E131,E125,W503,W504,E203,E231,E702,E128,E402" ]
exclude: '^tests/.*/assets/'
- repo: https://github.com/PyCQA/isort
rev: 5.11.5
hooks:
- id: isort
exclude: '^tests/.*/assets/'
- repo: https://github.com/pre-commit/mirrors-yapf
rev: v0.32.0
hooks:
- id: yapf
args: ["--style={based_on_style: google, column_limit: 200, indent_width: 4}"]
exclude: '^tests/.*/assets/'
# - repo: https://github.com/pre-commit/mirrors-yapf
# rev: v0.32.0
# hooks:
# - id: yapf
# args: ["--style={based_on_style: google, column_limit: 200, indent_width: 4}"]
# exclude: '^tests/.*/assets/'
# - repo: https://github.com/codespell-project/codespell
# rev: v2.2.1
# hooks:
Expand Down
14 changes: 11 additions & 3 deletions llm_web_kit/extractor/html/recognizer/cc_math/common.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
import logging
import os
import re
from pathlib import Path
from typing import List, Tuple

from lxml import etree
from lxml.html import HtmlElement

# 在导入前就设置严格的日志控制
logging.basicConfig(level=logging.WARNING, force=True)

# 设置py_asciimath的日志级别,完全禁用其日志输出
py_asciimath_logger = logging.getLogger('py_asciimath')
py_asciimath_logger.setLevel(logging.ERROR)
py_asciimath_logger.disabled = True

from py_asciimath.translator.translator import ASCIIMath2Tex

from llm_web_kit.extractor.html.recognizer.recognizer import CCTag
Expand All @@ -15,6 +25,7 @@
from llm_web_kit.libs.text_utils import normalize_ctl_text

asciimath2tex = ASCIIMath2Tex(log=False)

color_regex = re.compile(r'\\textcolor\[.*?\]\{.*?\}')


Expand Down Expand Up @@ -137,9 +148,6 @@ class MATHINSIGHT:
}


asciimath2tex = ASCIIMath2Tex(log=False)


def text_strip(text):
return text.strip() if text else text

Expand Down