abdullahmubeen10 commited on
Commit
1f40f32
·
verified ·
1 Parent(s): 12d8e94

Update Demo.py

Browse files
Files changed (1) hide show
  1. Demo.py +5 -1
Demo.py CHANGED
@@ -143,10 +143,14 @@ output = fit_data(pipeline, text_to_analyze)
143
  # Display matched sentence
144
  st.subheader("Processed output:")
145
 
 
 
 
 
146
  results = {
147
  'Document': output[0]['document'][0].result,
148
  'NER Chunk': [n.result for n in output[0]['ner_chunk']],
149
- "NER Label": [n.metadata['entity'] for n in output[0]['ner_chunk']]
150
  }
151
 
152
  annotate(results)
 
143
  # Display matched sentence
144
  st.subheader("Processed output:")
145
 
146
+ # Define the abbreviation mapping
147
+ abbreviation_mapping = dict(zip('RGC', ['LOC', 'PER', 'MISC', 'ORG']))
148
+
149
+ # Extract the NER results
150
  results = {
151
  'Document': output[0]['document'][0].result,
152
  'NER Chunk': [n.result for n in output[0]['ner_chunk']],
153
+ 'NER Label': [abbreviation_mapping.get(n.metadata['entity'], 'UNKNOWN') for n in output[0]['ner_chunk']]
154
  }
155
 
156
  annotate(results)