1.0 KiB
1.0 KiB
jupytext, kernelspec
| jupytext | kernelspec | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
amr
AMR captures “who is doing what to whom” in a sentence. Each sentence is represented as a rooted, directed, acyclic graph with labels on edges (relations) and leaves (concepts).
Before loading an AMR model, make sure to install HanLP with the amr dependencies:
pip install hanlp[amr] -U
To parse a raw sentence into AMR:
.. margin:: Batching is Faster
.. Hint:: Parse multiple sentences at once for faster speed!
:tags: [output_scroll]
import hanlp
amr_parser = hanlp.load(hanlp.pretrained.amr.AMR3_SEQ2SEQ_BART_LARGE)
amr = amr_parser('The boy wants the girl to believe him.')
print(amr)
All the pre-trained parsers and their scores are listed below.
.. automodule:: hanlp.pretrained.amr
:members: