Skip to content

Latest commit

 

History

History
107 lines (94 loc) · 3.13 KB

id.md

File metadata and controls

107 lines (94 loc) · 3.13 KB

deplacy untuk analisis sintaksis

dengan Stanza

>>> import stanza
>>> nlp=stanza.Pipeline("id")
>>> doc=nlp("Di atas langit masih ada langit.")
>>> import deplacy
>>> deplacy.render(doc)
Di     ADP   <══╗     case
atas   ADP   <╗ ║     case
langit NOUN  ═╝═╝<obl
masih  ADV   <══╗ ║   advmod
ada    VERB  ═╗═╝═╝═╗ root
langit NOUN  <╝     ║ obj
.      PUNCT <══════╝ punct

dengan Trankit

>>> import trankit
>>> nlp=trankit.Pipeline("indonesian")
>>> doc=nlp("Di atas langit masih ada langit.")
>>> import deplacy
>>> deplacy.render(doc)
Di     ADP   <══╗     case
atas   ADP   <╗ ║     case
langit NOUN  ═╝═╝<obl
masih  ADV   <══╗ ║   advmod
ada    VERB  ═╗═╝═╝═╗ root
langit NOUN  <╝     ║ obj
.      PUNCT <══════╝ punct
>>> import spacy_udpipe
>>> nlp=spacy_udpipe.load("id")
>>> doc=nlp("Di atas langit masih ada langit.")
>>> import deplacy
>>> deplacy.render(doc)
Di     ADP   <══╗     case
atas   NOUN  ═╗═╝<obl
langit NOUN  <╝   ║   nmod
masih  ADV   <══╗ ║   advmod
ada    VERB  ═╗═╝═╝═╗ root
langit NOUN  <╝     ║ obj
.      PUNCT <══════╝ punct
>>> import spacy
>>> nlp=spacy.load("en_udify")
>>> doc=nlp("Di atas langit masih ada langit.")
>>> import deplacy
>>> deplacy.render(doc)
Di     ADP   <══╗     case
atas   ADP   ═╗═╝<obl
langit NOUN  <╝   ║   nmod
masih  ADV   <══╗ ║   advmod
ada    VERB  ═╗═╝═╝═╗ root
langit NOUN  <╝     ║ obj
.      PUNCT <══════╝ punct

dengan UDPipe 2

>>> def nlp(t):
...   import urllib.request,urllib.parse,json
...   with urllib.request.urlopen("https://lindat.mff.cuni.cz/services/udpipe/api/process?model=id&tokenizer&tagger&parser&data="+urllib.parse.quote(t)) as r:
...     return json.loads(r.read())["result"]
...
>>> doc=nlp("Di atas langit masih ada langit.")
>>> import deplacy
>>> deplacy.render(doc)
Di     ADP   <case
atas   ADP   ═╝<════╗   obl
langit NOUN  <════╗ ║   obl
masih  ADV   <══╗ ║ ║   advmod
ada    VERB  ═╗═╝═╝═╝═╗ root
langit NOUN  <╝       ║ obj
.      PUNCT <════════╝ punct
>>> import spacy_jptdp
>>> nlp=spacy_jptdp.load("id_gsd")
>>> doc=nlp("Di atas langit masih ada langit.")
>>> import deplacy
>>> deplacy.render(doc)
Di     ADP   <case
atas   ADP   ═╝<════╗   obl
langit NOUN  <════╗ ║   obl
masih  ADV   <══╗ ║ ║   advmod
ada    VERB  ═╗═╝═╝═╝═╗ ROOT
langit NOUN  <╝       ║ obj
.      PUNCT <════════╝ punct