Change if refactored to match

This commit is contained in:
denon1 2023-04-01 02:04:07 +02:00
parent 573fab9526
commit 376f35f08f
1 changed files with 23 additions and 21 deletions

View File

@ -102,8 +102,9 @@ object KnownForSources {
TypedPipe
.from(TextLine(textFile))
.flatMap { str =>
if (str.startsWith("#")) {none}
try {
str match {
case s"#$_" => none
case _ => try {
val tokens = str.trim.split("\\s+")
val userId = tokens(0).toLong
(1 until tokens.length).foldRight(Array.newBuilder[(Int, Float)])((i, r) => {
@ -127,6 +128,7 @@ object KnownForSources {
}
}
}
}
def stringifyKnownFor(
input: TypedPipe[(Long, Array[(Int, Float)])]