Skip to content

Latest commit

 

History

History
153 lines (138 loc) · 5.71 KB

et.md

File metadata and controls

153 lines (138 loc) · 5.71 KB

süntaktiline analüüs deplacy kaudu

>>> import stanza
>>> nlp=stanza.Pipeline("et")
>>> doc=nlp("Suuga teeb suure linna, käega ei tee kärbse pesagi.")
>>> import deplacy
>>> deplacy.render(doc)
Suuga  NOUN  <════╗         obl
teeb   VERB  ═══╗═╝═════╗═╗ root
suure  ADJ   <╗ ║       ║ ║ amod
linna  NOUN  ═╝<╝       ║ ║ obj
,      PUNCT <════════╗ ║ ║ punct
käega  NOUN  <══════╗ ║ ║ ║ obl
ei     AUX   <════╗ ║ ║ ║ ║ aux
tee    VERB  ═══╗═╝═╝═╝<╝ ║ conj
kärbse NOUN  <╗ ║         ║ nmod
pesagi NOUN  ═╝<╝         ║ obj
.      PUNCT <════════════╝ punct
>>> import spacy_udpipe
>>> nlp=spacy_udpipe.load("et")
>>> doc=nlp("Suuga teeb suure linna, käega ei tee kärbse pesagi.")
>>> import deplacy
>>> deplacy.render(doc)
Suuga  NOUN  <════╗         obl
teeb   VERB  ═══╗═╝═════╗═╗ ROOT
suure  ADJ   <╗ ║       ║ ║ amod
linna  NOUN  ═╝<╝       ║ ║ obj
,      PUNCT <════════╗ ║ ║ punct
käega  NOUN  <══════╗ ║ ║ ║ obl
ei     AUX   <════╗ ║ ║ ║ ║ aux
tee    VERB  ═══╗═╝═╝═╝<╝ ║ conj
kärbse NOUN  <╗ ║         ║ nmod
pesagi NOUN  ═╝<╝         ║ obj
.      PUNCT <════════════╝ punct
>>> import ufal.udpipe
>>> model=ufal.udpipe.Model.load("estudmodel4")
>>> nlp=ufal.udpipe.Pipeline(model,"tokenize","","","").process
>>> doc=nlp("Suuga teeb suure linna, käega ei tee kärbse pesagi.")
>>> import deplacy
>>> deplacy.render(doc)
Suuga  NOUN  <════╗         obl
teeb   VERB  ═══╗═╝═════╗═╗ root
suure  ADJ   <╗ ║       ║ ║ amod
linna  NOUN  ═╝<╝       ║ ║ obj
,      PUNCT <════════╗ ║ ║ punct
käega  NOUN  <══════╗ ║ ║ ║ obl
ei     AUX   <════╗ ║ ║ ║ ║ aux
tee    VERB  ═══╗═╝═╝═╝<╝ ║ conj
kärbse NOUN  <╗ ║         ║ nmod
pesagi NOUN  ═╝<╝         ║ obj
.      PUNCT <════════════╝ punct
>>> import spacy_jptdp
>>> nlp=spacy_jptdp.load("et_edt")
>>> doc=nlp("Suuga teeb suure linna, käega ei tee kärbse pesagi.")
>>> import deplacy
>>> deplacy.render(doc)
Suuga  NOUN  <════╗         obl
teeb   VERB  ═══╗═╝═════╗═╗ ROOT
suure  ADJ   <╗ ║       ║ ║ amod
linna  NOUN  ═╝<╝       ║ ║ obj
,      PUNCT <════════╗ ║ ║ punct
käega  NOUN  <══════╗ ║ ║ ║ obl
ei     AUX   <════╗ ║ ║ ║ ║ aux
tee    VERB  ═══╗═╝═╝═╝<╝ ║ conj
kärbse NOUN  <╗ ║         ║ nmod
pesagi NOUN  ═╝<╝         ║ nsubj
.      PUNCT <════════════╝ punct
>>> def nlp(t):
...   import urllib.request,urllib.parse,json
...   with urllib.request.urlopen("https://lindat.mff.cuni.cz/services/udpipe/api/process?model=et&tokenizer&tagger&parser&data="+urllib.parse.quote(t)) as r:
...     return json.loads(r.read())["result"]
...
>>> doc=nlp("Suuga teeb suure linna, käega ei tee kärbse pesagi.")
>>> import deplacy
>>> deplacy.render(doc)
Suuga  NOUN  <════╗         obl
teeb   VERB  ═══╗═╝═════╗═╗ root
suure  ADJ   <╗ ║       ║ ║ amod
linna  NOUN  ═╝<╝       ║ ║ obj
,      PUNCT <════════╗ ║ ║ punct
käega  NOUN  <══════╗ ║ ║ ║ obl
ei     AUX   <════╗ ║ ║ ║ ║ aux
tee    VERB  ═══╗═╝═╝═╝<╝ ║ conj
kärbse NOUN  <╗ ║         ║ nmod
pesagi NOUN  ═╝<╝         ║ nsubj
.      PUNCT <════════════╝ punct
>>> import trankit
>>> nlp=trankit.Pipeline("estonian")
>>> doc=nlp("Suuga teeb suure linna, käega ei tee kärbse pesagi.")
>>> import deplacy
>>> deplacy.render(doc)
Suuga  NOUN  <════╗         obl
teeb   VERB  ═══╗═╝═════╗═╗ root
suure  ADJ   <╗ ║       ║ ║ amod
linna  NOUN  ═╝<╝       ║ ║ obj
,      PUNCT <════════╗ ║ ║ punct
käega  NOUN  <══════╗ ║ ║ ║ obl
ei     AUX   <════╗ ║ ║ ║ ║ aux
tee    VERB  ═╗═╗═╝═╝═╝<╝ ║ conj
kärbse NOUN  <╝ ║         ║ obl
pesagi NOUN  <══╝         ║ obj
.      PUNCT <════════════╝ punct
>>> import spacy
>>> nlp=spacy.load("en_udify")
>>> doc=nlp("Suuga teeb suure linna, käega ei tee kärbse pesagi.")
>>> import deplacy
>>> deplacy.render(doc)
Suuga  NOUN  <════╗         obl
teeb   VERB  ═══╗═╝═════╗═╗ root
suure  ADJ   <╗ ║       ║ ║ amod
linna  NOUN  ═╝<╝       ║ ║ obj
,      PUNCT <════════╗ ║ ║ punct
käega  NOUN  <══════╗ ║ ║ ║ obl
ei     AUX   <════╗ ║ ║ ║ ║ aux
tee    VERB  ═╗═╗═╝═╝═╝<╝ ║ conj
kärbse NOUN  <╝ ║         ║ obj
pesagi NOUN  <══╝         ║ obj
.      PUNCT <════════════╝ punct