[PYTHON] I read an introductory book on natural language processing

at first

Introduction to Natural Language Processing by Machine Learning / Deep Learning Mitsuki Nakayama I will write the impression that I read I tried to customize the sample code by myself so that I can become python

Chapters 1 and 2

A story about what machine learning is and a story about the execution environment of python In this book, it seems that the execution environment of python is created using Miniconda, but since the development environment of the conda system is only traumatic, I made a container for the python development environment with docker. Next, I introduced a module that complements python code with vi. It's a secret that I struggled to be able to handle multi-byte strings in vi copy and paste, python

Chapter 3

Explaining what a corpus is There was a code to get the data for machine learning from the Gurunavi API, so I customized it myself. Or rather, it doesn't work unless you customize it Originally the code specified the genre for the search key, but if you execute it according to the sample code, the result "Search result not found" is returned, probably because the API specification changed from intermediate match to exact match. (GourNavi API is too bad) Since there is no help for it, I tried to get the search result with longitude

sample.py


import requests
url ='https://api.gnavi.co.jp/PhotoSearchAPI/v3/'
params = {'keyid': 'YourAPI','latitude': 35.5367971,'longitude':139.634745}
response = requests.get(url,params=params).json()
lists = list( 
          map(
              lambda x:{'comment':response['response'][x]['``photo']['comment'],'socre':response['response'][x]['photo']['total_score']} ,
              list(
                  filter(lambda x1:response['response'][x1]['photo']['comment'] and response['response'][x1]['photo']['total_score']
                  ,list( filter(lambda x2:x2.isdigit(),response['response'].keys()) )  ) 
               ) )
)
print(lists)

Coding miscellaneous feelings

Write in a bulleted list

The data structure of the return value of the Gurunavi API is almost harassed. Why are the control code information and individual search results in the same second layer? Thanks to that, there may be useless logic to determine whether the index is a number.

Functional language processing is Java

   list.stream()   
   .filter()    
   .filter()    
   .map()    
   .collect()   

I wonder if I can call it like It's redundant to use the list () function every time I use map or filter. At most, using for-yield for another function for such a program is troublesome. I wonder if this is another python-like way just because I'm new to python

Recommended Posts

I read an introductory book on natural language processing
I tried natural language processing with transformers.
[Python] I played with natural language processing ~ transformers ~
Python: Natural language processing
RNN_LSTM2 Natural language processing
Building an environment for natural language processing with Python
Natural language processing 1 Morphological analysis
Natural language processing 3 Word continuity
I tried 100 language processing knock 2020
Natural language processing 2 Word similarity
Extracting papers from ACL2020, an international conference on natural language processing, using Python's arXiv API
Study natural language processing with Kikagaku
100 natural language processing knocks Chapter 4 Commentary
I get an ImportError on appengine_config.py
Natural language processing for busy people
[Natural language processing] I want to meet an engineer who is changing jobs (or just before)
[Natural language processing] Preprocessing with Japanese
I tried 100 language processing knock 2020: Chapter 3
Artificial language Lojban and natural language processing (artificial language processing)
I tried 100 language processing knock 2020: Chapter 1
Natural Language Processing Case Study: Word Frequency in'Anne with an E'
Preparing to start natural language processing
Natural language processing analyzer installation summary
I tried 100 language processing knock 2020: Chapter 2
I tried 100 language processing knock 2020: Chapter 4
I tried to display the analysis result of the natural language processing library GiNZA in an easy-to-understand manner
You become an engineer in 100 days ――Day 66 ――Programming ――About natural language processing
I created an SFTP-only user on Linux.
Natural language processing of Yu-Gi-Oh! Card name-Yu-Gi-Oh!
100 Knocking Natural Language Processing Chapter 1 (Preparatory Movement)
3. Natural language processing with Python 2-1. Co-occurrence network
[WIP] Pre-processing memo in natural language processing
3. Natural language processing with Python 1-1. Word N-gram
Convenient goods memo around natural language processing
I tried to extract named entities with the natural language processing library GiNZA
[Python] [Natural language processing] I tried Deep Learning ❷ made from scratch in Japanese ①
Getting started with Python with 100 knocks on language processing
3. Natural language processing with Python 2-2. Co-occurrence network [mecab-ipadic-NEologd]
I tried image processing like an event camera
I read PEP 614 (Relaxing Grammar Restrictions On Decorators)
Python: Deep Learning in Natural Language Processing: Basics
Let's enjoy natural language processing with COTOHA API
Unbearable shortness of Attention in natural language processing
I tried to classify Mr. Habu and Mr. Habu with natural language processing × naive Bayes classifier