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
1 change: 1 addition & 0 deletions llm_web_kit/input/pre_data_json.py
Comment thread
yogacc33 marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class PreDataJsonKey:

TYPICAL_RAW_HTML = 'typical_raw_html'
TYPICAL_RAW_TAG_HTML = 'typical_raw_tag_html'
IS_XPATH = 'is_xpath'
XPATH_MAPPING = 'xpath_mapping'
TYPICAL_SIMPLIFIED_HTML = 'typical_simplified_html'
# 模型打标字典
Expand Down
3 changes: 2 additions & 1 deletion llm_web_kit/main_html_parser/parser/tag_simplifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ def parse(self, pre_data: PreDataJson) -> PreDataJson:
"""
# 获取输入数据
typical_raw_html = pre_data.get(PreDataJsonKey.TYPICAL_RAW_HTML, '')
is_xpath = pre_data.get(PreDataJsonKey.IS_XPATH, True)
# layout_file_list = pre_data.get(PreDataJsonKey.LAYOUT_FILE_LIST, [])

# 执行HTML标签简化逻辑
try:
simplified_html, original_html, _ = simplify_html(typical_raw_html)
simplified_html, original_html, _ = simplify_html(typical_raw_html, is_xpath=is_xpath)
except TagSimplifiedParserException as e1:
raise e1
except Exception as e2:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def test_tag_simplifier4(self):
file_path = base_dir / 'assets/test_html_data/1.html'
with open(file_path, 'r', encoding='utf-8') as file:
raw_html = file.read()
data_dict = {PreDataJsonKey.TYPICAL_RAW_HTML: raw_html}
data_dict = {PreDataJsonKey.TYPICAL_RAW_HTML: raw_html, PreDataJsonKey.IS_XPATH: False}
pre_data = PreDataJson(data_dict)
pre_data_result = HtmlTagSimplifierParser({}).parse(pre_data)
simplifier_raw_html = pre_data_result.get(PreDataJsonKey.TYPICAL_SIMPLIFIED_HTML, '')
Expand Down