Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
MorphoDiTa example
import requests
result = requests.get('http://lindat.mff.cuni.cz/services/morphodita/api/tag', params={
'data': 'Zeman: Chci být znovu prezidentem a budu kandidovat',
'output': 'json',
'convert_tagset': 'strip_lemma_comment',
}).json()
def is_noun(tag):
return tag.startswith('NN')
def clear_lemma(lemma):
lemma_parts = lemma.split('-')
if lemma_parts[-1].isdigit():
lemma_parts = lemma_parts[:-1]
return '-'.join(lemma_parts)
for sentence in result['result']:
for word in sentence:
if is_noun(word['tag']):
print(clear_lemma(word['lemma']))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.