Skip to content

Commit

Permalink
Fix error message in batch samples (Azure#9634)
Browse files Browse the repository at this point in the history
* fix error message

* move print doc info
  • Loading branch information
maririos authored Jan 27, 2020
1 parent af976ca commit 461dcf2
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,11 @@ public void DetectLanguageBatchConvenience()
DetectLanguageResultCollection results = client.DetectLanguages(inputs);
#endregion

Debug.WriteLine($"Detected languages are:");
int i = 0;
foreach (DetectLanguageResult result in results)
{
Debug.WriteLine($" {result.PrimaryLanguage.Name}, with confidence {result.PrimaryLanguage.Score:0.00}.");
Debug.WriteLine($"On document {inputs[i++]}:");
Debug.WriteLine($"Detected language: {result.PrimaryLanguage.Name}, with confidence {result.PrimaryLanguage.Score:0.00}.");
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,11 @@ public void AnalyzeSentimentBatch()
{
TextDocumentInput document = inputs[i++];

Debug.WriteLine($"On document (Id={document.Id}, Language=\"{document.Language}\", Text=\"{document.Text}\"):");

if (result.ErrorMessage != default)
{
Debug.WriteLine($"On document (Id={document.Id}, Language=\"{document.Language}\", Text=\"{document.Text}\"):");
Debug.WriteLine($"Document error: {result.ErrorMessage}.");
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void ExtractKeyPhrasesBatch()

if (result.ErrorMessage != default)
{
Debug.WriteLine($"On document (Id={document.Id}, Language=\"{document.Language}\", Text=\"{document.Text}\"):");
Debug.WriteLine($"Document error: {result.ErrorMessage}.");
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void RecognizePiiEntitiesBatch()

if (result.ErrorMessage != default)
{
Debug.WriteLine($"On document (Id={document.Id}, Language=\"{document.Language}\", Text=\"{document.Text}\"):");
Debug.WriteLine($"Document error: {result.ErrorMessage}.");
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void ExtractEntityLinkingBatch()

if (result.ErrorMessage != default)
{
Debug.WriteLine($"On document (Id={document.Id}, Language=\"{document.Language}\", Text=\"{document.Text}\"):");
Debug.WriteLine($"Document error: {result.ErrorMessage}.");
}
else
{
Expand Down

0 comments on commit 461dcf2

Please sign in to comment.