Skip to content

Commit 1517d80

Browse files
Review main-notebooks/conversational_field_extraction.ipynb [Checked] (#54)
1 parent b1f1b8c commit 1517d80

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

notebooks/conversational_field_extraction.ipynb

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,22 @@
44
"cell_type": "markdown",
55
"metadata": {},
66
"source": [
7-
"# Extract Custom Fields from Your Pretranscribed File"
7+
"# Extract Custom Fields from Your Pre-transcribed File"
88
]
99
},
1010
{
1111
"cell_type": "markdown",
1212
"metadata": {},
1313
"source": [
14-
"This notebook demonstrates how to use analyzers to extract custom fields from your transcription input files."
14+
"This notebook demonstrates how to use analyzers to extract custom fields from your pre-transcribed input files."
1515
]
1616
},
1717
{
1818
"cell_type": "markdown",
1919
"metadata": {},
2020
"source": [
2121
"## Prerequisites\n",
22-
"1. Ensure Azure AI service is configured following [steps](../README.md#configure-azure-ai-service-resource)\n",
22+
"1. Ensure your Azure AI service is configured by following the [configuration steps](../README.md#configure-azure-ai-service-resource).\n",
2323
"2. Install the required packages to run the sample."
2424
]
2525
},
@@ -45,7 +45,7 @@
4545
"source": [
4646
"Below is a collection of analyzer templates designed to extract fields from various input file types.\n",
4747
"\n",
48-
"These templates are highly customizable, allowing you to modify them to suit your specific needs. For additional verified templates from Microsoft, please visit [here](../analyzer_templates/README.md)."
48+
"These templates are highly customizable, allowing you to adapt them to your specific requirements. For additional verified templates provided by Microsoft, please visit [here](../analyzer_templates/)."
4949
]
5050
},
5151
{
@@ -65,7 +65,7 @@
6565
"cell_type": "markdown",
6666
"metadata": {},
6767
"source": [
68-
"Specify the analyzer template you want to use and provide a name for the analyzer to be created based on the template."
68+
"Specify the analyzer template to use and assign a unique name for the analyzer that will be created from the template."
6969
]
7070
},
7171
{
@@ -88,14 +88,16 @@
8888
"source": [
8989
"## Create Azure AI Content Understanding Client\n",
9090
"\n",
91-
"> The [AzureContentUnderstandingClient](../python/content_understanding_client.py) is a utility class containing functions to interact with the Content Understanding API. Before the official release of the Content Understanding SDK, it can be regarded as a lightweight SDK. Fill the constant **AZURE_AI_ENDPOINT**, **AZURE_AI_API_VERSION**, **AZURE_AI_API_KEY** with the information from your Azure AI Service.\n",
91+
"> The [AzureContentUnderstandingClient](../python/content_understanding_client.py) is a utility class providing functions to interact with the Content Understanding API. Before the official release of the Content Understanding SDK, this class can be considered a lightweight SDK.\n",
92+
"\n",
93+
"> Fill in the constants **AZURE_AI_ENDPOINT**, **AZURE_AI_API_VERSION**, and **AZURE_AI_API_KEY** with your Azure AI Service credentials.\n",
9294
"\n",
9395
"> ⚠️ Important:\n",
94-
"You must update the code below to match your Azure authentication method.\n",
96+
"Make sure to update the code below to match your chosen Azure authentication method.\n",
9597
"Look for the `# IMPORTANT` comments and modify those sections accordingly.\n",
96-
"If you skip this step, the sample may not run correctly.\n",
98+
"Skipping this step may prevent the sample from running correctly.\n",
9799
"\n",
98-
"> ⚠️ Note: Using a subscription key works, but using a token provider with Azure Active Directory (AAD) is much safer and is highly recommended for production environments."
100+
"> ⚠️ Note: While subscription key authentication works, it is strongly recommended to use a token provider with Azure Active Directory (AAD) for improved security in production environments."
99101
]
100102
},
101103
{
@@ -115,13 +117,13 @@
115117
"load_dotenv(find_dotenv())\n",
116118
"logging.basicConfig(level=logging.INFO)\n",
117119
"\n",
118-
"# For authentication, you can use either token-based auth or subscription key, and only one of them is required\n",
120+
"# For authentication, you may use either token-based auth or a subscription key; only one is required.\n",
119121
"AZURE_AI_ENDPOINT = os.getenv(\"AZURE_AI_ENDPOINT\")\n",
120-
"# IMPORTANT: Replace with your actual subscription key or set up in \".env\" file if not using token auth\n",
122+
"# IMPORTANT: Replace with your actual subscription key or configure it in the \".env\" file if not using token authentication.\n",
121123
"AZURE_AI_API_KEY = os.getenv(\"AZURE_AI_API_KEY\")\n",
122124
"AZURE_AI_API_VERSION = os.getenv(\"AZURE_AI_API_VERSION\", \"2025-05-01-preview\")\n",
123125
"\n",
124-
"# Add the parent directory to the path to use shared modules\n",
126+
"# Add the parent directory to the system path to access shared modules\n",
125127
"parent_dir = Path(Path.cwd()).parent\n",
126128
"sys.path.append(str(parent_dir))\n",
127129
"from python.content_understanding_client import AzureContentUnderstandingClient\n",
@@ -134,9 +136,9 @@
134136
" api_version=AZURE_AI_API_VERSION,\n",
135137
" # IMPORTANT: Comment out token_provider if using subscription key\n",
136138
" token_provider=token_provider,\n",
137-
" # IMPORTANT: Uncomment this if using subscription key\n",
139+
" # IMPORTANT: Uncomment the following line if using subscription key\n",
138140
" # subscription_key=AZURE_AI_API_KEY,\n",
139-
" # x_ms_useragent=\"azure-ai-content-understanding-python/field_extraction\", # This header is used for sample usage telemetry, please comment out this line if you want to opt out.\n",
141+
" # x_ms_useragent=\"azure-ai-content-understanding-python/field_extraction\", # This header is used for sample usage telemetry. Please comment out if you want to opt out.\n",
140142
")"
141143
]
142144
},
@@ -170,7 +172,7 @@
170172
"cell_type": "markdown",
171173
"metadata": {},
172174
"source": [
173-
"After the analyzer is successfully created, we can use it to analyze our input files."
175+
"Once the analyzer is successfully created, you can use it to analyze your input files."
174176
]
175177
},
176178
{
@@ -181,14 +183,14 @@
181183
"source": [
182184
"from python.extension.transcripts_processor import TranscriptsProcessor\n",
183185
"\n",
184-
"test_file_path=analyzer_sample_file_path\n",
186+
"test_file_path = analyzer_sample_file_path\n",
185187
"\n",
186188
"transcripts_processor = TranscriptsProcessor()\n",
187189
"webvtt_output, webvtt_output_file_path = transcripts_processor.convert_file(test_file_path)\n",
188190
"\n",
189191
"if \"WEBVTT\" not in webvtt_output:\n",
190192
" print(\"Error: The output is not in WebVTT format.\")\n",
191-
"else: \n",
193+
"else:\n",
192194
" response = client.begin_analyze(CUSTOM_ANALYZER_ID, file_location=webvtt_output_file_path)\n",
193195
" print(\"Response:\", response)\n",
194196
" result_json = client.poll_result(response)\n",
@@ -201,7 +203,7 @@
201203
"metadata": {},
202204
"source": [
203205
"## Clean Up\n",
204-
"Optionally, delete the sample analyzer from your resource. In typical usage scenarios, you would analyze multiple files using the same analyzer."
206+
"Optionally, delete the sample analyzer from your Azure resource. In typical usage scenarios, you would analyze multiple files using the same analyzer."
205207
]
206208
},
207209
{

0 commit comments

Comments
 (0)