-
Notifications
You must be signed in to change notification settings - Fork 825
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add TextAnalyze transformer to add support for Text Analytics `…
…/analyze` endpoint (#1267) * Initial implementation work * Avoid using fixed task result to determine document count * Add options for TextAnalyze tasks to run * Add example notebook for TextAnalyze * fix style * Fix typo in build helpers * chore: some TA spring cleaning * minor rename of notebook
- Loading branch information
1 parent
3898ad9
commit 6ea8a9a
Showing
10 changed files
with
710 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
313 changes: 267 additions & 46 deletions
313
cognitive/src/main/scala/com/microsoft/azure/synapse/ml/cognitive/TextAnalytics.scala
Large diffs are not rendered by default.
Oops, something went wrong.
68 changes: 68 additions & 0 deletions
68
...src/main/scala/com/microsoft/azure/synapse/ml/cognitive/TextAnalyticsAnalyzeSchemas.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
// Copyright (C) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See LICENSE in project root for information. | ||
|
||
package com.microsoft.azure.synapse.ml.cognitive | ||
|
||
import com.microsoft.azure.synapse.ml.core.schema.SparkBindings | ||
|
||
// Text Analytics /analyze endpoint schemas | ||
|
||
case class TAAnalyzeAnalysisInput(documents: Seq[TADocument]) | ||
|
||
object TAAnalyzeAnalysisInput extends SparkBindings[TAAnalyzeAnalysisInput] | ||
|
||
case class TAAnalyzeTask(parameters: Map[String, String]) | ||
|
||
object TAAnalyzeTask extends SparkBindings[TAAnalyzeTask] | ||
|
||
case class TAAnalyzeTasks(entityRecognitionTasks: Seq[TAAnalyzeTask], | ||
entityLinkingTasks: Seq[TAAnalyzeTask], | ||
entityRecognitionPiiTasks: Seq[TAAnalyzeTask], | ||
keyPhraseExtractionTasks: Seq[TAAnalyzeTask], | ||
sentimentAnalysisTasks: Seq[TAAnalyzeTask]) | ||
|
||
object TAAnalyzeTasks extends SparkBindings[TAAnalyzeTasks] | ||
|
||
case class TAAnalyzeRequest(displayName: String, | ||
analysisInput: TAAnalyzeAnalysisInput, | ||
tasks: TAAnalyzeTasks) | ||
|
||
object TAAnalyzeRequest extends SparkBindings[TAAnalyzeRequest] | ||
|
||
|
||
case class TAAnalyzeResponseTaskResults[T](documents: Seq[T], | ||
errors: Seq[TAError], | ||
modelVersion: String) | ||
|
||
case class TAAnalyzeResponseTask[T](state: String, | ||
results: TAAnalyzeResponseTaskResults[T]) | ||
|
||
case class TAAnalyzeResponseTasks(completed: Int, | ||
failed: Int, | ||
inProgress: Int, | ||
total: Int, | ||
entityRecognitionTasks: Option[Seq[TAAnalyzeResponseTask[NERDocV3]]], | ||
entityLinkingTasks: Option[Seq[TAAnalyzeResponseTask[DetectEntitiesScoreV3]]], | ||
entityRecognitionPiiTasks: Option[Seq[TAAnalyzeResponseTask[PIIDocV3]]], | ||
keyPhraseExtractionTasks: Option[Seq[TAAnalyzeResponseTask[KeyPhraseScoreV3]]], | ||
sentimentAnalysisTasks: Option[Seq[TAAnalyzeResponseTask[SentimentScoredDocumentV3]]] | ||
) | ||
|
||
// API call response | ||
case class TAAnalyzeResponse(status: String, | ||
errors: Option[Seq[TAError]], | ||
displayName: String, | ||
tasks: TAAnalyzeResponseTasks) | ||
|
||
object TAAnalyzeResponse extends SparkBindings[TAAnalyzeResponse] | ||
|
||
case class TAAnalyzeResultTaskResults[T](result: Option[T], | ||
error: Option[TAError]) | ||
|
||
case class TAAnalyzeResult(entityRecognition: Option[Seq[TAAnalyzeResultTaskResults[NERDocV3]]], | ||
entityLinking: Option[Seq[TAAnalyzeResultTaskResults[DetectEntitiesScoreV3]]], | ||
entityRecognitionPii: Option[Seq[TAAnalyzeResultTaskResults[PIIDocV3]]], | ||
keyPhraseExtraction: Option[Seq[TAAnalyzeResultTaskResults[KeyPhraseScoreV3]]], | ||
sentimentAnalysis: Option[Seq[TAAnalyzeResultTaskResults[SentimentScoredDocumentV3]]]) | ||
|
||
object TAAnalyzeResults extends SparkBindings[TAAnalyzeResult] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.