forked from JohnSnowLabs/spark-nlp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
182 lines (141 loc) · 5.86 KB
/
build.sbt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
import sbtassembly.MergeStrategy
val sparkVer = "2.3.0"
val scalaVer = "2.11.12"
val scalaTestVersion = "3.0.0"
/** Package attributes */
name := "spark-nlp"
organization := "com.johnsnowlabs.nlp"
version := "1.6.0"
scalaVersion in ThisBuild := scalaVer
sparkVersion in ThisBuild := sparkVer
/** Spark-Package attributes */
spName in ThisBuild := "JohnSnowLabs/spark-nlp"
sparkComponents in ThisBuild ++= Seq("mllib")
licenses += "Apache-2.0" -> url("http://opensource.org/licenses/Apache-2.0")
spIncludeMaven := false
spAppendScalaVersion := false
resolvers in ThisBuild += "Maven Central" at "http://central.maven.org/maven2/"
assemblyOption in assembly := (assemblyOption in assembly).value.copy(
includeScala = false
)
credentials += Credentials(Path.userHome / ".ivy2" / ".sbtcredentials")
ivyScala := ivyScala.value map {
_.copy(overrideScalaVersion = true)
}
/** Bintray settings */
bintrayPackageLabels := Seq("nlp", "nlu",
"natural-language-processing", "natural-language-understanding",
"spark", "spark-ml", "pyspark", "machine-learning",
"named-entity-recognition", "sentiment-analysis", "lemmatizer", "spell-checker",
"tokenizer", "stemmer", "part-of-speech-tagger", "annotation-framework")
bintrayRepository := "spark-nlp"
bintrayOrganization := Some("johnsnowlabs")
sonatypeProfileName := "com.johnsnowlabs"
publishTo := Some(
if (isSnapshot.value)
Opts.resolver.sonatypeSnapshots
else
Opts.resolver.sonatypeStaging
)
homepage := Some(url("https://nlp.johnsnowlabs.com"))
scmInfo := Some(
ScmInfo(
url("https://github.com/JohnSnowLabs/spark-nlp"),
"scm:[email protected]:JohnSnowLabs/spark-nlp.git"
)
)
developers := List(
Developer(id="saifjsl", name="Saif Addin", email="[email protected]", url=url("https://github.com/saifjsl")),
Developer(id="showy", name="Eduardo Muñoz", email="[email protected]", url=url("https://github.com/showy")),
Developer(id="aleksei-ai", name="Aleksei Alekseev", email="[email protected]", url=url("https://github.com/aleksei-ai")),
Developer(id="albertoandreottiATgmail", name="Alberto Andreotti", email="[email protected]", url=url("https://github.com/albertoandreottiATgmail")),
Developer(id="danilojsl", name="Danilo Burbano", email="[email protected]", url=url("https://github.com/danilojsl"))
)
lazy val ocrDependencies = Seq(
"org.apache.pdfbox" % "pdfbox" % "2.0.9",
"net.sourceforge.tess4j" % "tess4j" % "4.0.2" exclude("org.slf4j", "slf4j-log4j12") exclude("org.apache.logging", "log4j"),
"org.apache.pdfbox" % "jbig2-imageio" % "3.0.1"
)
lazy val analyticsDependencies = Seq(
"org.apache.spark" %% "spark-core" % sparkVer % "provided",
"org.apache.spark" %% "spark-mllib" % sparkVer % "provided"
)
lazy val testDependencies = Seq(
"org.scalatest" %% "scalatest" % scalaTestVersion % "test"
)
lazy val utilDependencies = Seq(
"com.typesafe" % "config" % "1.3.0",
"org.rocksdb" % "rocksdbjni" % "5.1.4",
"com.amazonaws" % "aws-java-sdk" % "1.7.4"
exclude("com.fasterxml.jackson.core", "jackson-core")
exclude("com.fasterxml.jackson.core", "jackson-annotations")
exclude("com.fasterxml.jackson.core", "jackson-databind")
exclude("com.fasterxml.jackson.dataformat", "jackson-dataformat-smile")
exclude("com.fasterxml.jackson.datatype", "jackson-datatype-joda"),
"org.tensorflow" % "tensorflow" % "1.8.0"
/** Enable the following for tensorflow GPU support */
//"org.tensorflow" % "libtensorflow" % "1.8.0",
//"org.tensorflow" % "libtensorflow_jni_gpu" % "1.8.0",
)
lazy val root = (project in file("."))
.settings(
libraryDependencies ++=
analyticsDependencies ++
testDependencies ++
utilDependencies
)
val ocrMergeRules: String => MergeStrategy = {
case "versionchanges.txt" => MergeStrategy.discard
case "StaticLoggerBinder" => MergeStrategy.discard
case PathList("META-INF", fileName)
if List("NOTICE", "MANIFEST.MF", "DEPENDENCIES", "INDEX.LIST").contains(fileName) || fileName.endsWith(".txt")
=> MergeStrategy.discard
case PathList("META-INF", "services", _ @ _*) => MergeStrategy.first
case PathList("META-INF", xs @ _*) => MergeStrategy.first
case PathList("org", "apache", _ @ _*) => MergeStrategy.first
case PathList("apache", "commons", "logging", "impl", xs @ _*) => MergeStrategy.discard
case _ => MergeStrategy.deduplicate
}
assemblyMergeStrategy in assembly := {
case PathList("com.fasterxml.jackson") => MergeStrategy.first
case x =>
val oldStrategy = (assemblyMergeStrategy in assembly).value
oldStrategy(x)
}
lazy val ocr = (project in file("ocr"))
.settings(
name := "spark-nlp-ocr",
version := "1.6.0",
libraryDependencies ++= ocrDependencies ++
analyticsDependencies ++
testDependencies,
assemblyMergeStrategy in assembly := ocrMergeRules
)
.dependsOn(root % "test")
parallelExecution in Test := false
logBuffered in Test := false
scalacOptions ++= Seq(
"-feature",
"-language:implicitConversions"
)
/** Enable for debugging */
testOptions in Test += Tests.Argument("-oF")
/** Disables tests in assembly */
test in assembly := {}
/** Publish test artificat **/
publishArtifact in Test := true
/** Copies the assembled jar to the pyspark/lib dir **/
lazy val copyAssembledJar = taskKey[Unit]("Copy assembled jar to pyspark/lib")
lazy val copyAssembledOcrJar = taskKey[Unit]("Copy assembled jar to pyspark/lib")
copyAssembledJar := {
val jarFilePath = (assemblyOutputPath in assembly).value
val newJarFilePath = baseDirectory( _ / "python" / "lib" / "sparknlp.jar").value
IO.copyFile(jarFilePath, newJarFilePath)
println(s"[info] $jarFilePath copied to $newJarFilePath ")
}
copyAssembledOcrJar := {
val jarFilePath = (assemblyOutputPath in assembly in "ocr").value
val newJarFilePath = baseDirectory( _ / "python" / "lib" / "sparknlp-ocr.jar").value
IO.copyFile(jarFilePath, newJarFilePath)
println(s"[info] $jarFilePath copied to $newJarFilePath ")
}