Background
I am using NeuroNER http://neuroner.com/ to label text data sample_string
as seen below.
sample_string = 'Patient Jane Candy was seen by Dr. Smith on 12/1/2000 and her number is 1111112222'
Output (using NeuroNER)
My output is a list of dictionary dic_list
dic_list = [
{'id': 'T1', 'type': 'PATIENT', 'start': 8, 'end': 11, 'text': 'Jane'},
{'id': 'T2', 'type': 'PATIENT', 'start': 13, 'end': 17, 'text': 'Candy'},
{'id': 'T3', 'type': 'DOCTOR', 'start': 35, 'end': 39, 'text': 'Smith'},
{'id': 'T4', 'type': 'DATE', 'start': 44, 'end': 52, 'text': '12/1/2000'},
{'id': 'T5', 'type': 'PHONE', 'start': 72, 'end': 81, 'text': '1111112222'}]
Legend
id
= text ID
type
= type of text being identified
start
= starting position of identified text
end
= ending position of identified text
text
= text that is identified
Goal
Since the location of the text
(e.g. Jane
) is given by start
and end
, I would like to change each text
from dic_list
to **BLOCK**
in my list sample_string
Desired Output
sample_string = 'Patient **BLOCK** **BLOCK** was seen by Dr. **BLOCK** on **BLOCK** and her number is **BLOCK**
Question
I have tried Replacing a character from a certain index and Edit the values in a list of dictionaries? but they are not quite what I am looking for
How do I achieve my desired output?