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
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
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)
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