This is an automated email from the ASF dual-hosted git repository. aradzinski pushed a commit to branch scala-2.13 in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git
commit 579e59067adbc14d76a0ba109e7287a7685a96d4 Author: unknown <[email protected]> AuthorDate: Tue May 18 15:01:44 2021 -0700 WIP. --- .../apache/nlpcraft/common/ascii/NCAsciiTable.scala | 4 ++-- .../org/apache/nlpcraft/common/util/NCUtils.scala | 4 ++-- .../model/intent/compiler/NCIdlCompilerGlobal.scala | 2 +- .../apache/nlpcraft/model/tools/cmdline/NCCli.scala | 18 +++++++++--------- .../scala/org/apache/nlpcraft/probe/NCProbeBoot.scala | 11 +++++------ .../apache/nlpcraft/probe/mgrs/NCProbeMessage.scala | 2 +- .../probe/mgrs/nlp/enrichers/sort/NCSortEnricher.scala | 10 +++++----- .../probe/mgrs/sentence/NCSentenceManager.scala | 2 +- .../scala/org/apache/nlpcraft/server/NCServer.scala | 4 ++-- .../org/apache/nlpcraft/server/geo/NCGeoManager.scala | 2 +- .../server/geo/tools/NCGeoNamesGenerator.scala | 6 +++--- .../geo/tools/NCGeoSyntheticNamesGenerator.scala | 10 +++++----- .../server/geo/tools/metro/NCGeoMetroGenerator.scala | 2 +- .../apache/nlpcraft/server/ignite/NCIgniteRunner.scala | 2 +- .../nlp/enrichers/basenlp/NCBaseNlpEnricher.scala | 2 +- .../server/nlp/enrichers/date/NCDateEnricher.scala | 18 +++++++++--------- 16 files changed, 49 insertions(+), 50 deletions(-) diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/common/ascii/NCAsciiTable.scala b/nlpcraft/src/main/scala/org/apache/nlpcraft/common/ascii/NCAsciiTable.scala index 1a96684..67c1bec 100644 --- a/nlpcraft/src/main/scala/org/apache/nlpcraft/common/ascii/NCAsciiTable.scala +++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/common/ascii/NCAsciiTable.scala @@ -171,14 +171,14 @@ class NCAsciiTable { /** * Starts data row. */ - def startRow() { + def startRow(): Unit = { curRow = IndexedSeq.empty[Cell] } /** * Ends data row. */ - def endRow() { + def endRow(): Unit = { rows :+= curRow curRow = null diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/common/util/NCUtils.scala b/nlpcraft/src/main/scala/org/apache/nlpcraft/common/util/NCUtils.scala index 43817f3..6b3b25c 100644 --- a/nlpcraft/src/main/scala/org/apache/nlpcraft/common/util/NCUtils.scala +++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/common/util/NCUtils.scala @@ -759,7 +759,7 @@ object NCUtils extends LazyLogging { * @param sort Whether to sort output or not. */ @throws[IOException] - def mkTextFile(path: String, lines: Iterable[Any], sort: Boolean = true) { + def mkTextFile(path: String, lines: Iterable[Any], sort: Boolean = true): Unit = { val file = new File(path) Using.resource(new PrintStream(file)) { @@ -951,7 +951,7 @@ object NCUtils extends LazyLogging { * @param delFolder Flag, deleted or not root folder itself. */ @throws[NCE] - def clearFolder(rootDir: String, delFolder: Boolean = false) { + def clearFolder(rootDir: String, delFolder: Boolean = false): Unit = { val rootPath = Paths.get(rootDir) try diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/compiler/NCIdlCompilerGlobal.scala b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/compiler/NCIdlCompilerGlobal.scala index c83c9a5..b2233f7 100644 --- a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/compiler/NCIdlCompilerGlobal.scala +++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/compiler/NCIdlCompilerGlobal.scala @@ -40,7 +40,7 @@ object NCIdlCompilerGlobal { */ private def clearImportCache(): Unit = importCache.synchronized { - importCache.clear + importCache.clear() } /** diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCli.scala b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCli.scala index 356102c..01fda99 100644 --- a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCli.scala +++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCli.scala @@ -849,13 +849,13 @@ object NCCli extends NCCliBase { */ private def tailFile(path: String, lines: Int): Unit = try - managed(new ReversedLinesFileReader(new File(path), StandardCharsets.UTF_8)) acquireAndGet { in => + Using.resource(new ReversedLinesFileReader(new File(path), StandardCharsets.UTF_8)) { in => var tail = List.empty[String] breakable { for (_ <- 0 until lines) in.readLine() match { - case null => break + case null => break() case line => tail ::= line } } @@ -970,13 +970,13 @@ object NCCli extends NCCliBase { private def loadServerBeacon(autoSignIn: Boolean = false): Option[NCCliServerBeacon] = { val beaconOpt = try { val beacon = ( - managed( + Using.resource( new ObjectInputStream( new FileInputStream( new File(SystemUtils.getUserHome, SRV_BEACON_PATH) ) ) - ) acquireAndGet { + ) { _.readObject() } ) @@ -1074,13 +1074,13 @@ object NCCli extends NCCliBase { private def loadProbeBeacon(): Option[NCCliProbeBeacon] = { val beaconOpt = try { val beacon = ( - managed( + Using.resource( new ObjectInputStream( new FileInputStream( new File(SystemUtils.getUserHome, PRB_BEACON_PATH) ) ) - ) acquireAndGet { + ) { _.readObject() } ) @@ -1895,7 +1895,7 @@ object NCCli extends NCCliBase { outEntry: String, extractHeader: Option[Seq[String] => (Int, Int)], repls: (String, String)* - ) { + ): Unit = { val key = s"$zipInDir/$inEntry" require(PRJ_TEMPLATES.contains(key), s"Unexpected template entry for: $key") @@ -1937,8 +1937,8 @@ object NCCli extends NCCliBase { cont = repls.foldLeft(cont)((s, repl) => s.replaceAll(repl._1, repl._2)) try - managed(new FileWriter(outFile)) acquireAndGet { w => - managed(new BufferedWriter(w)) acquireAndGet { bw => + Using.resource(new FileWriter(outFile)) { w => + Using.resource(new BufferedWriter(w)) { bw => bw.write(cont) } } diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/NCProbeBoot.scala b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/NCProbeBoot.scala index da3fe9c..e6fa3fa 100644 --- a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/NCProbeBoot.scala +++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/NCProbeBoot.scala @@ -53,9 +53,8 @@ import org.apache.nlpcraft.probe.mgrs.sentence.NCSentenceManager import java.io._ import java.util.concurrent.CompletableFuture -import scala.collection.JavaConverters._ import scala.collection.mutable -import scala.compat.Platform.currentTime +import scala.jdk.CollectionConverters.CollectionHasAsScala import scala.util.Using import scala.util.control.Exception.{catching, ignoring} @@ -275,7 +274,7 @@ private [probe] object NCProbeBoot extends LazyLogging with NCOpenCensusTrace { jarsFolder = cfg.jarsFolder.orNull, models = cfg.models, beaconPath = path.getAbsolutePath, - startMs = currentTime + startMs = java.lang.System.currentTimeMillis() )) stream.flush() @@ -432,7 +431,7 @@ private [probe] object NCProbeBoot extends LazyLogging with NCOpenCensusTrace { /** * Prints ASCII-logo. */ - private def asciiLogo() { + private def asciiLogo(): Unit = { val ver = NCVersion.getCurrent println( @@ -468,8 +467,8 @@ private [probe] object NCProbeBoot extends LazyLogging with NCOpenCensusTrace { /** * Asks server start. */ - private def ackStart() { - val dur = s"[${U.format((currentTime - execStart) / 1000.0, 2)} sec]" + private def ackStart(): Unit = { + val dur = s"[${U.format((java.lang.System.currentTimeMillis() - execStart) / 1000.0, 2)} sec]" val tbl = NCAsciiTable() diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/NCProbeMessage.scala b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/NCProbeMessage.scala index 45a713b..5cb0906 100644 --- a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/NCProbeMessage.scala +++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/NCProbeMessage.scala @@ -76,7 +76,7 @@ class NCProbeMessage(val typ: String) extends mutable.HashMap[String/*Name*/, Se def data[T](key: String): T = dataOpt[T](key) match { case None => throw new AssertionError(s"Probe message missing key [key=$key, data=$this]") - case Some(x) => x.asInstanceOf[T] + case Some(x) => x } /** diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/sort/NCSortEnricher.scala b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/sort/NCSortEnricher.scala index 7a73323..802cb56 100644 --- a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/sort/NCSortEnricher.scala +++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/sort/NCSortEnricher.scala @@ -18,7 +18,6 @@ package org.apache.nlpcraft.probe.mgrs.nlp.enrichers.sort import java.io.Serializable - import io.opencensus.trace.Span import org.apache.nlpcraft.common.NCService import org.apache.nlpcraft.common.makro.NCMacroParser @@ -27,9 +26,10 @@ import org.apache.nlpcraft.common.nlp.{NCNlpSentence, NCNlpSentenceNote, NCNlpSe import org.apache.nlpcraft.probe.mgrs.NCProbeModel import org.apache.nlpcraft.probe.mgrs.nlp.NCProbeEnricher -import scala.collection.JavaConverters._ import scala.collection.mutable.ArrayBuffer import scala.collection.{Map, Seq, mutable} +import scala.compat.java8.FunctionConverters.enrichAsJavaFunction +import scala.jdk.CollectionConverters.CollectionHasAsScala /** * Sort enricher. @@ -132,7 +132,7 @@ object NCSortEnricher extends NCProbeEnricher { /** * */ - private def validate() { + private def validate(): Unit = { // Not duplicated. require(sort.size + by.size + order.size == (sort ++ by ++ order.map(_._1)).distinct.size) @@ -279,8 +279,8 @@ object NCSortEnricher extends NCProbeEnricher { map(toks => toks.map(_.stem).mkString(" ") -> toks).toMap. flatMap { case (stem, stemToks) => if (keyStems.contains(stem)) Some(KeyWord(stemToks, keyStems.indexOf(stem))) else None - }.toStream.headOption - ).toStream.headOption + }.to(LazyList).headOption + ).to(LazyList).headOption } var res: Option[Match] = None diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/sentence/NCSentenceManager.scala b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/sentence/NCSentenceManager.scala index 547ab95..36cb77e 100644 --- a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/sentence/NCSentenceManager.scala +++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/sentence/NCSentenceManager.scala @@ -290,7 +290,7 @@ object NCSentenceManager extends NCService { * @param ns Sentence. * @param userNoteTypes Notes types. */ - private def fixIndexes(ns: NCNlpSentence, userNoteTypes: Seq[String]) { + private def fixIndexes(ns: NCNlpSentence, userNoteTypes: Seq[String]): Unit = { // Replaces other notes indexes. for (t <- userNoteTypes :+ "nlpcraft:nlp"; note <- ns.getNotes(t)) { val toks = ns.filter(_.contains(note)).sortBy(_.index) diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/NCServer.scala b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/NCServer.scala index 124ee31..0161f1f 100644 --- a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/NCServer.scala +++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/NCServer.scala @@ -70,7 +70,7 @@ object NCServer extends App with NCIgniteInstance with LazyLogging with NCOpenCe /** * Prints ASCII-logo. */ - private def asciiLogo() { + private def asciiLogo(): Unit = { val ver = NCVersion.getCurrent logger.info( @@ -146,7 +146,7 @@ object NCServer extends App with NCIgniteInstance with LazyLogging with NCOpenCe /** * Acks server start. */ - protected def ackStart() { + protected def ackStart(): Unit = { val dur = s"[${U.format((currentTime - executionStart) / 1000.0, 2)}s]" val tbl = NCAsciiTable() diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/geo/NCGeoManager.scala b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/geo/NCGeoManager.scala index b199ba3..fcf56f2 100644 --- a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/geo/NCGeoManager.scala +++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/geo/NCGeoManager.scala @@ -144,7 +144,7 @@ object NCGeoManager extends NCService { val metro = mutable.HashSet.empty[NCGeoMetro] // Add location internal representation. - def addEntry(key: String, geo: NCGeoEntry, lowerCase: Boolean) { + def addEntry(key: String, geo: NCGeoEntry, lowerCase: Boolean): Unit = { val k = if (lowerCase) key.toLowerCase else key geoEntries.get(k) match { diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/geo/tools/NCGeoNamesGenerator.scala b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/geo/tools/NCGeoNamesGenerator.scala index 817afd2..e33ca75 100644 --- a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/geo/tools/NCGeoNamesGenerator.scala +++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/geo/tools/NCGeoNamesGenerator.scala @@ -342,7 +342,7 @@ object NCGeoNamesGenerator extends App { } // Go over all countries and serialize to files. - private def writeCountries(mapper: ObjectMapper, countries: Set[Country]) { + private def writeCountries(mapper: ObjectMapper, countries: Set[Country]): Unit = { val dirPath = s"$outDir/countries" val dir = new File(dirPath) @@ -444,7 +444,7 @@ object NCGeoNamesGenerator extends App { isoToNames: Map[String, String], regCodes: Map[String, String], worldTop: Set[CityInfo], - usTop: Set[CityInfo]) { + usTop: Set[CityInfo]): Unit = { def write(cities: Set[CityInfo], file: String, qty: Int): Unit = { val topCities = cities.map(p => { @@ -500,7 +500,7 @@ object NCGeoNamesGenerator extends App { mapper.writeValue(new File(outContinents), hs) } - private def generate() { + private def generate(): Unit = { val mapper = U.getYamlMapper val continents = NCUnsdStatsService.mkContinents() diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/geo/tools/NCGeoSyntheticNamesGenerator.scala b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/geo/tools/NCGeoSyntheticNamesGenerator.scala index b28c833..ff26e38 100644 --- a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/geo/tools/NCGeoSyntheticNamesGenerator.scala +++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/geo/tools/NCGeoSyntheticNamesGenerator.scala @@ -34,7 +34,7 @@ object NCGeoSyntheticNamesGenerator extends App { // Base synonym should be saved for console debug message. case class Holder(base: String, var entries: Set[NCGeoEntry]) - private def process(outFile: String) { + private def process(outFile: String): Unit = { val file = new File(outFile) if (file.exists() && !file.delete()) @@ -60,7 +60,7 @@ object NCGeoSyntheticNamesGenerator extends App { } } - def generateDash(str: String) { + def generateDash(str: String): Unit = { def generate(a: String, b: String): Unit = if (str.contains(a)) add(str.replaceAll(a, b), str) @@ -69,7 +69,7 @@ object NCGeoSyntheticNamesGenerator extends App { generate("-", " ") } - def generateSaints(str: String) { + def generateSaints(str: String): Unit = { def generate(str: String, beginStr: String, replacements: String*): Unit = if (str.startsWith(beginStr)) replacements.foreach(r => add(str.replaceFirst(beginStr, r), str)) @@ -102,7 +102,7 @@ object NCGeoSyntheticNamesGenerator extends App { println("All synthetic names already generated. Nothing to add.") } - private def writeJson(buf: Map[String, Holder], outFile: String) { + private def writeJson(buf: Map[String, Holder], outFile: String): Unit = { val syns = mutable.Map.empty[NCGeoEntry, NCGeoSynonym] buf.foreach(p => { @@ -159,7 +159,7 @@ object NCGeoSyntheticNamesGenerator extends App { U.getYamlMapper.writeValue(new File(outFile), (syns.values ++ exists).toSet) } - private def printResults(buf: Map[String, Holder]) { + private def printResults(buf: Map[String, Holder]): Unit = { val map = mutable.Map.empty[String, Seq[String]] buf.map(p => { diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/geo/tools/metro/NCGeoMetroGenerator.scala b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/geo/tools/metro/NCGeoMetroGenerator.scala index 5bd7492..56f07c6 100644 --- a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/geo/tools/metro/NCGeoMetroGenerator.scala +++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/geo/tools/metro/NCGeoMetroGenerator.scala @@ -42,7 +42,7 @@ object NCGeoMetroGenerator extends App { private def deleteBrackets(s: String): String = U.normalize(s.replaceAll("\\(", " ").replaceAll("\\)", " "), " ") - private def generate() { + private def generate(): Unit = { val lines = U.readPath(in).map(_.strip).filter(_.nonEmpty) // Skips header. diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/ignite/NCIgniteRunner.scala b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/ignite/NCIgniteRunner.scala index 58e13b8..484aafa 100644 --- a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/ignite/NCIgniteRunner.scala +++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/ignite/NCIgniteRunner.scala @@ -37,7 +37,7 @@ object NCIgniteRunner extends LazyLogging { * @param body Function to execute on running Ignite node. */ @throws[NCE] - def runWith(cfgPath: String, body: => Unit) { + def runWith(cfgPath: String, body: => Unit): Unit = { val sysProps = new SystemProperties // Set up Ignite system properties. diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/nlp/enrichers/basenlp/NCBaseNlpEnricher.scala b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/nlp/enrichers/basenlp/NCBaseNlpEnricher.scala index 1c48d48..45ed87b 100644 --- a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/nlp/enrichers/basenlp/NCBaseNlpEnricher.scala +++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/nlp/enrichers/basenlp/NCBaseNlpEnricher.scala @@ -101,7 +101,7 @@ object NCBaseNlpEnricher extends NCServerEnricher { * @throws NCE */ @throws[NCE] - override def enrich(ns: NCNlpSentence, parent: Span = null) { + override def enrich(ns: NCNlpSentence, parent: Span = null): Unit = { require(isStarted) startScopedSpan("enrich", parent, "srvReqId" -> ns.srvReqId, "txt" -> ns.text) { _ => diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/nlp/enrichers/date/NCDateEnricher.scala b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/nlp/enrichers/date/NCDateEnricher.scala index 8eb8e3a..c47711b 100644 --- a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/nlp/enrichers/date/NCDateEnricher.scala +++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/nlp/enrichers/date/NCDateEnricher.scala @@ -19,7 +19,7 @@ package org.apache.nlpcraft.server.nlp.enrichers.date import io.opencensus.trace.Span import org.apache.nlpcraft.common.config.NCConfigurable -import org.apache.nlpcraft.common.nlp.{NCNlpSentence => Sentence, NCNlpSentenceNote => Note, NCNlpSentenceToken => Token} +import org.apache.nlpcraft.common.nlp.{NCNlpSentence ⇒ Sentence, NCNlpSentenceNote ⇒ Note, NCNlpSentenceToken ⇒ Token} import org.apache.nlpcraft.common.pool.NCThreadPoolManager import org.apache.nlpcraft.common.{NCService, _} import org.apache.nlpcraft.server.nlp.enrichers.NCServerEnricher @@ -27,12 +27,12 @@ import org.apache.nlpcraft.server.nlp.enrichers.date.NCDateConstants._ import org.apache.nlpcraft.server.nlp.enrichers.date.NCDateFormatType._ import java.util -import java.util.{Calendar => C} -import scala.collection.JavaConverters._ +import java.util.{Calendar ⇒ C} import scala.collection.immutable.Iterable import scala.collection.mutable -import scala.collection.mutable.{LinkedHashMap => LHM} +import scala.collection.mutable.{LinkedHashMap ⇒ LHM} import scala.concurrent.ExecutionContext +import scala.jdk.CollectionConverters.CollectionHasAsScala /** * Date enricher. @@ -174,7 +174,7 @@ object NCDateEnricher extends NCServerEnricher { * @throws NCE */ @throws[NCE] - override def enrich(ns: Sentence, parent: Span = null) { + override def enrich(ns: Sentence, parent: Span = null): Unit = { require(isStarted) // This stage must not be 1st enrichment stage. @@ -383,7 +383,7 @@ object NCDateEnricher extends NCServerEnricher { fromIncl: Boolean, toIncl: Boolean, tokens: Seq[Token], - base: Long) { + base: Long): Unit = { val note = mkNote( NCDateParser.calculate(body, base, fromIncl, toIncl).mkInclusiveDateRange, tokens.head.index, @@ -396,7 +396,7 @@ object NCDateEnricher extends NCServerEnricher { private def mark(processed: F*): Unit = processed.foreach(_.isProcessed = true) - private def collapse(ns: Sentence) { + private def collapse(ns: Sentence): Unit = { removeDuplicates(ns) collapsePeriods(ns) removeDuplicates(ns) @@ -404,7 +404,7 @@ object NCDateEnricher extends NCServerEnricher { private def isValidRange(n: Note): Boolean = n("from").asInstanceOf[Long] < n("to").asInstanceOf[Long] - private def collapsePeriods(ns: Sentence) { + private def collapsePeriods(ns: Sentence): Unit = { // a) Months and years. // 1. "m", "m"... "y, m" -> fix year for firsts; try to union all. // Example: January, February of 2009. @@ -563,7 +563,7 @@ object NCDateEnricher extends NCServerEnricher { ns: Sentence, seq: Seq[Note], before: Option[Note] = None, - after: Option[Note] = None) { + after: Option[Note] = None): Unit = { if (!compressNotes(ns, seq, before, after)) { def remove(nOpt: Option[Note]): Unit = nOpt match {
