Skip to content

Commit

Permalink
text integrity in ner and assertion display
Browse files Browse the repository at this point in the history
  • Loading branch information
HashamUlHaq committed Aug 11, 2022
1 parent 9bf94c2 commit 47b6d36
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion build/lib/sparknlp_display/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.0
4.1
6 changes: 3 additions & 3 deletions build/lib/sparknlp_display/assertion.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,20 +134,20 @@ def __display_ner(self, result, label_col, resolution_col, document_col, origina

html_output += '<span class="spark-nlp-display-entity-wrapper" style="background-color: {}"><span class="spark-nlp-display-entity-name">{} </span><span class="spark-nlp-display-entity-type">{}</span><span class="spark-nlp-display-entity-resolution" style="background-color: {}">{} </span></span>'.format(
label_color[entity_type] + 'B3', #color
entity.result, #entity - chunk
original_text[begin:end+1],#entity.result,
entity.metadata['entity'], #entity - label
label_color[entity_type] + 'FF', #color '#D2C8C6'
assertion_temp_dict[begin] # res_assertion
)
else:
html_output += '<span class="spark-nlp-display-entity-wrapper" style="background-color: {}"><span class="spark-nlp-display-entity-name">{} </span><span class="spark-nlp-display-entity-type">{}</span></span>'.format(
label_color[entity_type] + 'B3', #color
entity.result, #entity - chunk
original_text[begin:end+1],#entity.result,
entity.metadata['entity'] #entity - label
)

else:
html_output += '<span class="spark-nlp-display-others" style="background-color: white">{}</span>'.format(entity.result)
html_output += '<span class="spark-nlp-display-others" style="background-color: white">{}</span>'.format(original_text[begin:end+1])

if pos < len(original_text):
html_output += '<span class="spark-nlp-display-others" style="background-color: white">{}</span>'.format(original_text[pos:])
Expand Down
4 changes: 2 additions & 2 deletions build/lib/sparknlp_display/ner.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,10 @@ def __display_ner(self, result, label_col, document_col, original_text, labels_l
if entity_type in label_color:
html_output += '<span class="spark-nlp-display-entity-wrapper" style="background-color: {}"><span class="spark-nlp-display-entity-name">{} </span><span class="spark-nlp-display-entity-type">{}</span></span>'.format(
label_color[entity_type],
entity.result,
original_text[begin:end+1],#entity.result,
entity.metadata['entity'])
else:
html_output += '<span class="spark-nlp-display-others" style="background-color: white">{}</span>'.format(entity.result)
html_output += '<span class="spark-nlp-display-others" style="background-color: white">{}</span>'.format(original_text[begin:end+1])

if pos < len(original_text):
html_output += '<span class="spark-nlp-display-others" style="background-color: white">{}</span>'.format(original_text[pos:])
Expand Down
Binary file removed dist/spark-nlp-display-4.0.tar.gz
Binary file not shown.
Binary file added dist/spark-nlp-display-4.1.tar.gz
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion spark_nlp_display.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: spark-nlp-display
Version: 4.0
Version: 4.1
Summary: Visualization package for Spark NLP
Home-page: http://nlp.johnsnowlabs.com
Author: John Snow Labs
Expand Down
2 changes: 1 addition & 1 deletion sparknlp_display/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.0
4.1
6 changes: 3 additions & 3 deletions sparknlp_display/assertion.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,20 +134,20 @@ def __display_ner(self, result, label_col, resolution_col, document_col, origina

html_output += '<span class="spark-nlp-display-entity-wrapper" style="background-color: {}"><span class="spark-nlp-display-entity-name">{} </span><span class="spark-nlp-display-entity-type">{}</span><span class="spark-nlp-display-entity-resolution" style="background-color: {}">{} </span></span>'.format(
label_color[entity_type] + 'B3', #color
entity.result, #entity - chunk
original_text[begin:end+1],#entity.result,
entity.metadata['entity'], #entity - label
label_color[entity_type] + 'FF', #color '#D2C8C6'
assertion_temp_dict[begin] # res_assertion
)
else:
html_output += '<span class="spark-nlp-display-entity-wrapper" style="background-color: {}"><span class="spark-nlp-display-entity-name">{} </span><span class="spark-nlp-display-entity-type">{}</span></span>'.format(
label_color[entity_type] + 'B3', #color
entity.result, #entity - chunk
original_text[begin:end+1],#entity.result,
entity.metadata['entity'] #entity - label
)

else:
html_output += '<span class="spark-nlp-display-others" style="background-color: white">{}</span>'.format(entity.result)
html_output += '<span class="spark-nlp-display-others" style="background-color: white">{}</span>'.format(original_text[begin:end+1])

if pos < len(original_text):
html_output += '<span class="spark-nlp-display-others" style="background-color: white">{}</span>'.format(original_text[pos:])
Expand Down
4 changes: 2 additions & 2 deletions sparknlp_display/ner.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,10 @@ def __display_ner(self, result, label_col, document_col, original_text, labels_l
if entity_type in label_color:
html_output += '<span class="spark-nlp-display-entity-wrapper" style="background-color: {}"><span class="spark-nlp-display-entity-name">{} </span><span class="spark-nlp-display-entity-type">{}</span></span>'.format(
label_color[entity_type],
entity.result,
original_text[begin:end+1],#entity.result,
entity.metadata['entity'])
else:
html_output += '<span class="spark-nlp-display-others" style="background-color: white">{}</span>'.format(entity.result)
html_output += '<span class="spark-nlp-display-others" style="background-color: white">{}</span>'.format(original_text[begin:end+1])

if pos < len(original_text):
html_output += '<span class="spark-nlp-display-others" style="background-color: white">{}</span>'.format(original_text[pos:])
Expand Down

0 comments on commit 47b6d36

Please sign in to comment.