Skip to content

Commit

Permalink
feat(watermarker): add support for TrendmarkBuilder to getMinimumInse…
Browse files Browse the repository at this point in the history
…rtPositions (#75)
  • Loading branch information
hnorkowski authored Jun 6, 2024
1 parent 8159c2d commit 751197b
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import de.fraunhofer.isst.trend.watermarker.helper.toUnicodeRepresentation
import de.fraunhofer.isst.trend.watermarker.returnTypes.Event
import de.fraunhofer.isst.trend.watermarker.returnTypes.Result
import de.fraunhofer.isst.trend.watermarker.returnTypes.Status
import de.fraunhofer.isst.trend.watermarker.watermarks.TrendmarkBuilder
import de.fraunhofer.isst.trend.watermarker.watermarks.Watermark
import kotlin.js.JsExport
import kotlin.js.JsName
Expand Down Expand Up @@ -331,6 +332,14 @@ class TextWatermarker(
fun getMinimumInsertPositions(watermark: Watermark): Int =
getMinimumInsertPositions(watermark.watermarkContent)

/**
* Counts the minimum number of insert positions needed in a text to insert the
* [trendmarkBuilder]
*/
@JsName("getMimimumInsertPositionsTrendmarkBuilder")
fun getMinimumInsertPositions(trendmarkBuilder: TrendmarkBuilder): Int =
getMinimumInsertPositions(trendmarkBuilder.finish())

/** Transforms a [watermark] into a separated watermark */
private fun getSeparatedWatermark(watermark: List<Byte>): Sequence<Char> {
val encodedWatermark = transcoding.encode(watermark)
Expand Down

0 comments on commit 751197b

Please sign in to comment.