分類文字
定義可用來分類文件中文字的種類。
本主題說明如何分類文字。 如果您想要分類文件,請使用「內容採礦」應用程式。 如需詳細資訊,請參閱 分類器類型。
新增文字分類器,以將集合中文件的文字指派給種類。Discovery 使用您提供的標籤和文字範例來預測集合中的文字種類。
若要建立文字分類器,請完成下列步驟:
-
建立 CSV 檔,其中包含範例文字,後面接著每一行的種類標籤。
CSV 檔必須採用 UTF-8 編碼格式,且必須符合下列需求:
-
格式必須是
text,label。text是範例文字,而label是類別名稱。新增完整句子作為文字項目。 請勿在 CSV 檔中包含任何空白行。
如果需要在
text欄中的句子套用多個標籤,您可以新增更多label欄。 例如,text,label,label。 -
檔案必須至少有兩列,且沒有標頭。
-
針對您要定義的每一個種類,新增 10 個以上的項目。 每個種類所需的項目數下限為 3。 您為每一個種類提供的範例越多,分類器就越能預測集合中其他內容的種類。
下列範例是定義兩個種類 (名為
facility_temperature和catering) 的 CSV 檔。 範例文字包含來自會議與會者的意見。The rooms were too cold.,facility_temperature Breakfast did not include gluten-free options.,catering The rooms were too warm.,facility_temperature I was very comfortable in the session rooms.,facility_temperature The awards dinner was delicious.,catering Coffee ran out during one of the breaks.,catering The temperature was not comfortable.,facility_temperature I was very happy with the selection at lunch.,catering It was nice that you provided tea and coffee. Tea drinkers are often ignored.,catering Can you turn up the air conditioning? I was very warm.,facility_temperature My teeth were chattering because I was so cold.,facility_temperature The speaker left the room to find someone to adjust the temperature.,facility_temperature Would you consider an all-vegan menu next year?,catering I would like lemonade and iced tea to be served during the breaks.,catering The lunch staff was excellent.,catering Appreciated the fresh blueberry muffins at breakfast.,catering The hotel staff adjusted the temperature in my session room as soon as I asked. Excellent service!,facility_temperature Every meal was delicious and there was something for everyone.,catering The seats under the skylights were not comfortable. Too hot.,facility_temperature I was comfortable everywhere in the conference center. I never needed my emergency sweater.,facility_temperature -
-
從「改善工具」畫面的 變更網域概念 區段中,然後按一下 文字分類器。
-
按一下上傳。
-
指定分類器的名稱,然後選擇 CSV 檔案中使用的語言。
-
按一下 上傳,以瀏覽並找出您先前建立的 CSV 檔。
-
按一下建立。
分類器強化會根據您提供的訓練資料來建立。
-
選擇您要套用文字分類器強化的集合及欄位,然後按一下 套用。
下列範例顯示使用範例 CSV 檔作為其訓練資料所建立的強化如何將文件中的文字分類。 在輸出中,分類器強化會將 facility_temperature 標籤套用至文件文字。 label 儲存在 enriched_{field_name} 陣列中的 classes 陣列內。
{
"enriched_text": [
{
"classes": [
{
"confidence": 0.999692440032959,
"label": "facility_temperature"
}
]
}
],
"text": [
"I think more attendees would stay awake in the sessions if the rooms were colder."
]
}
分類器類型
您從 Discovery 使用者介面新增的分類器是 文字分類器。 文字分類器可以根據從內文文字中擷取的單字及詞組,並將其詞性資訊納入考量,來分類文件。
您只能從已部署的「內容採礦」應用程式建立另一個分類器類型 文件分類器。 文件分類器可以根據從內文文字欄位中擷取的單字及詞組,以及來自其詞性的資訊,以及套用至納入考量的內文文字的其他強化,來分類文件。 也會使用其他非內文欄位中的資訊。
您可以將文件分類器套用至非「內容採礦」專案之專案類型中的集合。 若要這樣做,您必須在已部署的「內容採礦」應用程式中建立分類器並匯出它。 然後,您可以匯入分類器,並將它作為強化套用至您的集合。 如需相關資訊,請參閱 建立及套用文件分類器。
不論 Part of Speech 強化是否套用至專案,文字分類器都會使用 Part of Speech 資訊。
您新增至一個專案的文字分類器可供其他專案使用,包括「內容採礦」專案。
文字分類器不會分類信任評分低於 0.5的目標文字欄位。 您無法變更文字分類器使用的信任臨界值。 如果您預期將未分類的特定類型段落,則可以將具有類似性質的段落新增至訓練資料,並訓練另一個分類器。
文字分類器限制
您可以為每個服務實例建立的文字分類器和標籤數目取決於 Discovery 方案類型。
| 限制 | 增強 | 企業 | 進階 | Cloud Pak for Data |
|---|---|---|---|---|
| 每個服務實例的文字分類器數目 | 5 | 20 | 20 | 無限制 |
| 含標籤的資料列數 | 2,000 | 20,000 | 20,000 | 20,000 |
| 強化之後訓練資料的大小上限 (MB) | 16 | 1,024 | 1,024 | 1,024 |
| 標籤數目 | 100 | 1,000 家 | 1,000 家 | 1,000 家 |