File tree Expand file tree Collapse file tree 3 files changed +30
-1
lines changed
src/main/scala/com/sparklingpandas/sparklingml/feature Expand file tree Collapse file tree 3 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ libraryDependencies ++= Seq(
3636 " com.lucidworks.spark" % " spark-solr" % " 3.0.2" ,
3737 // internals
3838 " org.scala-lang" % " scala-reflect" % " 2.11.7" ,
39+ " org.reflections" % " reflections" % " 0.9.11" ,
3940 // testing libraries
4041 " org.scalatest" %% " scalatest" % " 3.0.1" ,
4142 " org.scalacheck" %% " scalacheck" % " 1.13.4" ,
Original file line number Diff line number Diff line change 1- package com .sparklingpandas .sparklingml
1+ package com .sparklingpandas .sparklingml . feature
22
33import org .apache .spark .annotation .DeveloperApi
44import org .apache .spark .ml .UnaryTransformer
Original file line number Diff line number Diff line change 1+ package com .sparklingpandas .sparklingml .feature
2+
3+ import org .apache .spark .annotation .DeveloperApi
4+
5+ import org .apache .lucene .analysis .Analyzer
6+
7+ @ DeveloperApi
8+ object LuceneAnalyzerGenerators {
9+ def generate () = {
10+ import org .reflections .Reflections
11+ import collection .JavaConverters ._
12+ import scala .reflect .runtime .universe ._
13+ val reflections = new Reflections (" org.apache.lucene" );
14+ val analyzers = reflections.getSubTypesOf(classOf [org.apache.lucene.analysis.Analyzer ])
15+ val rm = scala.reflect.runtime.currentMirror
16+ val generated = analyzers.asScala.map{ cls =>
17+ val constructors = rm.classSymbol(cls).toType.members.collect{
18+ case m : MethodSymbol if m.isConstructor && m.isPublic => m }
19+ // Since this isn't built with -parameters by default :(
20+ // we'd need a local version built with it to auto generate
21+ // the code here with the right parameters.
22+ // https://docs.oracle.com/javase/tutorial/reflect/member/methodparameterreflection.html
23+ // For now we could dump the class names and go from their
24+ // or we could play a game of pin the field on the constructor.
25+ // local build sounds like the best plan, lets do that l8r
26+ }
27+ }
28+ }
You can’t perform that action at this time.
0 commit comments