Skip to content

Display single text outputs

If you are

  • Developping a new pipeline
  • Testing various inputs on an existing pipeline
  • ...

you might want to quickly apply a pipeline and display the output doc in a comprehensible way.

```{ .python .no-check } from edsnlp.viz import QuickExample

E = QuickExample(nlp) # (1)

1. This is the `Language` instance that should be defined beforehands

Next, simply call `E` with any string:

 ```{ .python .no-check }
txt = "Le patient présente une anomalie."
E(txt)

                              Le patient présente une anomalie                               
                                                                                             
┏━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━┓
┃ Entity    Source    eds.hypoth…  eds.negation  eds.family  eds.history  eds.report… ┃
┡━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━┩
│ patient  │ patient  │ FalseFalseFalseFalseFalse       │
│ anomalie │ anomalie │ FalseFalseFalseFalseFalse       │
└──────────┴──────────┴─────────────┴──────────────┴────────────┴─────────────┴─────────────┘

By default, each Qualifiers in nlp adds a corresponding column to the output. Additionnal informations can be displayed by using the extensions parameter. For instance, if entities have a custom ent._.custom_ext extensions, it can be displayed by providing the extension when instantiating QuickExample:

```{ .python .no-check } E = QuickExample(nlp, extensions=["_.custom_ext"])

Finally, if you prefer to output a DataFrame instead of displaying a table, set the `as_dataframe` parameter to True:

 ```{ .python .no-check }
E = QuickExample(nlp)
E(txt, as_dataframe=True)