first application
parent
9f3813a83a
commit
c758d0b79d
|
|
@ -11,6 +11,12 @@ Asset can be found under <path>memento:/mnt/wd/export/data</path>
|
|||
<def title="PDF Renderer for Compose">
|
||||
<a href="https://github.com/GRizzi91/bouquet">bouquet</a>
|
||||
</def>
|
||||
<def title="Moko Resource">
|
||||
<a href="https://github.com/icerockdev/moko-resources">Resource Management für Compose</a>
|
||||
</def>
|
||||
<def title="Aurora">
|
||||
<a href="https://github.com/kirill-grouchnikov/aurora">Building modern, elegant and fast desktop Compose applications</a>
|
||||
</def>
|
||||
</deflist>
|
||||
|
||||
## Modules - Libraries
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
plugins {
|
||||
id("docthor.kotlin-application-conventions")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ class ComputeIdf : CliktCommand() {
|
|||
.required()
|
||||
|
||||
override fun run() = runBlocking {
|
||||
TfIdfPipeline(force = true)
|
||||
TfIdfPipeline(force = false)
|
||||
.input(corpus)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
plugins {
|
||||
id("org.jetbrains.compose") version "1.5.11"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("org.pushing-pixels:aurora-theming:1.3.0")
|
||||
implementation("org.pushing-pixels:aurora-component:1.3.0")
|
||||
implementation("org.pushing-pixels:aurora-window:1.3.0")
|
||||
implementation(compose.desktop.currentOs)
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
package de.itkl.documentViewer
|
||||
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.text.ExperimentalTextApi
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.DpSize
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.window.WindowPlacement
|
||||
import androidx.compose.ui.window.WindowPosition
|
||||
import androidx.compose.ui.window.rememberWindowState
|
||||
import org.pushingpixels.aurora.component.model.Command
|
||||
import org.pushingpixels.aurora.component.projection.CommandButtonProjection
|
||||
import org.pushingpixels.aurora.theming.auroraBackground
|
||||
import org.pushingpixels.aurora.theming.marinerSkin
|
||||
import org.pushingpixels.aurora.window.AuroraWindow
|
||||
import org.pushingpixels.aurora.window.AuroraWindowTitlePaneConfigurations
|
||||
import org.pushingpixels.aurora.window.auroraApplication
|
||||
|
||||
class DocumentViewer {
|
||||
}
|
||||
|
||||
|
||||
fun main() = auroraApplication {
|
||||
val state = rememberWindowState(
|
||||
placement = WindowPlacement.Floating,
|
||||
position = WindowPosition.Aligned(Alignment.Center),
|
||||
size = DpSize(220.dp, 150.dp)
|
||||
)
|
||||
|
||||
AuroraWindow(
|
||||
skin = marinerSkin(),
|
||||
title = "Aurora Demo",
|
||||
state = state,
|
||||
windowTitlePaneConfiguration = AuroraWindowTitlePaneConfigurations.AuroraPlain(),
|
||||
onCloseRequest = ::exitApplication
|
||||
) {
|
||||
var text by remember { mutableStateOf("Hello, World!") }
|
||||
|
||||
Row(
|
||||
horizontalArrangement = Arrangement.Center,
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
modifier = Modifier.fillMaxSize().auroraBackground()
|
||||
) {
|
||||
CommandButtonProjection(
|
||||
contentModel = Command(
|
||||
text = text,
|
||||
action = { text = "Hello, Desktop!" }
|
||||
)
|
||||
).project()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,3 +1,7 @@
|
|||
project(":libraries").subprojects {
|
||||
apply(plugin = "docthor.kotlin-library-conventions")
|
||||
}
|
||||
|
||||
project(":apps").subprojects {
|
||||
apply(plugin = "docthor.kotlin-application-conventions")
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
[versions]
|
||||
kotlin = "1.9.21"
|
||||
coroutines = "1.7.3"
|
||||
compose = "1.5.11"
|
||||
dokka = "1.9.10"
|
||||
batik = "1.17"
|
||||
|
||||
versionchecker = "0.50.0"
|
||||
mavenpublish = "0.25.3"
|
||||
|
||||
[libraries]
|
||||
compose-desktop = { module = "org.jetbrains.compose:compose-gradle-plugin", version.ref = "compose" }
|
||||
kotlin-gradlePlugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
|
||||
kotlin-coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines" }
|
||||
dokka-gradlePlugin = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref = "dokka"}
|
||||
batik = { module = "org.apache.xmlgraphics:batik-all", version.ref = "batik" }
|
||||
|
||||
versionchecker-gradlePlugin = { module = "com.github.ben-manes:gradle-versions-plugin", version.ref = "versionchecker" }
|
||||
mavenpublish-gradlePlugin = { module = "com.vanniktech:gradle-maven-publish-plugin", version.ref = "mavenpublish" }
|
||||
|
|
@ -1,11 +1,8 @@
|
|||
package de.itkl.core_api
|
||||
|
||||
import de.itkl.core_api.interfaces.NoopResourceReadDecorator
|
||||
import de.itkl.core_api.interfaces.ResourceFactory
|
||||
import de.itkl.core_api.interfaces.ResourceReadDecorator
|
||||
import org.koin.dsl.module
|
||||
|
||||
val coreApiModule = module {
|
||||
single<ResourceFactory> { ResourceFactory()}
|
||||
single<ResourceReadDecorator> { NoopResourceReadDecorator() }
|
||||
}
|
||||
|
|
@ -24,11 +24,6 @@ interface Resource {
|
|||
abstract class AbstractResource : Resource, KoinComponent {
|
||||
abstract fun doRead(): InputStream
|
||||
final override fun read(): InputStream {
|
||||
return length?.let { length ->
|
||||
get<ResourceReadDecorator>().decorate(
|
||||
length = length,
|
||||
doRead()
|
||||
)
|
||||
} ?: doRead()
|
||||
return doRead()
|
||||
}
|
||||
}
|
||||
|
|
@ -1,15 +1,3 @@
|
|||
package de.itkl.core_api.interfaces
|
||||
|
||||
import java.io.InputStream
|
||||
|
||||
interface ResourceReadDecorator {
|
||||
fun decorate(
|
||||
length: Long,
|
||||
inputStream: InputStream): InputStream
|
||||
}
|
||||
|
||||
class NoopResourceReadDecorator : ResourceReadDecorator {
|
||||
override fun decorate(length: Long, inputStream: InputStream): InputStream {
|
||||
return inputStream
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
dependencies {
|
||||
api(project(":libraries:core-api"))
|
||||
api("org.apache.lucene:lucene-analysis-common:9.9.0")
|
||||
api("io.github.piruin:geok:1.2.2")
|
||||
implementation("com.github.doyaaaaaken:kotlin-csv-jvm:1.9.2")
|
||||
implementation("com.google.guava:guava:32.1.3-jre")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +0,0 @@
|
|||
package de.itkl.textprocessing
|
||||
|
||||
class DocumentContainer {
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
package de.itkl.textprocessing
|
||||
|
||||
import de.itkl.core_api.interfaces.Resource
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.asFlow
|
||||
import kotlinx.coroutines.flow.filter
|
||||
import me.piruin.geok.BBox
|
||||
import me.piruin.geok.geometry.Polygon
|
||||
|
||||
class Document(
|
||||
val name: String,
|
||||
val resources: List<Resource>
|
||||
) {
|
||||
}
|
||||
|
||||
class OcrPage(
|
||||
val words: List<Word>,
|
||||
val regions: List<DocumentRegion>
|
||||
) {
|
||||
inner class DocumentRegion(
|
||||
private val polygon: Polygon,
|
||||
private val type: String,
|
||||
) {
|
||||
fun words(): Flow<Word> {
|
||||
return words
|
||||
.asFlow()
|
||||
.filter { word -> word.polygon.intersectionWith(polygon) != null }
|
||||
}
|
||||
}
|
||||
inner class Word(
|
||||
val polygon: Polygon,
|
||||
val text: String
|
||||
)
|
||||
}
|
||||
|
|
@ -1,11 +1,13 @@
|
|||
//pluginManagement {
|
||||
// includeBuild("build-logic")
|
||||
//}
|
||||
|
||||
plugins {
|
||||
id("org.gradle.toolchains.foojay-resolver-convention") version "0.4.0"
|
||||
}
|
||||
|
||||
rootProject.name = "docthor"
|
||||
|
||||
fun includeDirs(vararg paths: String) {
|
||||
paths.forEach(this::includeDir)
|
||||
}
|
||||
|
||||
fun includeDir(path: String) {
|
||||
file(path)
|
||||
.listFiles()!!
|
||||
|
|
@ -18,8 +20,9 @@ fun includeDir(path: String) {
|
|||
}
|
||||
}
|
||||
|
||||
rootProject.name = "docthor"
|
||||
include(
|
||||
"app",
|
||||
)
|
||||
includeDir("libraries")
|
||||
includeDirs(
|
||||
"apps",
|
||||
"libraries")
|
||||
|
|
|
|||
Loading…
Reference in New Issue