[PYTHON] 100 language processing knocks Chapter 4: Morphological analysis 31. Verbs

31. Verb

problem

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'}],
...

Answer

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',
...

Referenced site

Challenge 100 language processing knocks Chapter 4

Recommended Posts

100 language processing knocks Chapter 4: Morphological analysis 31. Verbs
[Language processing 100 knocks 2020] Chapter 4: Morphological analysis
100 language processing knocks Morphological analysis learned in Chapter 4
100 Language Processing Knock 2020 Chapter 4: Morphological Analysis
100 Language Processing Knock Chapter 4: Morphological Analysis
100 Language Processing Knock 2015 Chapter 4 Morphological Analysis (30-39)
100 natural language processing knocks Chapter 4 Morphological analysis (second half)
100 language processing knocks ~ Chapter 1
100 language processing knocks Chapter 2 (10 ~ 19)
Natural language processing 1 Morphological analysis
100 natural language processing knocks Chapter 5 Dependency analysis (second half)
100 natural language processing knocks Chapter 5 Dependency analysis (first half)
100 Language Processing Knock 2015 Chapter 5 Dependency Analysis (40-49)
[Language processing 100 knocks 2020] Chapter 3: Regular expressions
100 natural language processing knocks Chapter 4 Commentary
[Language processing 100 knocks 2020] Chapter 6: Machine learning
[Language processing 100 knocks 2020] Chapter 1: Preparatory movement
[Language processing 100 knocks 2020] Chapter 7: Word vector
100 Language Processing Knock 2020 Chapter 5: Dependency Analysis
100 language processing knocks 2020: Chapter 3 (regular expression)
[Language processing 100 knocks 2020] Chapter 8: Neural network
[Language processing 100 knocks 2020] Chapter 2: UNIX commands
[Language processing 100 knocks 2020] Chapter 9: RNN, CNN
100 language processing knocks 03 ~ 05
100 language processing knocks (2020): 32
100 language processing knocks (2020): 35
100 language processing knocks (2020): 47
100 language processing knocks (2020): 39
100 language processing knocks (2020): 22
100 language processing knocks (2020): 26
100 language processing knocks (2020): 34
100 language processing knocks (2020): 42
100 language processing knocks (2020): 29
100 language processing knocks (2020): 49
100 language processing knocks 06 ~ 09
100 language processing knocks (2020): 43
100 language processing knocks (2020): 24
100 language processing knocks (2020): 45
100 language processing knocks (2020): 10-19
100 language processing knocks (2020): 30
100 language processing knocks (2020): 00-09
100 language processing knocks (2020): 31
100 language processing knocks (2020): 48
100 language processing knocks (2020): 44
100 language processing knocks (2020): 41
100 language processing knocks (2020): 37
100 language processing knocks (2020): 25
100 language processing knocks (2020): 23
100 language processing knocks (2020): 33
100 language processing knocks (2020): 20
100 language processing knocks (2020): 27
100 language processing knocks (2020): 46
100 language processing knocks (2020): 21
100 language processing knocks (2020): 36
100 amateur language processing knocks: 41
100 amateur language processing knocks: 71
100 amateur language processing knocks: 56
100 amateur language processing knocks: 24
100 amateur language processing knocks: 50
100 amateur language processing knocks: 59
100 amateur language processing knocks: 70