- The Applied AI and Natural Language Processing Workshop
- Krishna Sankar Jeffrey Jackovich Ruze Richards
- 371字
- 2021-06-18 18:19:32
Recursion and Parameters
Importing files one at a time is time-consuming, especially if you have many files in a folder that need to be imported. A simple solution is to use a recursive procedure. A recursive procedure is one that can call itself and saves you, the user, from entering the same import command for each file.
Performing a recursive CLI command requires passing a parameter to the API. This sounds complicated, but it is incredibly easy. First, a parameter is simply a name or option that is passed to a program to affect the operation of the receiving program. In our case, the parameter is recursive, and the entire command to perform the recursive command is as follows:
aws s3 cp s3://myBucket . --recursive
With this command, all the S3 objects in the bucket are copied to the specified directory:

Figure 1.33: Parameter list
Activity 1.01: Putting the Data into S3 with the CLI
Let's start with a note about the terminology used in this activity. Putting data into S3 can also be called uploading. Getting it from there is called downloading. Sometimes, it is also called importing and exporting. Please do not confuse this with AWS Import/Export, which is a specific AWS service for sending a large amount of data to AWS or getting it back from AWS.
In this activity, we will be using the CLI to create a bucket in S3 and import a second text file. Suppose that you are creating a chatbot. You have identified text documents that contain content that will allow your chatbot to interact with customers more effectively. Before the text documents can be parsed, they need to be uploaded to an S3 bucket. Once they are in S3, further analysis will be possible. To ensure that this has happened correctly, you will need to install Python, set up the Amazon CLI tools, and have a user authenticated with the CLI:
- Configure the CLI and verify that it can successfully connect to your AWS environment.
- Create a new S3 bucket.
- Import your text file into the bucket.
- Export the file from the bucket and verify the exported objects.
Note
The solution for this activity can be found on page 276.
- 用“芯”探核:龍芯派開發(fā)實戰(zhàn)
- Istio入門與實戰(zhàn)
- 圖解西門子S7-200系列PLC入門
- 網絡服務器配置與管理(第3版)
- 電腦維護與故障排除傻瓜書(Windows 10適用)
- 深入淺出SSD:固態(tài)存儲核心技術、原理與實戰(zhàn)
- Intel FPGA/CPLD設計(高級篇)
- 平衡掌控者:游戲數值經濟設計
- 電腦軟硬件維修從入門到精通
- 微服務實戰(zhàn)(Dubbox +Spring Boot+Docker)
- Drupal Rules How-to
- PIC系列單片機的流碼編程
- 超炫的35個Arduino制作項目
- 微處理器及控制電路識圖
- Applied Supervised Learning with R