File tree Expand file tree Collapse file tree
src/main/scala/com/johnsnowlabs/nlp/annotators/ner/dl Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -278,7 +278,7 @@ Output:"""
278278 }
279279
280280 /** @group getParam */
281- def getFewShotExamples : Array [(String , String )] = $(fewShotExamples)
281+ def getFewShotExamples : Array [(String , String )] = getFewShotExamplesSafe
282282
283283 private [johnsnowlabs] def setEngine (engineName : String ): this .type = set(engine, engineName)
284284
@@ -393,6 +393,18 @@ $output
393393 Some ((tuple.productElement(0 ).toString, tuple.productElement(1 ).toString))
394394 case _ => None
395395 }
396+ case arrayList : java.util.ArrayList [_] =>
397+ import scala .collection .JavaConverters ._
398+ arrayList.asScala.flatMap {
399+ case inner : java.util.ArrayList [_] =>
400+ val items = inner.asScala
401+ if (items.size == 2 ) Some ((items(0 ).toString, items(1 ).toString))
402+ else None
403+ case (a : String , b : String ) => Some ((a, b))
404+ case tuple : Product if tuple.productArity == 2 =>
405+ Some ((tuple.productElement(0 ).toString, tuple.productElement(1 ).toString))
406+ case _ => None
407+ }.toArray
396408 case _ => Array .empty[(String , String )]
397409 }
398410 } catch {
You can’t perform that action at this time.
0 commit comments