FAQs Natural Language Processing - HUAWEI TECHNOLOGIES CO., LTD - Issue Date - Huawei Cloud

Page created by Darrell Salinas
 
CONTINUE READING
FAQs Natural Language Processing - HUAWEI TECHNOLOGIES CO., LTD - Issue Date - Huawei Cloud
Natural Language Processing

FAQs

Issue           01
Date            2021-09-02

HUAWEI TECHNOLOGIES CO., LTD.
Copyright © Huawei Technologies Co., Ltd. 2021. All rights reserved.
No part of this document may be reproduced or transmitted in any form or by any means without prior
written consent of Huawei Technologies Co., Ltd.

Trademarks and Permissions

      and other Huawei trademarks are trademarks of Huawei Technologies Co., Ltd.
All other trademarks and trade names mentioned in this document are the property of their respective
holders.

Notice
The purchased products, services and features are stipulated by the contract made between Huawei and
the customer. All or part of the products, services and features described in this document may not be
within the purchase scope or the usage scope. Unless otherwise specified in the contract, all statements,
information, and recommendations in this document are provided "AS IS" without warranties, guarantees
or representations of any kind, either express or implied.

The information in this document is subject to change without notice. Every effort has been made in the
preparation of this document to ensure accuracy of the contents, but all statements, information, and
recommendations in this document do not constitute a warranty of any kind, express or implied.

Huawei Technologies Co., Ltd.
Address:       Huawei Industrial Base
               Bantian, Longgang
               Shenzhen 518129
               People's Republic of China

Website:       https://www.huawei.com
Email:         support@huawei.com

Issue 01 (2021-09-02)          Copyright © Huawei Technologies Co., Ltd.                                  i
Natural Language Processing
FAQs                                                                                                                                  Contents

                                                                                                                      Contents

1 How Do I Obtain a User Token Using Postman?..............................................................1
2 What Should I Do If an NLP API Call Fails?.......................................................................4
3 Which Methods Can Be Used to Call NLP APIs?.............................................................. 5
4 Must I Subscribe to NLP Before Calling NLP APIs?..........................................................6
5 Can NLP Be Deployed on Premises?....................................................................................7
6 Can I Use NLP Offline?........................................................................................................... 8
7 What Are Restrictions for Using NLP?................................................................................9
8 What Are the Username, Domain Name, and Project Name in the Token Message
Body?............................................................................................................................................10
9 Regions and AZs.................................................................................................................... 11
10 What Permissions Do I Need to Use NLP?.................................................................... 13
11 What Should I Do If I Want to Customize NLP?.......................................................... 14

Issue 01 (2021-09-02)                      Copyright © Huawei Technologies Co., Ltd.                                                             ii
Natural Language Processing
FAQs                                                   1 How Do I Obtain a User Token Using Postman?

         1           How Do I Obtain a User Token Using
                                              Postman?

                 Postman is a visual editing tool for building and testing API requests. It provides
                 an easy-to-use user interface to send HTTP requests, including GET, PUT, POST,
                 and DELETE requests. Postman allows you to modify parameters of HTTP requests
                 and returns response to your requests.

                 A token is a user's access credential, which includes user identities and
                 permissions. When you call an API to access cloud resources, a token is required
                 for identity authentication.

                 Perform the procedure described in this section to obtain a user token using
                 Postman. For details about the parameters, see Obtaining a User Token.

Prerequisites
                 You have installed and registered with Postman.

Procedure
         Step 1 Edit the request URL, header, and body of the API used to obtain a token for
                calling APIs.
                 ●      Request URL
                        The request URL is in the format https://IAM region and endpoint/API URI.
                        a.   Obtain the IAM region and endpoint from Regions and Endpoints.

                             Figure 1-1 IAM regions and endpoints

                        b.   Obtain the API URI from Obtaining a User Token.

Issue 01 (2021-09-02)           Copyright © Huawei Technologies Co., Ltd.                           1
Natural Language Processing
FAQs                                                                  1 How Do I Obtain a User Token Using Postman?

                                    For example, the request URL in the ap-southeast-3 region is https://
                                    iam.ap-southeast-3.myhwclouds.com/v3/auth/tokens.
                        c.          Select an API request method and enter the request URL in Postman.
                 ●      Request Header
                        Set key to Content-Type and value to application/json;charset=utf8.
                 ●      Request Body
                        Modify parameters in the example request body.
                        {
                                "auth": {
                                  "identity": {
                                     "methods": [
                                                      "password"
                                                 ],
                                        "password": {
                                          "user": {
                                             "domain": {
                                                "name": "Account name"
                                             },
                                             "name": "IAM user name",
                                             "password": "IAM user password"
                                          }
                                        }
                                    },
                                    "scope": {
                                       "domain": {
                                               "name": "Account name"
                                       }
                                    }
                                }
                            }

                                        NOTE

                                    –    For details about how to obtain the account name and IAM user name, see
                                         Obtaining Account, IAM User, and Project Information.
                                    –    Third-party system users can set a password by clicking Forgot Password on the
                                         login page.

         Step 2 Click Send to send the API request.

         Step 3 View the token in the response header. When you call other IAM APIs, you can use
                this token for authentication.

                         NOTE

                        ● The validity period of a token is 24 hours. If you want to use a token for authentication,
                          cache it to avoid frequently calling the IAM API.
                        ● If an error code, for example 401, is returned, the authentication fails. Confirm that
                          parameters in the request body are correct and send the request again.
                        ● If "Header Overflow" is displayed, resolve the problem by referring to Solution.

                 ----End

Solution
                 We have found that Postman of V7.25.0, V7.26.0, or later cannot be used to obtain
                 a user token due to configurations. The message "Header Overflow" will be
                 displayed if you use any of these versions.

