move stuff to core-io/tui
parent
d62aadb95f
commit
6fb0ce2a4f
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
<instance-profile id="d"
|
||||
name="Docthor"
|
||||
start-page="starter-topic.md">
|
||||
start-page="docthor.md">
|
||||
|
||||
<toc-element topic="starter-topic.md"/>
|
||||
<toc-element topic="docthor.md"/>
|
||||
</instance-profile>
|
||||
|
|
@ -4,6 +4,7 @@ plugins {
|
|||
|
||||
dependencies {
|
||||
implementation(project(":libraries:tfidf"))
|
||||
implementation(project(":libraries:tui"))
|
||||
}
|
||||
|
||||
application {
|
||||
|
|
|
|||
|
|
@ -7,15 +7,12 @@ import com.github.ajalt.clikt.parameters.options.required
|
|||
import com.github.ajalt.clikt.parameters.types.enum
|
||||
import com.github.ajalt.clikt.parameters.types.file
|
||||
import de.itkl.core_api.coreApiModule
|
||||
import de.itkl.core_api.interfaces.ProgressBarFactory
|
||||
import de.itkl.textprocessing.textProcessingModule
|
||||
import de.itkl.tfidf.Language
|
||||
import de.itkl.tfidf.TerminalProgressBarFactory
|
||||
//import de.itkl.tfidf.TfIdf
|
||||
import de.itkl.tfidf.TfIdfPipeline
|
||||
import de.itkl.tui.tuiModule
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import org.koin.core.context.startKoin
|
||||
import org.koin.dsl.module
|
||||
|
||||
class ComputeIdf : CliktCommand() {
|
||||
private val corpus by option(help = "corpus")
|
||||
|
|
@ -36,11 +33,7 @@ fun main(args: Array<String>) {
|
|||
modules(
|
||||
coreApiModule,
|
||||
textProcessingModule,
|
||||
module {
|
||||
single<ProgressBarFactory> {
|
||||
TerminalProgressBarFactory()
|
||||
}
|
||||
})
|
||||
tuiModule)
|
||||
ComputeIdf().main(args)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package de.itkl.fileprocessing
|
||||
package de.itkl.core_api.implementation
|
||||
|
||||
import de.itkl.core_api.interfaces.AbstractResource
|
||||
import io.ktor.http.*
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package de.itkl.fileprocessing
|
||||
package de.itkl.core_api.implementation
|
||||
|
||||
import de.itkl.core_api.interfaces.ProgressBar
|
||||
import java.io.InputStream
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
package de.itkl.fileprocessing
|
||||
package de.itkl.core_api.implementation
|
||||
|
||||
import de.itkl.core_api.implementation.ProgressInputStream
|
||||
import de.itkl.core_api.interfaces.ProgressBarFactory
|
||||
import de.itkl.core_api.interfaces.Resource
|
||||
import java.io.InputStream
|
||||
|
|
@ -7,7 +7,7 @@ import java.io.File
|
|||
import java.io.InputStream
|
||||
import java.nio.file.Path
|
||||
|
||||
interface Resource : KoinComponent {
|
||||
interface Resource {
|
||||
val filename: String
|
||||
val contentType: ContentType
|
||||
// TODO: Find a better method to avoid those nulls. Maybe subtyping the interface
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
package de.itkl.core_api.interfaces
|
||||
|
||||
import de.itkl.core_api.implementation.FileResource
|
||||
import de.itkl.core_api.implementation.ProgressResource
|
||||
import org.koin.core.component.KoinComponent
|
||||
import org.koin.core.component.inject
|
||||
import java.io.File
|
||||
|
||||
class ResourceFactory : KoinComponent {
|
||||
|
||||
private val progressBarFactory by inject<ProgressBarFactory>()
|
||||
fun file(file: File): Resource {
|
||||
val resource = FileResource(file)
|
||||
return ProgressResource(resource, progressBarFactory)
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
package de.itkl.fileprocessing
|
||||
|
||||
import de.itkl.core_api.implementation.FileResource
|
||||
import de.itkl.core_api.implementation.ProgressResource
|
||||
import de.itkl.core_api.interfaces.FileProcessor
|
||||
import de.itkl.core_api.interfaces.ProgressBarFactory
|
||||
import io.github.oshai.kotlinlogging.KotlinLogging
|
||||
|
|
|
|||
|
|
@ -1,10 +0,0 @@
|
|||
package de.itkl.tui.implementation
|
||||
|
||||
import de.itkl.core_api.interfaces.ResourceReadDecorator
|
||||
import java.io.InputStream
|
||||
|
||||
class TerminalProgressBar : ResourceReadDecorator {
|
||||
override fun decorate(length: Long, inputStream: InputStream): InputStream {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package de.itkl.tfidf
|
||||
package de.itkl.tui.implementation
|
||||
|
||||
import com.github.ajalt.mordant.animation.ProgressAnimation
|
||||
import com.github.ajalt.mordant.animation.progressAnimation
|
||||
|
|
@ -1,8 +1,14 @@
|
|||
package de.itkl.tui
|
||||
|
||||
import de.itkl.core_api.interfaces.ProgressBarFactory
|
||||
import de.itkl.tui.implementation.TerminalProgressBarFactory
|
||||
import org.koin.dsl.module
|
||||
|
||||
/**
|
||||
* Add terminal ui capabilities
|
||||
*/
|
||||
val tuiModule = module { }
|
||||
val tuiModule = module {
|
||||
single<ProgressBarFactory> {
|
||||
TerminalProgressBarFactory()
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue