diff --git a/Writerside/topics/docthor.md b/Writerside/topics/docthor.md
index 4338bde..a053f24 100644
--- a/Writerside/topics/docthor.md
+++ b/Writerside/topics/docthor.md
@@ -11,6 +11,12 @@ Asset can be found under memento:/mnt/wd/export/data
bouquet
+
+Resource Management für Compose
+
+
+Building modern, elegant and fast desktop Compose applications
+
## Modules - Libraries
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index 9762148..4f81fc6 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -1,3 +1,4 @@
+
plugins {
id("docthor.kotlin-application-conventions")
}
diff --git a/app/src/main/kotlin/docthor/app/App.kt b/app/src/main/kotlin/docthor/app/App.kt
index 6b6e78e..65b2dad 100644
--- a/app/src/main/kotlin/docthor/app/App.kt
+++ b/app/src/main/kotlin/docthor/app/App.kt
@@ -23,7 +23,7 @@ class ComputeIdf : CliktCommand() {
.required()
override fun run() = runBlocking {
- TfIdfPipeline(force = true)
+ TfIdfPipeline(force = false)
.input(corpus)
}
}
diff --git a/apps/documentViewer/build.gradle.kts b/apps/documentViewer/build.gradle.kts
new file mode 100644
index 0000000..2936fdc
--- /dev/null
+++ b/apps/documentViewer/build.gradle.kts
@@ -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)
+}
\ No newline at end of file
diff --git a/apps/documentViewer/src/main/kotlin/de/itkl/documentViewer/DocumentViewer.kt b/apps/documentViewer/src/main/kotlin/de/itkl/documentViewer/DocumentViewer.kt
new file mode 100644
index 0000000..5f84ded
--- /dev/null
+++ b/apps/documentViewer/src/main/kotlin/de/itkl/documentViewer/DocumentViewer.kt
@@ -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()
+ }
+ }
+}
\ No newline at end of file
diff --git a/build.gradle.kts b/build.gradle.kts
index 52d948c..bfe148d 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -1,3 +1,7 @@
project(":libraries").subprojects {
apply(plugin = "docthor.kotlin-library-conventions")
+}
+
+project(":apps").subprojects {
+ apply(plugin = "docthor.kotlin-application-conventions")
}
\ No newline at end of file
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
new file mode 100644
index 0000000..c7fb9b4
--- /dev/null
+++ b/gradle/libs.versions.toml
@@ -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" }
\ No newline at end of file
diff --git a/libraries/core-api/src/main/kotlin/de/itkl/core_api/coreApiModule.kt b/libraries/core-api/src/main/kotlin/de/itkl/core_api/coreApiModule.kt
index 5439ea3..0684980 100644
--- a/libraries/core-api/src/main/kotlin/de/itkl/core_api/coreApiModule.kt
+++ b/libraries/core-api/src/main/kotlin/de/itkl/core_api/coreApiModule.kt
@@ -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()}
- single { NoopResourceReadDecorator() }
}
\ No newline at end of file
diff --git a/libraries/core-api/src/main/kotlin/de/itkl/core_api/interfaces/Resource.kt b/libraries/core-api/src/main/kotlin/de/itkl/core_api/interfaces/Resource.kt
index 9ca71e9..3ee0703 100644
--- a/libraries/core-api/src/main/kotlin/de/itkl/core_api/interfaces/Resource.kt
+++ b/libraries/core-api/src/main/kotlin/de/itkl/core_api/interfaces/Resource.kt
@@ -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().decorate(
- length = length,
- doRead()
- )
- } ?: doRead()
+ return doRead()
}
}
\ No newline at end of file
diff --git a/libraries/core-api/src/main/kotlin/de/itkl/core_api/interfaces/ResourceReadDecorator.kt b/libraries/core-api/src/main/kotlin/de/itkl/core_api/interfaces/ResourceReadDecorator.kt
index d403a9e..2abc46d 100644
--- a/libraries/core-api/src/main/kotlin/de/itkl/core_api/interfaces/ResourceReadDecorator.kt
+++ b/libraries/core-api/src/main/kotlin/de/itkl/core_api/interfaces/ResourceReadDecorator.kt
@@ -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
- }
-}
\ No newline at end of file
diff --git a/libraries/textprocessing/build.gradle.kts b/libraries/textprocessing/build.gradle.kts
index 5ec3fd1..6879e20 100644
--- a/libraries/textprocessing/build.gradle.kts
+++ b/libraries/textprocessing/build.gradle.kts
@@ -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")
}
diff --git a/libraries/textprocessing/src/main/kotlin/de/itkl/textprocessing/Document.kt b/libraries/textprocessing/src/main/kotlin/de/itkl/textprocessing/Document.kt
deleted file mode 100644
index f56fde9..0000000
--- a/libraries/textprocessing/src/main/kotlin/de/itkl/textprocessing/Document.kt
+++ /dev/null
@@ -1,4 +0,0 @@
-package de.itkl.textprocessing
-
-class DocumentContainer {
-}
\ No newline at end of file
diff --git a/libraries/textprocessing/src/main/kotlin/de/itkl/textprocessing/DocumentContainer.kt b/libraries/textprocessing/src/main/kotlin/de/itkl/textprocessing/DocumentContainer.kt
new file mode 100644
index 0000000..6d28352
--- /dev/null
+++ b/libraries/textprocessing/src/main/kotlin/de/itkl/textprocessing/DocumentContainer.kt
@@ -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
+) {
+}
+
+class OcrPage(
+ val words: List,
+ val regions: List
+) {
+ inner class DocumentRegion(
+ private val polygon: Polygon,
+ private val type: String,
+ ) {
+ fun words(): Flow {
+ return words
+ .asFlow()
+ .filter { word -> word.polygon.intersectionWith(polygon) != null }
+ }
+ }
+ inner class Word(
+ val polygon: Polygon,
+ val text: String
+ )
+}
\ No newline at end of file
diff --git a/settings.gradle.kts b/settings.gradle.kts
index 9750b35..d5377eb 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -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")