Views
No views yet
1from transformers import AutoTokenizer, AutoModelForTokenClassification, pipeline
2
3model_name = "Venturus/mBERT-AnonyMED-BR-syn" # base architecture
4tokenizer = AutoTokenizer.from_pretrained(model_name)
5model = AutoModelForTokenClassification.from_pretrained(model_name) # load fine-tuned weights if available
6
7nlp = pipeline("ner", model=model, tokenizer=tokenizer)
8
9text = "O paciente João da Silva foi internado no Hospital das Clínicas em 12/05/2023."
10entities = nlp(text)
11
12print(entities)1[
2 {"word": "João", "entity": "PATIENT"},
3 {"word": "da Silva", "entity": "PATIENT"},
4 {"word": "Hospital das Clínicas", "entity": "HOSPITAL"},
5 {"word": "12/05/2023", "entity": "DATE"}
6]<PATIENT><DOCTOR><AGE><PROFESSION><IDNUM><MEDICAL_RECORD><HEALTH_PLAN><CITY><STATE><COUNTRY><STREET><HOSPITAL><LOCATION_OTHER><ZIP><DATE><EMAIL><PHONE><ORGANIZATION><OTHER>1@article{schiezzaro2025guardians,
2 title = {Guardians of the Data: NER and LLMs for Effective Medical Record Anonymization in Brazilian Portuguese},
3 author = {Schiezaro, Mauricio and Rosa, Guilherme and Pedrini, Helio and Campos, Bruno Augusto Goulart},
4 journal = {Frontiers in Public Health},
5 year = {2026},
6 doi = {10.3389/fpubh.2025.1717303},
7 url = {https://github.com/venturusbr/AnonyMED-BR},
8 publisher = {Frontiers Media SA}
9}
10