Extract all the surface forms of the verb. https://nlp100.github.io/ja/ch04.html
I wasn't sure what to do from the Input data below, but if you refer to the answers from those who have already solved it, I see. Should I for loop again in the for loop to get the data of the list in the list? I learned something.
#input data
[[{'surface': 'one', 'base': 'one', 'pos': 'noun', 'pos1': 'numeral'}],
[{'surface': 'I', 'base': 'I', 'pos': 'noun', 'pos1': '普通noun'},
{'surface': 'Is', 'base': 'Is', 'pos': 'Particle', 'pos1': '副Particle'},
{'surface': 'Cat', 'base': 'Cat', 'pos': 'noun', 'pos1': '普通noun'},
{'surface': 'Is', 'base': 'Is', 'pos': 'Judgment', 'pos1': '*'},
{'surface': '。', 'base': '。', 'pos': 'Special', 'pos1': 'Kuten'}],
[{'surface': 'name', 'base': 'name', 'pos': 'noun', 'pos1': '普通noun'},
{'surface': 'Is', 'base': 'Is', 'pos': 'Particle', 'pos1': '副Particle'},
{'surface': 'yet', 'base': 'yet', 'pos': 'adverb', 'pos1': '*'},
{'surface': 'No', 'base': 'No', 'pos': 'adjective', 'pos1': '*'},
{'surface': '。', 'base': '。', 'pos': 'Special', 'pos1': 'Kuten'}],
...
surface = []
for sentense in result_list:
for morphene in sentense:
if morphene['pos'] == 'verb':
surface.append(morphene['surface'])
surface
#result
['Born',
'Tsuka',
'did',
'In tears',
'do it',
'Start with',
...
Challenge 100 language processing knocks Chapter 4
Recommended Posts