Skip to content

Commit

Permalink
feat: TextAnalytics SDK connector POC
Browse files Browse the repository at this point in the history
Co-authored-by: Assaf Israel <assafi@microsoft.com>
Co-authored-by: Assaf Israel <assaf.israel@microsoft.com>
Co-authored-by: Samantha Konigsberg <t-samanthak@microsoft.com>
Co-authored-by: victoriajmicrosoft <victoriajmicrosoft@users.noreply.github.com>
Co-authored-by: Suhas Mehta <suhas.mehta@microsoft.com>
Co-authored-by: Preeti Pidatala <t-ppidatala@microsoft.com>
  • Loading branch information
6 people authored and mhamilton723 committed Jan 5, 2022
1 parent fc76deb commit 4845c31
Show file tree
Hide file tree
Showing 12 changed files with 1,042 additions and 25 deletions.
4 changes: 3 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ val excludes = Seq(
)

val coreDependencies = Seq(
"com.fasterxml.jackson.module" %% "jackson-module-scala" % "2.12.3",
"org.apache.spark" %% "spark-core" % sparkVersion % "compile",
"org.apache.spark" %% "spark-mllib" % sparkVersion % "compile",
"org.apache.spark" %% "spark-avro" % sparkVersion % "provided",
Expand Down Expand Up @@ -312,7 +313,8 @@ lazy val cognitive = (project in file("cognitive"))
libraryDependencies ++= Seq(
"com.microsoft.cognitiveservices.speech" % "client-sdk" % "1.14.0",
"com.azure" % "azure-storage-blob" % "12.8.0", // can't upgrade higher due to conflict with jackson-databind
),
"com.azure" % "azure-ai-textanalytics" % "5.1.4",
),
resolvers += speechResolver,
name := "synapseml-cognitive"
): _*)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ trait HasSetLocation extends Wrappable with HasURL with HasUrlPath {
}

abstract class CognitiveServicesBaseNoHandler(val uid: String) extends Transformer
with HTTPParams with HasOutputCol
with ConcurrencyParams with HasOutputCol
with HasURL with ComplexParamsWritable
with HasSubscriptionKey with HasErrorCol with BasicLogging {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ trait MADHttpRequest extends HasURL with HasSubscriptionKey with HasAsyncReply {

trait MADBase extends HasOutputCol
with MADHttpRequest with HasSetLocation with HasInputCols
with HTTPParams with ComplexParamsWritable with Wrappable
with ConcurrencyParams with ComplexParamsWritable with Wrappable
with HasSubscriptionKey with HasErrorCol with BasicLogging {

val startTime = new Param[String](this, "startTime", "A required field, start time" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,8 @@ import java.net.URI
import java.util
import scala.collection.JavaConverters._

abstract class TextAnalyticsBase(override val uid: String) extends CognitiveServicesBaseNoHandler(uid)
with HasCognitiveServiceInput with HasInternalJsonOutputParser with HasSetLocation
with HasSetLinkedService {

trait TextAnalyticsInputParams extends HasServiceParams {
val text = new ServiceParam[Seq[String]](this, "text", "the text in the request body", isRequired = true)

def setTextCol(v: String): this.type = setVectorParam(text, v)
Expand All @@ -48,7 +46,13 @@ abstract class TextAnalyticsBase(override val uid: String) extends CognitiveServ

def setLanguage(v: String): this.type = setScalarParam(language, Seq(v))

setDefault(language -> Left(Seq("en")))
//setDefault(language -> Left(Seq("en")))

}

abstract class TextAnalyticsBase(override val uid: String) extends CognitiveServicesBaseNoHandler(uid)
with HasCognitiveServiceInput with HasInternalJsonOutputParser with HasSetLocation
with HasSetLinkedService with TextAnalyticsInputParams {

protected def innerResponseDataType: StructType =
responseDataType("documents").dataType match {
Expand Down
Loading

0 comments on commit 4845c31

Please sign in to comment.