Downloads · 30 days
0
deathlegionteam/sri-lanka-location-intelligence
sri-lanka-location-intelligence is a sentence similarity model from deathlegionteam. Use it when you need a score for how close two texts are. It is set up for sentence-transformers. The card lists the license as odbl.
Find every location, business, and place in Sri Lanka using AI-powered semantic search.
Downloads · 30 days
0
Access
Public
Updated Jun 5, 2026
Parameters
560M
3.3 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors2.2 GB · 69%
From the Hugging Face model README
Find every location, business, and place in Sri Lanka using AI-powered semantic search.
A comprehensive geospatial intelligence system covering 117,446 locations across Sri Lanka — including police stations, hospitals, schools, places of worship, businesses, roads, buildings, natural features, and more. Powered by multilingual-e5-large (1024-dim embeddings, 100 languages) with FAISS IVFFlat vector search for instant semantic lookup.
| Property | Value |
|---|---|
| Base Model | intfloat/multilingual-e5-large |
| Architecture | XLMRobertaModel (24 layers, 16 heads) |
| Embedding Dimension | 1024 |
| Model Size | 2.2 GB (SafeTensors) |
| Max Sequence Length | 512 tokens |
| Languages | 100 languages (English, Sinhala, Tamil, Hindi, Arabic, Chinese, Japanese, Korean, French, German, Spanish, and 90+ more) |
| License | MIT (model) + ODbL (location data) |
| File | Size | Description |
|---|---|---|
model.safetensors | 2.2 GB | multilingual-e5-large model weights |
models/ | — | Tokenizer, config, and sentence-transformers config |
srilanka_places.db | 38 MB | SQLite database of 117,446 Sri Lanka locations |
srilanka_embeddings_large.npy | ~480 MB | Pre-computed 1024-dim embeddings (117,446 x 1024) |
faiss_index_large.bin | ~480 MB | FAISS IVFFlat index (nlist=200) for instant semantic search |
id_mapping_large.npy | ~2 MB | ID-to-index mapping for result retrieval |
metadata.json | 1 KB | Model metadata and usage information |
Every named road in Sri Lanka is indexed — from major highways (A1 Colombo-Kandy, E01 Southern Expressway) down to local streets (Galle Road, Marine Drive, Ward Place, Kollupitiya Road, etc.). Search by road name, find locations along roads, or discover nearby amenities.
| Category | Count | Examples |
|---|---|---|
| 🛣️ Named Roads | 38,874 | A1, E01, Galle Road, Marine Drive |
| 🏠 Buildings | 11,751 | Commercial, residential, government |
| 🏘️ Populated Places | 4,482 | Cities, towns, villages (Colombo, Kandy, Galle, Jaffna, etc.) |
| 🏪 Shops | 4,463 | Retail stores, supermarkets, pharmacies |
| ⛪ Places of Worship | 4,401 | Buddhist temples, churches, mosques, kovils |
| 🏫 Schools | 4,401 | Government schools, international schools, universities |
| 🏥 Hospitals | 902 | Government hospitals, private clinics, Ayurvedic |
| 🚔 Police Stations | 420 | Police stations and posts |
| 🏦 Banks & ATMs | 1,200+ | Commercial banks (BOC, People's Bank, HNB, Commercial Bank, etc.) |
| 🏨 Hotels | 850+ | Hotels, guesthouses, resorts |
| 🍽️ Restaurants | 2,000+ | Restaurants, cafes, food outlets |
| 🏛️ Government Offices | 1,500+ | Divisional secretariats, municipal councils, government departments |
| ⛽ Fuel Stations | 600+ | Petrol stations (Ceypetco, Lanka IOC, etc.) |
| 🌿 Natural Features | 2,500+ | Rivers, mountains, forests, beaches |
| 🚉 Transport Hubs | 350+ | Railway stations, bus stands, airports |
| 🏟️ Landmarks | 1,200+ | Monuments, parks, stadiums, museums |
| 📦 And 10+ more categories | — | Industrial, agricultural, utilities, etc. |
from sentence_transformers import SentenceTransformer
import faiss
import numpy as np
import sqlite3
import json
# Load the model
model = SentenceTransformer('deathlegionteam/sri-lanka-location-intelligence')
# Load FAISS index and ID mapping
index = faiss.read_index('faiss_index_large.bin')
id_mapping = np.load('id_mapping_large.npy', allow_pickle=True)
# Connect to database
conn = sqlite3.connect('srilanka_places.db')
cursor = conn.cursor()
def search_locations(query, top_k=10):
"""Search any location in Sri Lanka by semantic query."""
# Encode query
query_vec = model.encode(['query: ' + query], normalize_embeddings=True)
# Search FAISS index
distances, indices = index.search(query_vec.astype(np.float32), top_k)
# Fetch results from database
results = []
for i, idx in enumerate(indices[0]):
location_id = id_mapping[idx]
cursor.execute("SELECT * FROM locations WHERE id=?", (int(location_id),))
row = cursor.fetchone()
if row:
# Convert sqlite3.Row to dict
cols = [d[0] for d in cursor.description]
location = dict(zip(cols, row))
location['similarity'] = float(distances[0][i])
results.append(location)
return results
# Examples
results = search_locations("police station in Colombo")
for r in results[:5]:
print(f"{r['name']} — {r['category']} ({r['latitude']}, {r['longitude']})")
results = search_locations("Buddhist temple near Kandy")
results = search_locations("hospital with emergency services")
results = search_locations("Colombo 7 restaurant")
def search_by_category(query, category, top_k=10):
"""Search within a specific category."""
query_vec = model.encode(['query: ' + query], normalize_embeddings=True)
distances, indices = index.search(query_vec.astype(np.float32), top_k * 3)
results = []
for idx in indices[0]:
location_id = id_mapping[idx]
cursor.execute("SELECT * FROM locations WHERE id=? AND category=?",
(int(location_id), category))
row = cursor.fetchone()
if row:
cols = [d[0] for d in cursor.description]
location = dict(zip(cols, row))
location['similarity'] = float(distances[0][list(indices[0]).index(idx)])
results.append(location)
if len(results) >= top_k:
break
return results
# Find hospitals in the Western Province
results = search_by_category("government hospital", "hospital", 5)
import math
def haversine(lat1, lon1, lat2, lon2):
"""Calculate distance in km between two coordinates."""
R = 6371
dlat = math.radians(lat2 - lat1)
dlon = math.radians(lon2 - lon1)
a = math.sin(dlat/2)**2 + math.cos(math.radians(lat1)) * \
math.cos(math.radians(lat2)) * math.sin(dlon/2)**2
return R * 2 * math.atan2(math.sqrt(a), math.sqrt(1-a))
def find_nearby(lat, lon, radius_km=5, limit=50):
"""Find locations near a point."""
# Bounding box pre-filter
lat_delta = radius_km / 111.0
lon_delta = radius_km / (111.0 * abs(math.cos(math.radians(lat))) + 0.001)
cursor.execute("""
SELECT * FROM locations
WHERE latitude BETWEEN ? AND ?
AND longitude BETWEEN ? AND ?
ORDER BY ABS(latitude - ?) + ABS(longitude - ?)
LIMIT ?
""", (lat - lat_delta, lat + lat_delta,
lon - lon_delta, lon + lon_delta,
lat, lon, limit * 2))
rows = cursor.fetchall()
cols = [d[0] for d in cursor.description]
results = []
for row in rows:
loc = dict(zip(cols, row))
dist = haversine(lat, lon, loc['latitude'], loc['longitude'])
if dist <= radius_km:
loc['distance_km'] = round(dist, 2)
results.append(loc)
if len(results) >= limit:
break
return results
# Find everything near Colombo Fort
nearby = find_nearby(6.9344, 79.8428, radius_km=2)
| Query | Finds |
|---|---|
"police emergency" | Police stations near you |
"Colombo hospital" | National Hospital of Sri Lanka, private hospitals in Colombo |
"temple tooth relic" | Temple of the Tooth, Kandy |
"galle road restaurant" | Restaurants along Galle Road, Colombo |
"Kandy school" | Schools in Kandy district |
"fuel station A1" | Petrol stations along the A1 highway |
"beach hotel" | Beach resorts and hotels |
"central bank" | Central Bank of Sri Lanka, Colombo |
"විහාරය" (Sinhala) | Buddhist temples |
"கோவில்" (Tamil) | Hindu temples/kovils |
sri-lanka-latest.osm.pbf, 136 MB)User Query (in any language)
↓
multilingual-e5-large (1024-dim embedding)
↓
FAISS IVFFlat Index (nlist=200, cosine similarity)
↓
SQLite Database → Location Name + Coordinates + Category + Tags
↓
Structured Results with similarity scores