Files
2026-07-13 12:37:18 +08:00

1.0 KiB

jupytext, kernelspec
jupytext kernelspec
formats text_representation
ipynb,md:myst
extension format_name format_version jupytext_version
.md myst 0.8 1.4.2
display_name language name
Python 3 python python3

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: