Skip to content

Instantly share code, notes, and snippets.

@pmbaumgartner
Created August 10, 2022 12:43
Show Gist options
  • Save pmbaumgartner/85b3a0256131e86fbdd78a8b4060d361 to your computer and use it in GitHub Desktop.
Save pmbaumgartner/85b3a0256131e86fbdd78a8b4060d361 to your computer and use it in GitHub Desktop.
from typing import TypedDict
DisplacyDepsWords = TypedDict(
"DisplacyDepsWords", {"text": str, "tag": str, "lemma": Optional[str]}
)
DisplacyDepsArcs = TypedDict(
"DisplacyDepsArcs", {"start": int, "end": int, "label": str, "dir": str}
)
DisplacyDepsData = TypedDict(
"DisplacyDepsData",
{
"arcs": List[DisplacyDepsArcs],
"words": List[DisplacyDepsWords],
"settings": Dict[str, Any],
},
)
DisplacyEnt = TypedDict(
"DisplacyEnt", {"start": int, "end": int, "label": str, "kb_id": str, "kb_url": str}
)
DisplacyEntData = TypedDict(
"DisplacyEntData",
{"text": str, "ents": List[DisplacyEnt], "title": str, "settings": Dict[str, Any]},
)
DisplacySpan = TypedDict(
"DisplacySpan",
{
"start": int,
"end": int,
"start_token": int,
"end_token": int,
"label": str,
"kb_id": str,
"kb_url": str,
},
)
DisplacySpanData = TypedDict(
"DisplacySpanData",
{
"text": str,
"spans": List[DisplacySpan],
"title": str,
"settings": Dict[str, Any],
"tokens": List[str],
},
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment