教學課程:將 Power BI 與文字分析認知服務整合Tutorial: Integrate Power BI with the Text Analytics Cognitive Service

Microsoft Power BI Desktop 是免費的應用程式,可讓您將您的資料連接、轉換並視覺化。Microsoft Power BI Desktop is a free application that lets you connect to, transform, and visualize your data. 文字分析服務是 Microsoft Azure 認知服務的一部分,可提供自然語言處理。The Text Analytics service, part of Microsoft Azure Cognitive Services, provides natural language processing. 假設有未經處理的非結構化文字,它能擷取最重要的片語、分析情感,然後找出已知的實體 (例如樂團)。Given raw unstructured text, it can extract the most important phrases, analyze sentiment, and identify well-known entities such as brands. 搭配使用這些工具,您便可快速了解客戶在說什麼,以及他們對此有何看法。Together, these tools can help you quickly see what your customers are talking about and how they feel about it.

在本教學課程中,您將了解如何:In this tutorial, you'll learn how to:

  • 使用 Power Bi Desktop 匯入及轉換資料Use Power BI Desktop to import and transform data
  • 在 Power BI Desktop 中建立自訂函式Create a custom function in Power BI Desktop
  • 將 Power BI Desktop 與文字分析關鍵片語 API 整合Integrate Power BI Desktop with the Text Analytics Key Phrases API
  • 使用文字分析關鍵片語 API 從客戶意見反應擷取最重要的片語Use the Text Analytics Key Phrases API to extract the most important phrases from customer feedback
  • 從客戶意見反應建立文字雲Create a word cloud from customer feedback

必要條件Prerequisites

載入客戶資料Load customer data

若要開始,請開啟 Power BI Desktop,並載入您在必要條件中下載的逗點分隔值 (CSV) 檔案 FabrikamComments.csvTo get started, open Power BI Desktop and load the comma-separated value (CSV) file FabrikamComments.csv that you downloaded in Prerequisites. 這個檔案代表一家小型虛構公司的支援論壇中,一天之內的假設性活動。This file represents a day's worth of hypothetical activity in a fictional small company's support forum.

注意

Power BI 可以使用各種來源的資料,例如 Facebook 或 SQL 資料庫。Power BI can use data from a wide variety of sources, such as Facebook or a SQL database. 請深入了解 Facebook 與 Power BI 的整合SQL Server 與 Power BI 的整合Learn more at Facebook integration with Power BI and SQL Server integration with Power BI.

在 Power BI Desktop 主視窗中,選取 [常用] 功能區。In the main Power BI Desktop window, select the Home ribbon. 在 [外部資料] 功能區群組中,開啟 [取得資料] 下拉式功能表,然後選取 [文字/CSV]。In the External data group of the ribbon, open the Get Data drop-down menu and select Text/CSV.

[取得資料按鈕]

[開啟] 對話方塊隨即出現。The Open dialog appears. 瀏覽到您的 [下載] 資料夾,或是您下載 FabrikamComments.csv 檔案的資料夾。Navigate to your Downloads folder, or to the folder where you downloaded the FabrikamComments.csv file. 按一下 FabrikamComments.csv,然後按 [開啟] 按鈕。Click FabrikamComments.csv, then the Open button. [CSV 匯入] 對話方塊隨即出現。The CSV import dialog appears.

[CSV 匯入對話方塊]

[CSV 匯入] 對話方塊可讓您確認 Power BI Desktop 是否已正確地偵測到字元集、分隔符號、標題資料列和資料行類型。The CSV import dialog lets you verify that Power BI Desktop has correctly detected the character set, delimiter, header rows, and column types. 此資訊都正確,所以按一下 [載入]。This information is all correct, so click Load.

若要查看載入的資料,請按一下 Power BI 工作區左側邊緣的 [資料檢視] 按鈕。To see the loaded data, click the Data View button on the left edge of the Power BI workspace. 隨即會開啟包含資料的資料表,就和在 Microsoft Excel 中一樣。A table opens that contains the data, like in Microsoft Excel.

[所匯入資料的初始檢視]

準備資料Prepare the data

您可能需要先將 Power BI Desktop 中的資料進行轉換,才能讓資料準備好供文字分析服務的關鍵片語 API 進行處理。You may need to transform your data in Power BI Desktop before it's ready to be processed by the Key Phrases API of the Text Analytics service.

範例資料包含 subject 資料行和 comment 資料行。The sample data contains a subject column and a comment column. 有了 Power BI Desktop 中的「合併資料行」功能,您就可以從這兩個資料行中的資料擷取關鍵片語,而不是只從 comment 資料行。With the Merge Columns function in Power BI Desktop, you can extract key phrases from the data in both these columns, rather than just the comment column.

在 Power BI Desktop 中,選取 [常用] 功能區。In Power BI Desktop, select the Home ribbon. 在 [外部資料] 群組中,按一下 [編輯查詢]。In the External data group, click Edit Queries.

[常用功能區中的外部資料群組]

在視窗左側的 [查詢] 清單中選取 FabrikamComments (如果尚未選取)。Select FabrikamComments in the Queries list at the left side of the window if it isn't already selected.

現在,選取資料表中的 subjectcomment 資料行。Now select both the subject and comment columns in the table. 您可能需要水平捲動才能看到這些資料行。You may need to scroll horizontally to see these columns. 請先按一下 subject 資料行標題,然後按住 Control 鍵並按一下 comment 資料行標題。First click the subject column header, then hold down the Control key and click the comment column header.

[選取要合併的欄位]

選取 [轉換] 功能區。Select the Transform ribbon. 在功能區的 [文字資料行] 群組中,按一下 [合併資料行]。In the Text Columns group of the ribbon, click Merge Columns. [合併資料行] 對話方塊隨即出現。The Merge Columns dialog appears.

[使用合併資料行對話方塊合併欄位]

在 [合併資料行] 對話方塊中,選擇 Tab 作為分隔符號,然後按一下 [確定]。In the Merge Columns dialog, choose Tab as the separator, then click OK.

您也可以考慮使用「移除空白」篩選條件來篩掉空白訊息,或是使用「清理轉換」移除不可列印的字元。You might also consider filtering out blank messages using the Remove Empty filter, or removing unprintable characters using the Clean transformation. 如果資料包含像是檔案範例中 spamscore 資料行的資料行,您可以使用「數字篩選條件」來略過「垃圾」評論。If your data contains a column like the spamscore column in the sample file, you can skip "spam" comments using a Number Filter.

了解 APIUnderstand the API

文字分析服務的關鍵片語 API 可針對每個 HTTP 要求處理多達一千個文字文件。The Key Phrases API of the Text Analytics service can process up to a thousand text documents per HTTP request. Power BI 偏好一次處理一個記錄,所以在此教學課程中,您對 API 的呼叫每次只會包含單一文件。Power BI prefers to deal with records one at a time, so in this tutorial your calls to the API will include only a single document each. 關鍵片語 API 要求所處理的每個文件都必須具有下列欄位。The Key Phrases API requires the following fields for each document being processed.

id 這個文件在要求中的唯一識別碼。A unique identifier for this document within the request. 回應中也會包含此欄位。The response also contains this field. 如此一來,如果您處理多份文件,就可以輕鬆地將擷取到的關鍵片語關聯至其來源文件。That way, if you process more than one document, you can easily associate the extracted key phrases with the document they came from. 在此教學課程中,因為您針對每個要求只會處理一個文件,您可以針對每個要求將 id 的值以硬式編碼設為相同的值。In this tutorial, because you're processing only one document per request, you can hard-code the value of id to be the same for each request.
text 要處理的文字。The text to be processed. 此欄位的值來自您在前一節中建立的 Merged 資料行,其中包含了結合的主旨行與評論文字。The value of this field comes from the Merged column you created in the previous section, which contains the combined subject line and comment text. 關鍵片語 API 要求這項資料的長度不得超過約 5,120 個字元。The Key Phrases API requires this data be no longer than about 5,120 characters.
language 撰寫文件所使用之自然語言的代碼。The code for the natural language the document is written in. 範例資料中的所有訊息都是英文,因此您可以針對此欄位以硬式編碼方式編寫 en 值。All the messages in the sample data are in English, so you can hard-code the value en for this field.

建立自訂函式Create a custom function

現在,您已經準備好建立自訂函式,以整合 Power BI 與文字分析。Now you're ready to create the custom function that will integrate Power BI and Text Analytics. 函式會收到要處理為參數的文字。The function receives the text to be processed as a parameter. 它會將資料轉換為所需的 JSON 格式 (以及反向轉換),並對關鍵片語 API 提出 HTTP 要求。It converts data to and from the required JSON format and makes the HTTP request to the Key Phrases API. 接著,函式會剖析來自 API 的回應並傳回字串,其中包含所擷取關鍵片語的逗點分隔值清單。The function then parses the response from the API and returns a string that contains a comma-separated list of the extracted key phrases.

注意

Power BI Desktop 自訂函式會以 Power Query M 公式語言 (簡稱 "M") 來撰寫。Power BI Desktop custom functions are written in the Power Query M formula language, or just "M" for short. M 是以 F# 為基礎的功能性程式設計語言。M is a functional programming language based on F#. 不過,不是程式設計師也能完成本教學課程;下面有所需的程式碼。You don't need to be a programmer to finish this tutorial, though; the required code is included below.

在 Power BI Desktop 中,確定您仍在 [查詢編輯器] 視窗中。In Power BI Desktop, make sure you're still in the Query Editor window. 如果不是,請選取 [常用] 功能區,按一下 [外部資料] 群組中的 [編輯查詢]。If you aren't, select the Home ribbon, and in the External data group, click Edit Queries.

現在,在 [常用] 功能區的 [新增查詢] 群組中,開啟 [新增來源] 下拉式功能表,並選取 [空白查詢]。Now, in the Home ribbon, in the New Query group, open the New Source drop-down menu and select Blank Query.

[查詢] 清單中會出現新的查詢,一開始名為 Query1A new query, initially named Query1, appears in the Queries list. 按兩下此項目,並將它命名為 KeyPhrasesDouble-click this entry and name it KeyPhrases.

現在,按一下 [常用] 功能區 [查詢] 群組中的 [進階編輯器],以開啟 [進階編輯器] 視窗。Now, in the Home ribbon, in the Query group, click Advanced Editor to open the Advanced Editor window. 刪除該視窗中已有的程式碼,然後貼上下列程式碼。Delete the code that's already in that window and paste in the following code.

注意

下列範例假設文字分析 API 端點是以 https://westus.api.cognitive.microsoft.com 開頭。The examples below assume the Text Analytics API endpoint begins with https://westus.api.cognitive.microsoft.com. 文字分析允許您在 13 個不同區域中建立訂用帳戶。Text Analytics allows you to create a subscription in 13 different regions. 如果您已在不同區域註冊服務,請務必使用所選區域的端點。If you signed up for the service in a different region, please make sure to use the endpoint for the region you selected. 您可以透過登入 Azure 入口網站,選取您的文字分析訂用帳戶,然後選取 [概觀] 頁面來找到此端點。You can find this endpoint by signing in to the Azure portal, selecting your Text Analytics subscription, and selecting the Overview page.

