Replymessage unavailable
Ссылка
click to show
click to show
Coba seputar Named Entity Recognition (NER), Gazetteer/Dictionary-based Matching.
import spacy
import re
from fuzzywuzzy import fuzz
# Load model NER
nlp = spacy.load("en_core_web_sm")
def extract_locations(text):
doc = nlp(text)
locations = []
# Extract menggunakan spaCy NER
for ent in doc.ents:
if ent.label_ in ["GPE", "LOC", "ORG"]:
locations.append(ent.text)
return locations
# Contoh penggunaan
user_prompt = "Saya mau cari restoran enak di Jakarta atau hotel bagus di Bali"
locations = extract_locations(user_prompt)
https://spacy.io/usage/linguistic-features#named-entities
https://nlp.stanford.edu/software/CRF-NER.html