(line: str)
| 1058 | filtered = _filter_parsed_profile_fragment( |
| 1059 | parsed, |
| 1060 | max_core_directions=2, |
| 1061 | core_cap=0.78, |
| 1062 | ) |
| 1063 | if not filtered["core_directions"]: |
| 1064 | continue |
| 1065 | merge_parsed_profile_into_profile( |
| 1066 | fragment, |
| 1067 | filtered, |
| 1068 | blend=0.35, |
| 1069 | new_direction_cap=0.75, |
| 1070 | ) |
| 1071 | |
| 1072 | publication_blocklist = set(GENERIC_PUBLICATION_DIRECTIONS) - explicit_direction_keys |
| 1073 | for raw_title in _dedupe_preserve_order(list(publication_titles or [])): |
| 1074 | parsed = parse_natural_language(raw_title, use_llm=False) |
| 1075 | filtered = _filter_parsed_profile_fragment( |
| 1076 | parsed, |
| 1077 | max_core_directions=2, |
| 1078 | core_cap=BOOTSTRAP_PUBLICATION_CAP, |
| 1079 | blocked_directions=publication_blocklist, |
| 1080 | preferred_directions=explicit_direction_keys, |
| 1081 | ) |
| 1082 | if not filtered["core_directions"]: |
| 1083 | continue |
| 1084 | merge_parsed_profile_into_profile( |
| 1085 | fragment, |
| 1086 | filtered, |
| 1087 | blend=0.18, |
| 1088 | new_direction_cap=BOOTSTRAP_PUBLICATION_CAP, |
| 1089 | ) |
| 1090 | |
| 1091 | _trim_bootstrap_profile(fragment) |
| 1092 | return fragment |
| 1093 | |
| 1094 | |
| 1095 | def _html_to_text_lines(html_text: str) -> List[str]: |
| 1096 | """Convert a webpage into clean one-line text blocks.""" |
| 1097 | without_scripts = re.sub(r"(?is)<(script|style|noscript)[^>]*>.*?</\1>", " ", html_text or "") |
| 1098 | block_marked = re.sub( |
| 1099 | r"(?i)</?(?:br|p|div|li|ul|ol|h[1-6]|section|article|header|footer|tr|td|th|table)>", |
| 1100 | "\n", |
no outgoing calls
no test coverage detected