Files
jsahn 4e943700fc feat: add common utilities and feedback handling scripts
- Introduced common.js for shared functions including API calls, error reporting, and UI helpers.
- Implemented feedback.js for the feedback reporting page, including form handling and displaying feedback status.
- Added layout.js for managing galaxy and section layouts in the visualization.
- Created login.js for user authentication with session management.
- Developed search.js for term searching based on user input and synonyms.
- Implemented signup.js for user registration with validation and immediate login.
2026-10-06 23:14:45 +09:00

35 lines
1.9 KiB
Python

"""PDF 파싱 도우미 단위 테스트 (PDF 없이 실행)."""
from pipeline.build import norm_key, rejoin_lines, score_sentence, split_name
from pipeline.toc import _split_page
def test_norm_key_merges_spacing_variants():
assert norm_key("지역사회 간호과정") == norm_key("지역사회간호과정")
assert norm_key("Health-Belief Model") == "healthbeliefmodel"
def test_split_name_parentheses():
assert split_name("건강 신념 모형(Health Belief Model; HBM)") == ("건강 신념 모형", ["Health Belief Model", "HBM"])
assert split_name("발생률") == ("발생률", [])
def test_toc_leaders_and_page():
assert _split_page("1. 지역사회의 정의jjjjjjjjjjjj3") == ("1. 지역사회의 정의", 3)
assert _split_page("제1절 지역사회의 이해······ 19") == ("제1절 지역사회의 이해", 19)
assert _split_page("1) 서양 근대 공중보건의 확립_62") == ("1) 서양 근대 공중보건의 확립", 62)
def test_rejoin_lines():
text = "유병률은 특정 시점의 비율을 나타내는 역학적\n지표로, 질병의 부담을 평가하는 데 사용된다.\n2) 발병률\n성과관리는 사업 목표의 달성 정도를 확인하며 지역사회 보건사업에서는 프\n로그램 평가를 한다."
out = rejoin_lines(text).split("\n")
assert out[0] == "유병률은 특정 시점의 비율을 나타내는 역학적 지표로, 질병의 부담을 평가하는 데 사용된다."
assert out[1] == "2) 발병률"
assert "프로그램" in out[2]
def test_definition_scoring():
good = "유병률은 특정 시점에 질병을 가진 사람의 비율을 말한다."
weak = "이 장에서는 유병률과 여러 지표를 함께 다룬다."
assert score_sentence(good, "유병률", norm_key("유병률")) >= 7
assert score_sentence(weak, "유병률", norm_key("유병률")) < 7