mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-22 02:18:26 +00:00
Use collective data with NER annotation
This commit is contained in:
@ -20,6 +20,12 @@ case class Duration(nanos: Long) {
|
||||
|
||||
def hours: Long = minutes / 60
|
||||
|
||||
def >(other: Duration): Boolean =
|
||||
nanos > other.nanos
|
||||
|
||||
def <(other: Duration): Boolean =
|
||||
nanos < other.nanos
|
||||
|
||||
def toScala: FiniteDuration =
|
||||
FiniteDuration(nanos, TimeUnit.NANOSECONDS)
|
||||
|
||||
@ -62,6 +68,9 @@ object Duration {
|
||||
def nanos(n: Long): Duration =
|
||||
Duration(n)
|
||||
|
||||
def between(start: Timestamp, end: Timestamp): Duration =
|
||||
apply(JDur.between(start.value, end.value))
|
||||
|
||||
def stopTime[F[_]: Sync]: F[F[Duration]] =
|
||||
for {
|
||||
now <- Timestamp.current[F]
|
||||
|
@ -12,6 +12,10 @@ import cats.effect._
|
||||
import cats.implicits._
|
||||
import fs2.Stream
|
||||
|
||||
import docspell.common.syntax.all._
|
||||
|
||||
import io.circe.Decoder
|
||||
|
||||
object File {
|
||||
|
||||
def mkDir[F[_]: Sync](dir: Path): F[Path] =
|
||||
@ -91,4 +95,10 @@ object File {
|
||||
|
||||
def writeString[F[_]: Sync](file: Path, content: String): F[Path] =
|
||||
Sync[F].delay(Files.write(file, content.getBytes(StandardCharsets.UTF_8)))
|
||||
|
||||
def readJson[F[_]: Sync: ContextShift, A](file: Path, blocker: Blocker)(implicit
|
||||
d: Decoder[A]
|
||||
): F[A] =
|
||||
readText[F](file, blocker).map(_.parseJsonAs[A]).rethrow
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user