// Returns key phrases from the text in a comma-separated list
(text) => let
    apikey      = "YOUR_API_KEY_HERE",
    endpoint    = "https://westus.api.cognitive.microsoft.com/text/analytics/v2.1/keyPhrases",
    jsontext    = Text.FromBinary(Json.FromValue(Text.Start(Text.Trim(text), 5000))),
    jsonbody    = "{ documents: [ { language: ""en"", id: ""0"", text: " & jsontext & " } ] }",
    bytesbody   = Text.ToBinary(jsonbody),
    headers     = [#"Ocp-Apim-Subscription-Key" = apikey],
    bytesresp   = Web.Contents(endpoint, [Headers=headers, Content=bytesbody]),
    jsonresp    = Json.Document(bytesresp),
    keyphrases  = Text.Lower(Text.Combine(jsonresp[documents]{0}[keyPhrases], ", "))
in  keyphrases

使用您的文字分析存取金鑰取代 YOUR_API_KEY_HEREReplace YOUR_API_KEY_HERE with your Text Analytics access key. 您也可以透過登入 Azure 入口網站、選取您的文字分析訂用帳戶,然後選取 [概觀] 頁面來找到此金鑰。You can also find this key by signing in to the Azure portal, selecting your Text Analytics subscription, and selecting the Overview page. 請務必保留金鑰前後的引號。Be sure to leave the quotation marks before and after the key. 然後按一下 [完成]。Then click Done.

使用自訂函式Use the custom function

現在您可以使用自訂函式,從每個客戶的意見擷取關鍵片語,並將它們儲存在資料表中的新資料行。Now you can use the custom function to extract the key phrases from each of the customer comments and store them in a new column in the table.

在 Power BI Desktop 中,於 [查詢視窗] 中,切換回 FabrikamComments 查詢。In Power BI Desktop, in the Query Editor window, switch back to the FabrikamComments query. 選取 [新增資料行] 功能區。Select the Add Column ribbon. 在 [一般] 群組中,按一下 [叫用自訂函數]。In the General group, click Invoke Custom Function.

[叫用自訂函式按鈕]

[叫用自訂函數] 對話方塊隨即出現。The Invoke Custom Function dialog appears. 在 [新資料行名稱] 中,輸入 keyphrasesIn New column name, enter keyphrases. 在 [函數查詢] 中,選取您建立的自訂函式 KeyPhrasesIn Function query, select the custom function you created, KeyPhrases.

對話方塊中會出現新的欄位 text (optional)A new field appears in the dialog, text (optional). 此欄位是我們要使用哪一個資料行,針對關鍵片語 API 的 text 參數提供值。This field is asking which column we want to use to provide values for the text parameter of the Key Phrases API. (請記住,您已經以硬式編碼方式編寫 languageid 參數的值)。從下拉式功能表選取Merged (我們稍早透過合併主旨與訊息欄位所建立的資料行)。(Remember that you already hard-coded the values for the language and id parameters.) Select Merged (the column you created previously by merging the subject and message fields) from the drop-down menu.

[叫用自訂函式]

最後,按一下 [確定]。Finally, click OK.

如果一切都準備就緒,Power BI 會針對資料表中的每個資料列呼叫您的自訂函式一次。If everything is ready, Power BI calls your custom function once for each row in the table. 它會傳送查詢至關鍵片語 API,並新增新的資料行到資料表來儲存結果。It sends the queries to the Key Phrases API and adds a new column to the table to store the results. 但在開始進行之前,您可能需要指定驗證和隱私權設定。But before that happens, you may need to specify authentication and privacy settings.

驗證和隱私權Authentication and privacy

關閉 [叫用自訂函數] 對話方塊之後,可能會出現橫幅要求您指定如何連線至關鍵片語 API。After you close the Invoke Custom Function dialog, a banner may appear asking you to specify how to connect to the Key Phrases API.

[認證橫幅]

按一下 [編輯認證],確定已在對話方塊中選取 Anonymous,然後按一下 [連線]。Click Edit Credentials, make sure Anonymous is selected in the dialog, then click Connect.

注意

選取 Anonymous 是因為文字分析服務會透過您使用的存取金鑰驗證您的身分,因此 Power BI 不需要為 HTTP 要求本身提供認證。You select Anonymous because the Text Analytics service authenticates you using your access key, so Power BI does not need to provide credentials for the HTTP request itself.

[將驗證設定為匿名]

如果選擇匿名存取之後仍看到 [編輯認證] 橫幅,您可能忘了將文字分析存取金鑰貼入 KeyPhrases 自訂函式的程式碼中。If you see the Edit Credentials banner even after choosing anonymous access, you may have forgotten to paste your Text Analytics access key into the code in the KeyPhrases custom function.

接下來,可能會出現橫幅要求您提供關於資料來源隱私權的資訊。Next, a banner may appear asking you to provide information about your data sources' privacy.

[隱私權橫幅]

按一下 [繼續],然後針對對話方塊中的每個資料來源選擇 PublicClick Continue and choose Public for each of the data sources in the dialog. 然後按一下 [儲存]。Then click Save.

[設定資料來源隱私權]

建立文字雲Create the word cloud

處理好出現的各個橫幅後,按一下 [常用] 功能區中的 [關閉並套用] 以關閉查詢編輯器。Once you have dealt with any banners that appear, click Close & Apply in the Home ribbon to close the Query Editor.

Power BI Desktop 需要一點時間來提出必要的 HTTP 要求。Power BI Desktop takes a moment to make the necessary HTTP requests. 在資料表的每個資料列中,新的 keyphrases 資料行會包含關鍵片語 API 在文字中所偵測到的關鍵片語。For each row in the table, the new keyphrases column contains the key phrases detected in the text by the Key Phrases API.

現在,您將使用此資料行來產生文字雲。Now you'll use this column to generate a word cloud. 若要開始,請按一下工作區左邊 Power BI Desktop 主視窗中的 [報告] 按鈕。To get started, click the Report button in the main Power BI Desktop window, to the left of the workspace.

注意

為何要使用所擷取的關鍵片語來產生文字雲,而不是使用每個評論的完整文字?Why use extracted key phrases to generate a word cloud, rather than the full text of every comment? 關鍵片語可為我們提供客戶評論中的「重要」文字,而不只是「最常見的」文字。The key phrases provide us with the important words from our customer comments, not just the most common words. 此外,在產生的文字雲中,文字大小也不會因為相對少數的評論中頻繁使用某個文字而受到影響。Also, word sizing in the resulting cloud isn't skewed by the frequent use of a word in a relatively small number of comments.

如果您尚未安裝文字雲自訂視覺效果,請加以安裝。If you don't already have the Word Cloud custom visual installed, install it. 在工作區右邊的 [視覺效果] 窗格中,按一下三個點 (...),然後選擇 [從存放區匯入]。In the Visualizations panel to the right of the workspace, click the three dots (...) and choose Import From Store. 然後搜尋「雲」,並按一下文字雲視覺效果旁的 [新增] 按鈕。Then search for "cloud" and click the Add button next the Word Cloud visual. Power BI 會安裝文字雲視覺效果,並讓您知道它已成功安裝。Power BI installs the Word Cloud visual and lets you know that it installed successfully.

[新增自訂視覺效果]

首先,按一下 [視覺效果] 面板中的 [文字雲] 圖示。First, click the Word Cloud icon in the Visualizations panel.

[視覺效果面板中的文字雲圖示]

新的報告隨即出現在工作區中。A new report appears in the workspace. keyphrases 欄位從 [欄位] 面板拖曳至 [視覺效果] 面板的 [類別] 欄位。Drag the keyphrases field from the Fields panel to the Category field in the Visualizations panel. 文字雲會出現在報告中。The word cloud appears inside the report.

現在,切換到 [視覺效果] 面板的 [格式] 頁面。Now switch to the Format page of the Visualizations panel. 在 [停止文字] 類別中,開啟 [預設停止文字] 以從雲端排除常見的簡短文字,例如 "of"。In the Stop Words category, turn on Default Stop Words to eliminate short, common words like "of" from the cloud.

[啟用預設停止文字]

在這個面板中往下一點,關閉 [旋轉文字] 和 [標題]。Down a little further in this panel, turn off Rotate Text and Title.

[啟用焦點模式]

按一下報告中的 [焦點模式] 工具,以便更加了解我們的文字雲。Click the Focus Mode tool in the report to get a better look at our word cloud. 此工具會展開文字雲以填滿整個工作區,如下所示。The tool expands the word cloud to fill the entire workspace, as shown below.

[文字雲]

更多的文字分析服務More Text Analytics services

文字分析服務 (Microsoft Azure 所提供的其中一個認知服務) 也會提供情感分析和語言偵測。The Text Analytics service, one of the Cognitive Services offered by Microsoft Azure, also provides sentiment analysis and language detection. 如果客戶的意見反應並非全是英文,語言偵測便很實用。The language detection in particular is useful if your customer feedback isn't all in English.

這兩個另外的 API 類似關鍵片語 API。Both of these other APIs are similar to the Key Phrases API. 這表示您可以使用幾乎相同於此教學課程中所建立的自訂函式,將它們與 Power BI Desktop 整合。That means you can integrate them with Power BI Desktop using custom functions that are nearly identical to the one you created in this tutorial. 只要建立空白查詢並在 [進階編輯器] 中貼入下列適當的程式碼即可,方法同前。Just create a blank query and paste the appropriate code below into the Advanced Editor, as you did earlier. (別忘了存取金鑰)!然後,同樣地,使用函式在資料表中新增資料行。(Don't forget your access key!) Then, as before, use the function to add a new column to the table.

下面的情感分析函式會傳回分數,以指出文字中所表達的情感有多正面。The Sentiment Analysis function below returns a score indicating how positive the sentiment expressed in the text is.

// Returns the sentiment score of the text, from 0.0 (least favorable) to 1.0 (most favorable)
(text) => let
    apikey      = "YOUR_API_KEY_HERE",
    endpoint    = "https://westus.api.cognitive.microsoft.com/text/analytics/v2.1/sentiment",
    jsontext    = Text.FromBinary(Json.FromValue(Text.Start(Text.Trim(text), 5000))),
    jsonbody    = "{ documents: [ { language: ""en"", id: ""0"", text: " & jsontext & " } ] }",
    bytesbody   = Text.ToBinary(jsonbody),
    headers     = [#"Ocp-Apim-Subscription-Key" = apikey],
    bytesresp   = Web.Contents(endpoint, [Headers=headers, Content=bytesbody]),
    jsonresp    = Json.Document(bytesresp),
    sentiment   = jsonresp[documents]{0}[score]
in  sentiment

以下是語言偵測函式的兩個版本。Here are two versions of a Language Detection function. 第一個版本會傳回 ISO 語言代碼 (例如 en 代表英文),第二個版本則會傳回「易記」名稱 (例如 English)。The first returns the ISO language code (for example, en for English), while the second returns the "friendly" name (for example, English). 您可能會注意到,兩個版本之間只有內文的最後一行不同。You may notice that only the last line of the body differs between the two versions.

// Returns the two-letter language code (for example, 'en' for English) of the text
(text) => let
    apikey      = "YOUR_API_KEY_HERE",
    endpoint    = "https://westus.api.cognitive.microsoft.com/text/analytics/v2.1/languages",
    jsontext    = Text.FromBinary(Json.FromValue(Text.Start(Text.Trim(text), 5000))),
    jsonbody    = "{ documents: [ { id: ""0"", text: " & jsontext & " } ] }",
    bytesbody   = Text.ToBinary(jsonbody),
    headers     = [#"Ocp-Apim-Subscription-Key" = apikey],
    bytesresp   = Web.Contents(endpoint, [Headers=headers, Content=bytesbody]),
    jsonresp    = Json.Document(bytesresp),
    language    = jsonresp[documents]{0}[detectedLanguages]{0}[iso6391Name]
in  language
// Returns the name (for example, 'English') of the language in which the text is written
(text) => let
    apikey      = "YOUR_API_KEY_HERE",
    endpoint    = "https://westus.api.cognitive.microsoft.com/text/analytics/v2.1/languages",
    jsontext    = Text.FromBinary(Json.FromValue(Text.Start(Text.Trim(text), 5000))),
    jsonbody    = "{ documents: [ { id: ""0"", text: " & jsontext & " } ] }",
    bytesbody   = Text.ToBinary(jsonbody),
    headers     = [#"Ocp-Apim-Subscription-Key" = apikey],
    bytesresp   = Web.Contents(endpoint, [Headers=headers, Content=bytesbody]),
    jsonresp    = Json.Document(bytesresp),
    language    = jsonresp[documents]{0}[detectedLanguages]{0}[name]
in  language

最後,以下是已提出的關鍵片語函式變化,其會以清單物件的形式傳回片語,而不是以逗號分隔片語單一字串的形式傳回。Finally, here's a variant of the Key Phrases function already presented that returns the phrases as a list object, rather than as a single string of comma-separated phrases.

注意

傳回單一字串簡化了我們的文字雲範例。Returning a single string simplified our word cloud example. 另一方面,清單則是更有彈性的格式,可處理 Power BI 中所傳回的片語。A list, on the other hand, is a more flexible format for working with the returned phrases in Power BI. 您可以使用查詢編輯器 [轉換] 功能區中的 [結構化資料行] 群組,以處理 Power BI Desktop 中的清單物件。You can manipulate list objects in Power BI Desktop using the Structured Column group in the Query Editor's Transform ribbon.

// Returns key phrases from the text as a list object
(text) => let
    apikey      = "YOUR_API_KEY_HERE",
    endpoint    = "https://westus.api.cognitive.microsoft.com/text/analytics/v2.1/keyPhrases",
    jsontext    = Text.FromBinary(Json.FromValue(Text.Start(Text.Trim(text), 5000))),
    jsonbody    = "{ documents: [ { language: ""en"", id: ""0"", text: " & jsontext & " } ] }",
    bytesbody   = Text.ToBinary(jsonbody),
    headers     = [#"Ocp-Apim-Subscription-Key" = apikey],
    bytesresp   = Web.Contents(endpoint, [Headers=headers, Content=bytesbody]),
    jsonresp    = Json.Document(bytesresp),
    keyphrases  = jsonresp[documents]{0}[keyPhrases]
in  keyphrases

後續步驟Next steps

深入了解文字分析服務、Power Query M 公式語言或 Power BI。Learn more about the Text Analytics service, the Power Query M formula language, or Power BI.