Skip to content
tkdyun.xyz

Symptom Based Hospital Finder

Sentence embeddings + cosine retrieval for hospital recommendation

NLP

Year
2025
Role
Team · 5 Members
Stack
SBERT · Gemini · PyTorch · Pandas
View on GitHub

Overview

A team project focused on Natural Language Processing. I explored LLMs, sentence embedding models, and tokenization while implementing weighted embeddings for different data fields. I was responsible for crawling hospital and review data from the “Modoodoc” platform and developing the sentence embedding pipeline.

After benchmarking several Korean-specific models including SRoBERTa, SBERT, and SNUlp, I chose SBERT (jhgan/ko-sroberta-sts) for its superior performance on Korean STS tasks.

Preview

Pipeline — technical architecture

Phase A: Sentence Refinement

When a user enters symptoms, the system uses the Gemini API to bridge “everyday language” and “medical terminology.” Gemini is used to clean up typos and the sentence structures that vary from user to user, and the refined sentence then has the user's current location appended to it to construct the final input to use.

Phase B: Weighted Multi-Field Hospital Embeddings

Hospital data — department, address, hospital name, reviews, and more — is collected from Modoodoc and stored in the database. For every hospital in the database, a single representative vector is created by embedding four fields separately and combining them with specific weights:

FieldWeightDescription
medical_subject0.4Primary factor for matching symptoms
address0.4Ensures geographic relevance
hospital_name0.1Identity context
opening_hours0.1Temporal context

Embeddings are pre-computed and stored as .pt files for low-latency responses.

Phase C: Semantic Ranking & Retrieval

The input refined in Phase A is vectorized using the same model. Cosine similarity is computed against the hospital embedding matrix, and the top-k hospitals (default: 10) with the highest similarity scores are returned.

Key Specifications

ComponentSpecification
LLM Modelgemini
Embedding Modeljhgan/ko-sroberta-sts (HuggingFace)
Embedding Dimension768 dimensions
Similarity MetricCosine Similarity
Vector StoragePyTorch Serialization (.pt)

Pipeline Flow

User input symptom
  → Gemini (Input Refinement)
  → SBERT (Query Encoding)
  → Cosine Similarity vs. Weighted Hospital Matrix
  → Top-10 Ranking
  → UI Display

Search the site

Choose a destination, or type to search.