Issue 01 (2021-09-02)                     Copyright © Huawei Technologies Co., Ltd.                                       2
Natural Language Processing
FAQs                                                              1 How Do I Obtain a User Token Using Postman?

                 ●      Method 1
                        Use an earlier version of Postman, such as V5.xx.
                 ●      Method 2:
                        Run the following curl command to obtain a token and replace the text in
                        bold with actual values:
                        curl -ik -X POST -H 'Content-Type=application/json;charset=utf8' -d '{"auth": {"identity": {"methods":
                        ["password"],"password": {"user": {"domain": {"name": "Account name"},"name": "IAM user
                        name","password": "IAM user password"}},},"scope": {"domain": {"name": "Account name"}}}}'
                        https://iam.ap-southeast-1.myhuaweicloud.com/v3/auth/tokens

                 ●      Method 3
                        Pass an additional environment variable NODE_OPTIONS=--max-http-
                        header-size=16384 (16KB) to Postman to specify the maximum size of the
                        HTTP header (in bytes).
                        Run one of the following commands depending on your OS:
                        –    macOS
                             NODE_OPTIONS=--max-http-header-size=16384 /Applications/Postman.app/Contents/MacOS/
                             Postman

                        –    Linux
                             NODE_OPTIONS=--max-http-header-size=16384 /path/to/Postman/Postman

                        –    Windows
                             set NODE_OPTIONS=--max-http-header-size=16384
                             C:\users\\AppData\local\Postman\Postman.exe

Issue 01 (2021-09-02)             Copyright © Huawei Technologies Co., Ltd.                                                      3
Natural Language Processing
FAQs                                                          2 What Should I Do If an NLP API Call Fails?

          2           What Should I Do If an NLP API Call
                                                   Fails?

Solution
                 1.     Locate the fault according to the returned result or error code.
                 2.     Check whether the token has been correctly entered or has expired.
                 3.     Check whether the API has been correctly invoked.
                 4.     If the fault fails to be located and rectified, contact the technical support.

Issue 01 (2021-09-02)           Copyright © Huawei Technologies Co., Ltd.                                4
Natural Language Processing
FAQs                                                    3 Which Methods Can Be Used to Call NLP APIs?

3         Which Methods Can Be Used to Call NLP
                                          APIs?

                 You can initiate a request to invoke NLP APIs based on constructed request
                 messages using any of the following three methods:
                 ●      cURL
                        cURL is a command-line tool used to perform URL operations and transfer
                        files. cURL acts as the HTTP client that can send HTTP requests to the HTTP
                        server and receive response messages. It is applicable to API debugging. For
                        more information about cURL, visit https://curl.haxx.se/.
                 ●      Code
                        You can invoke APIs using code to assemble, send, and process request
                        messages.
                 ●      REST client
                        Both Mozilla Firefox and Google Chrome provide a graphical browser plugin,
                        that is, REST client, to send and process requests. Download Postman from
                        https://www.getpostman.com/.

Issue 01 (2021-09-02)          Copyright © Huawei Technologies Co., Ltd.                               5
Natural Language Processing
FAQs                                                4 Must I Subscribe to NLP Before Calling NLP APIs?

     4         Must I Subscribe to NLP Before Calling
                                           NLP APIs?

                 You must subscribe to beta services before calling APIs. For commercial services,
                 there is no need to subscribe to them before calling APIs. Currently, all services
                 have been put into commercial use. Therefore, you do not need subscription.

Issue 01 (2021-09-02)         Copyright © Huawei Technologies Co., Ltd.                               6
Natural Language Processing
FAQs                                                             5 Can NLP Be Deployed on Premises?

            5           Can NLP Be Deployed on Premises?

                 NLP cannot be deployed on premises.

Issue 01 (2021-09-02)         Copyright © Huawei Technologies Co., Ltd.                          7
Natural Language Processing
FAQs                                                                      6 Can I Use NLP Offline?

                                        6         Can I Use NLP Offline?

                 No. Invoking SDKs must ensure that you can access the Internet. NLP APIs are
                 deployed on HUAWEI CLOUD. Therefore, you can call APIs only when the Internet
                 can be accessed.

Issue 01 (2021-09-02)         Copyright © Huawei Technologies Co., Ltd.                         8
Natural Language Processing
FAQs                                                             7 What Are Restrictions for Using NLP?

       7          What Are Restrictions for Using NLP?

                 Each NLP API requires different resources. Therefore, the corresponding restrictions
                 are different. For details, see the following table.

                 Table 7-1 Restrictions on NLP API calls
                  API                                       Single-User QPS

                  Word segmentation                         20

                  NER (Basic edition)                       20

                  Text similarity (Basic edition)           20

                  Text summarization (Basic edition)        20

                  Sentiment analysis (Basic edition)        20

Issue 01 (2021-09-02)         Copyright © Huawei Technologies Co., Ltd.                              9
Natural Language Processing                              8 What Are the Username, Domain Name, and
FAQs                                                        Project Name in the Token Message Body?

 8         What Are the Username, Domain Name,
           and Project Name in the Token Message
                                           Body?

                 ●      user name indicates the name of an IAM user.
                 ●      domain name indicates the name of the account to which the user belongs.
                        If the token is obtained by an account, user name and domain name are the
                        same. If the token is obtained by an IAM user (multiple IAM users can be
                        created under an account), user name is a real-world username and is
                        different from domain name.
                 ●      The project name can be set to cn-north-4.For details about how to obtain a
                        project name, see Obtaining the Username, User ID, Project Name, and
                        Project ID.

Issue 01 (2021-09-02)          Copyright © Huawei Technologies Co., Ltd.                          10
Natural Language Processing
FAQs                                                                                     9 Regions and AZs

                                                          9         Regions and AZs

Concepts
                 A region and availability zone (AZ) identify the location of a data center. You can
                 create resources in a specific region and AZ.

                 ●      Regions are divided from the dimensions of geographical location and
                        network latency. Public services, such as Elastic Cloud Server (ECS), Elastic
                        Volume Service (EVS), Object Storage Service (OBS), Virtual Private Cloud
                        (VPC), Elastic IP (EIP), and Image Management Service (IMS), are shared
                        within the same region. Regions are classified as universal regions and
                        dedicated regions. A universal region provides universal cloud services for
                        common tenants. A dedicated region provides services of the same type only
                        or for specific tenants.
                 ●      An AZ contains one or more physical data centers. Each AZ has independent
                        cooling, fire extinguishing, moisture-proof, and electricity facilities. Within an
                        AZ, computing, network, storage, and other resources are logically divided
                        into multiple clusters. AZs within a region are interconnected using high-
                        speed optical fibers to allow you to build cross-AZ high-availability systems.

                 Figure 9-1 shows the relationship between the regions and AZs.

                 Figure 9-1 Regions and AZs

                 Services of HUAWEI CLOUD are available in many regions around the world. You
                 can select a region and AZ as needed.

Issue 01 (2021-09-02)           Copyright © Huawei Technologies Co., Ltd.                                11
Natural Language Processing
FAQs                                                                                  9 Regions and AZs

How Should I Select a Region?
                 When selecting a region, consider the following factors:
                 ●      Geolocation
                        You are advised to select a region close to you or your target users. This
                        reduces network latency and improves access speed. However, the Chinese
                        mainland regions provide the same infrastructure, BGP network quality, as
                        well as resource operations and configurations. Therefore, if you or your
                        target users are in the Chinese mainland, you do not need to consider the
                        network latency differences when selecting a region.
                        –   If you or your target users are in the Asia Pacific area (excluding the
                            Chinese mainland), select the CN-Hong Kong, AP-Bangkok, or AP-
                            Singapore region.
                        –   If you or your target users are in Africa, select the AF-Johannesburg
                            region.
                        –   If you or your target users are in Europe, select the EU-Paris region.
                 ●      Related cloud services
                        If you use multiple cloud services together, pay attention to the following
                        constraints:
                        –   ECSs, RDS instances, and OBS buckets in different regions cannot
                            communicate with each other through an internal network.
                        –   ECSs in different regions cannot be bound to the same load balancer.
                 ●      Resource price
                        Resource prices may vary in different regions.

How Should I Select an AZ?
                 When determining whether to deploy resources in the same AZ, consider your
                 application's requirements on disaster recovery (DR) and network latency.
                 ●      For high DR capability, deploy resources in different AZs in the same region.
                 ●      For low network latency, deploy resources in the same AZ.

Regions and Endpoints
                 When using an API to use resources, you must specify its region and endpoint. For
                 more details about regions and endpoints, see NLP Regions and Endpoints.

Issue 01 (2021-09-02)           Copyright © Huawei Technologies Co., Ltd.                               12
Natural Language Processing
FAQs                                                      10 What Permissions Do I Need to Use NLP?

   10                   What Permissions Do I Need to Use
                                                    NLP?

Description
                 To use NLP, what permissions are required?

Solution
                 Operations on NLP do not require additional permissions.

Issue 01 (2021-09-02)         Copyright © Huawei Technologies Co., Ltd.                         13
Natural Language Processing
FAQs                                                 11 What Should I Do If I Want to Customize NLP?

               11                 What Should I Do If I Want to
                                               Customize NLP?

Description
                 What is the process of customizing NLP?

Solution
                 Submit a service ticket on the console and engineers will respond as soon as
                 possible. Perform the following steps:

         Step 1 Log in to the HUAWEI CLOUD homepage.
         Step 2 Access the console, choose More > Service Tickets > Create Service Ticket, or
                Service Tickets > Create Service Ticket (when your computer screen is large)
                from the main menu. On the displayed page, enter your needs.

                 ----End

Issue 01 (2021-09-02)         Copyright © Huawei Technologies Co., Ltd.                          14
You can also read