Skip to content

Commit

Permalink
Fixes issue #829 (#830)
Browse files Browse the repository at this point in the history
## Summary of Changes

Fixes an issue with processing of cosmos files with weird characters
that tripped the TR pipeline

### Related issues

Resolves 829
  • Loading branch information
enoriega authored Feb 27, 2024
1 parent 68e7d31 commit d780729
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ package org.ml4ai.skema.text_reading.cosmosjson

import java.io.File
import java.nio.file.Path

import com.typesafe.config.Config
import ai.lum.common.ConfigUtils._
import ai.lum.common.FileUtils._

import scala.collection.mutable.ArrayBuffer
import scala.util.{Failure, Success, Try}

object CosmosJsonProcessor {
def mkDocument(file: File): CosmosDocument = {
Expand Down Expand Up @@ -64,8 +64,11 @@ object CosmosJsonProcessor {
currentBlockIdx = 0
currentPage = newCurrentPage
} else currentBlockIdx += 1
val cosObj = mkCosmosObject(block, currentBlockIdx)
cosmosObjects.append(cosObj)
Try(mkCosmosObject(block, currentBlockIdx)) match {
case Success(cosObj) => cosmosObjects.append(cosObj)
case Failure(_) => ()
}

}
CosmosDocument(combineBlocks(cosmosObjects))
}
Expand Down

0 comments on commit d780729

Please sign in to comment.