Skip to content

Commit

Permalink
Model TaggerStore after TagsetStore
Browse files Browse the repository at this point in the history
  • Loading branch information
PrinsINT committed Jun 26, 2024
1 parent 0fa6242 commit f7a97f5
Show file tree
Hide file tree
Showing 13 changed files with 428 additions and 430 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import java.io.File


val mapper: ObjectMapper by lazy { ObjectMapper() }
const val LOCK_SLEEP_TIME = 100L // ms to sleep before retrying to access locked file.

abstract class FileBackedCache<T>(
file: File,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import org.ivdnt.galahad.data.document.SOURCE_LAYER_NAME
import org.ivdnt.galahad.jobs.Jobs
import org.ivdnt.galahad.port.CmdiMetadata
import org.ivdnt.galahad.port.CorpusTransformMetadata
import org.ivdnt.galahad.taggers.Taggers
import org.ivdnt.galahad.taggers.Tagger
import org.ivdnt.galahad.util.createZipFile
import java.io.File
import java.io.OutputStream
Expand Down Expand Up @@ -94,10 +94,10 @@ class Corpus(
override fun expensiveGet() = metadataCache.get<CorpusMetadata>()
}

val sourceTagger: ExpensiveGettable<Taggers.Summary> = object : ExpensiveGettable<Taggers.Summary> {
override fun expensiveGet(): Taggers.Summary {
val sourceTagger: ExpensiveGettable<Tagger> = object : ExpensiveGettable<Tagger> {
override fun expensiveGet(): Tagger {
val metadata = metadata.expensiveGet()
return Taggers.Summary(
return Tagger(
id = SOURCE_LAYER_NAME,
description = "uploaded annotations",
tagset = metadata.tagset,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import org.ivdnt.galahad.data.layer.Layer
import org.ivdnt.galahad.port.InternalFile
import org.ivdnt.galahad.port.SourceLayerableFile
import org.ivdnt.galahad.port.tsv.TSVFile
import org.ivdnt.galahad.taggers.Taggers
import org.ivdnt.galahad.taggers.Tagger
import org.ivdnt.galahad.tagset.Tagset
import org.ivdnt.galahad.tagset.TagsetStore
import org.springframework.web.bind.annotation.*
Expand Down Expand Up @@ -61,8 +61,8 @@ class InternalJobController (
val (corpusID, jobName, documentName) = dataForProcessingID( fileId ) ?: throw Exception("Processing ID not found, was this file uploaded by me?")
val original: Document = corpora.getUncheckedCorpusAccess( corpusID ).documents.readOrThrow( documentName )
val job: Job = corpora.getUncheckedCorpusAccess( corpusID ).jobs.readOrThrow( jobName )
val taggerSummary: Taggers.Summary? = job.taggers.getSummaryOrNull(job.name, null ).expensiveGet()
val tagset: Tagset? = tagsets.getOrNull(taggerSummary?.tagset)
val taggerTagger: Tagger? = job.taggerStore.getSummaryOrNull(job.name, null ).expensiveGet()
val tagset: Tagset? = tagsets.getOrNull(taggerTagger?.tagset)

when (val uploadedFile = InternalFile.from(tempFile, DocumentFormat.Tsv).expensiveGet()) {
// Treat TSVFiles separately form SourceLayerableFiles, because calling sourceLayer() on a TSV
Expand Down
Loading

0 comments on commit f7a97f5

Please sign in to comment.