diff --git a/generator/sefariasqlite/src/jvmMain/kotlin/io/github/kdroidfilter/seforimlibrary/sefariasqlite/SefariaBookPayloadReader.kt b/generator/sefariasqlite/src/jvmMain/kotlin/io/github/kdroidfilter/seforimlibrary/sefariasqlite/SefariaBookPayloadReader.kt
index fa6e89de..c6139ffa 100644
--- a/generator/sefariasqlite/src/jvmMain/kotlin/io/github/kdroidfilter/seforimlibrary/sefariasqlite/SefariaBookPayloadReader.kt
+++ b/generator/sefariasqlite/src/jvmMain/kotlin/io/github/kdroidfilter/seforimlibrary/sefariasqlite/SefariaBookPayloadReader.kt
@@ -502,6 +502,7 @@ internal class SefariaBookPayloadReader(
val content = leafPrimitive?.takeIf { it.isString }?.content
if (!content.isNullOrEmpty()) {
val cleaned = cleanSefariaLine(content, stripFootnotes = hasTranslatorFootnotes(refPrefix))
+ .let { if (hasSelfLabeledSegments(bookEnTitle)) normalizeSegmentMarker(it) else it }
if (cleaned.isNotEmpty()) {
output += linePrefix + cleaned
val cleanRef = trimTrailingSeparators(refPrefix)
@@ -541,7 +542,10 @@ internal class SefariaBookPayloadReader(
val sectionIndex = sectionNames.size - depth
val isReferenceable = referenceableSections.getOrNull(sectionIndex) ?: true
- val nextLinePrefix = if (depth == 1 && isReferenceable && currentAddressType != "Integer" && nonEmptyCount > 1) {
+ val nextLinePrefix = if (
+ depth == 1 && isReferenceable && currentAddressType != "Integer" && nonEmptyCount > 1 &&
+ !hasSelfLabeledSegments(bookEnTitle)
+ ) {
"($letter) "
} else {
""
diff --git a/generator/sefariasqlite/src/jvmMain/kotlin/io/github/kdroidfilter/seforimlibrary/sefariasqlite/SefariaImportText.kt b/generator/sefariasqlite/src/jvmMain/kotlin/io/github/kdroidfilter/seforimlibrary/sefariasqlite/SefariaImportText.kt
index 6020d4d1..87a544f6 100644
--- a/generator/sefariasqlite/src/jvmMain/kotlin/io/github/kdroidfilter/seforimlibrary/sefariasqlite/SefariaImportText.kt
+++ b/generator/sefariasqlite/src/jvmMain/kotlin/io/github/kdroidfilter/seforimlibrary/sefariasqlite/SefariaImportText.kt
@@ -27,6 +27,20 @@ private val TRANSLATOR_FOOTNOTE_REF_PREFIXES = listOf("Noda BiYehudah I, Orach C
internal fun hasTranslatorFootnotes(ref: String): Boolean =
TRANSLATOR_FOOTNOTE_REF_PREFIXES.any { ref.startsWith(it) }
+// Books whose segments already open with their printed marker ("(יד) נהגו לתייג"),
+// so the generated "(letter) " segment label doubles it. The Mishnah Berurah's
+// kuntresim (e.g. Mishnat Soferim in siman 36) have no seif katan at all, so a
+// generated label there is wrong rather than redundant (kdroidFilter/SeforimLibrary#73, #74).
+private val SELF_LABELED_SEGMENT_BOOKS = setOf("Mishnah Berurah")
+
+internal fun hasSelfLabeledSegments(bookEnTitle: String): Boolean = bookEnTitle in SELF_LABELED_SEGMENT_BOOKS
+
+// Some simanim of the Mishnah Berurah (494-529) mark the seif katan as "{א}"
+// instead of the printed "(א)".
+private val BRACED_SEGMENT_MARKER_REGEX = Regex("""^\{([א-ת]{1,4})\}""")
+
+internal fun normalizeSegmentMarker(line: String): String = BRACED_SEGMENT_MARKER_REGEX.replace(line, "($1)")
+
private val FOOTNOTE_MARKER_REGEX = Regex("""""")
private const val FOOTNOTE_OPEN = """