Skip to content

Commit 6715c50

Browse files
authored
Merge pull request #49 from a8cteam51/chore/placeholder-names
Use placeholder names in code, tests and docs
2 parents 470200e + 1102c8b commit 6715c50

21 files changed

Lines changed: 230 additions & 230 deletions

‎Sources/Oatcake/Format.swift‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func sameAsFolder(_ title: String, _ folder: String) -> Bool {
4141
/// The path above a title, without its last part when that only repeats the title.
4242
func pathAbove(_ folder: String, _ title: String) -> String { folderPath(sameAsFolder(title, folder) ? parentOf(folder) : folder) }
4343

44-
/// Is this owner you? "Sam" counts for "Sam Lee".
44+
/// Is this owner you? "John" counts for "John Smith".
4545
func isMe(_ owner: String?, _ myName: String) -> Bool {
4646
guard let owner = owner?.trimmed.lowercased(), !owner.isEmpty, !myName.isEmpty else { return false }
4747
return [myName.lowercased(), (myName.split(separator: " ").first.map(String.init) ?? myName).lowercased()].contains(owner)
@@ -82,7 +82,7 @@ func listedIn(_ folder: TreeNode?) -> [TreeNode] {
8282

8383
// MARK: - People
8484

85-
/// "Alex Kim" from an attendee, or from "alex.kim@…" when the invite has no name.
85+
/// "Jane Doe" from an attendee, or from "jane.doe@…" when the invite has no name.
8686
func attendeeName(_ a: CalendarEvent.Attendee) -> String {
8787
if let name = a.name, !name.isEmpty { return name }
8888
return (a.email.split(separator: "@").first.map(String.init) ?? a.email)
@@ -108,7 +108,7 @@ private let colorsKey = "personColors"
108108
/**
109109
* Each person keeps one colour everywhere and for good: the first time a name is seen it takes the
110110
* palette's least-used hue (in the order above, which spreads early picks around the wheel), and that
111-
* choice is remembered. Keyed by first name, so "Alex" and "Alex Kim" match.
111+
* choice is remembered. Keyed by first name, so "Jane" and "Jane Doe" match.
112112
*/
113113
private func hueFor(_ name: String, remember: Bool) -> Double {
114114
var all = (UserDefaults.standard.dictionary(forKey: colorsKey) as? [String: Int]) ?? [:]

‎Sources/Oatcake/NewRecordingView.swift‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ struct NewRecordingView: View {
109109
folder = parent.isEmpty ? topLevel : parent
110110
} else if event.seriesId != nil {
111111
folder = newFolder
112-
// Folder names can't contain "/" or ":" ("Sam & Alex 1:1" becomes "Sam & Alex 1-1").
112+
// Folder names can't contain "/" or ":" ("John & Jane 1:1" becomes "John & Jane 1-1").
113113
newName = event.title.replacingOccurrences(of: "[/:]", with: "-", options: .regularExpression)
114114
}
115115
}

‎Sources/Oatcake/TodosView.swift‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,13 @@ struct TodosView: View {
6161
TextField("Add a to-do, then Return", text: $draft)
6262
.textFieldStyle(.plain)
6363
.focused($addFocused)
64-
.help("Yours unless you name someone: Send the deck - Alex - due Fri, Nov 6")
64+
.help("Yours unless you name someone: Send the deck - Jane - due Fri, Nov 6")
6565
.onSubmit(add)
6666
}
6767
.padding(.top, 22)
6868
// How adding works, only while adding.
6969
if addFocused {
70-
Text("Saved in your Meetings folder’s own todo.md, as yours unless you name someone: Send the deck - Alex - due Fri, Nov 6. To add one to a meeting, use the to-dos at the top of its summary.")
70+
Text("Saved in your Meetings folder’s own todo.md, as yours unless you name someone: Send the deck - Jane - due Fri, Nov 6. To add one to a meeting, use the to-dos at the top of its summary.")
7171
.font(.caption).foregroundStyle(.secondary).padding(.top, 6)
7272
}
7373
ForEach(groups, id: \.key) { group in

‎Sources/OatcakeCore/Analysis.swift‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ private func namesFromTranscript(_ config: Config, title: String, lines: [Line],
357357
}
358358
let head = ["Meeting title: \(title)", config.jargonLine].filter { !$0.isEmpty }.joined(separator: "\n")
359359
let task = """
360-
Some speakers are only labelled "Speaker A", "Speaker B" and so on. For each of them, find their real name if the transcript gives it away: when someone says a name while asking a question and the very next line is that speaker answering, the name is theirs; or they introduce themselves ("Alex here"). Take a name only from words in the transcript. If nothing in the transcript shows the name, the name is null; never guess and never invent one.
360+
Some speakers are only labelled "Speaker A", "Speaker B" and so on. For each of them, find their real name if the transcript gives it away: when someone says a name while asking a question and the very next line is that speaker answering, the name is theirs; or they introduce themselves ("Jane here"). Take a name only from words in the transcript. If nothing in the transcript shows the name, the name is null; never guess and never invent one.
361361
Unidentified speakers: \(unknown.map { "Speaker \($0)" }.joined(separator: ", "))
362362
Reply as JSON: {"speakers": [{"speaker": "A", "name": the name or null, "quote": the few words from the transcript that show it, or null}]}.
363363
"""
@@ -397,7 +397,7 @@ func namesIn(_ reply: String, unknown: [String], transcript: String, myName: Str
397397
var speakers: [Guess]
398398
}
399399
guard let parsed = try? parseJsonObject(Reply.self, reply) else { return [:] }
400-
// Whole words: "Dan" isn't said by a transcript that has "abundant" in it.
400+
// Whole words: "Smith" isn't said by a transcript that has "blacksmith" in it.
401401
func words(_ text: String) -> [Substring] { foldedForSearch(text).split { !$0.isLetter && !$0.isNumber } }
402402
let heard = Set(words(transcript))
403403
let mine = Set(foldedForSearch(myName).split(separator: " "))

‎Sources/OatcakeCore/Meetings.swift‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ public final class Meetings: @unchecked Sendable {
283283

284284
/**
285285
* The folder a calendar event's recording goes in: the folder named like the event (punctuation
286-
* ignored, so "Sam & Alex 1:1" finds "Sam & Alex 1-1"), by its own name or its whole path. With no
286+
* ignored, so "John & Jane 1:1" finds "John & Jane 1-1"), by its own name or its whole path. With no
287287
* such folder, it goes where the latest meeting of the same name is (a "Weekly sync" kept in
288288
* Team stays in Team). Failing that, a recurring event gets a new top-level folder named after
289289
* it, and a one-off goes at the top level.
@@ -446,7 +446,7 @@ func plainLine(_ line: String) -> String {
446446
.replacingOccurrences(of: #"\\([\\`*_{}\[\]()#+\-.!~&<>|])"#, with: "$1", options: .regularExpression)
447447
.replacingOccurrences(of: #"\[([^\]]+)\]\([^)]*\)"#, with: "$1", options: .regularExpression)
448448
.replacingOccurrences(of: "\\s*\\[\(stampForm)\\]", with: "", options: .regularExpression)
449-
// A to-do that ended with its time ("… — Alex — [12:34]") is left with the dash before it.
449+
// A to-do that ended with its time ("… — Jane — [12:34]") is left with the dash before it.
450450
.replacingOccurrences(of: #"\s+[—–-]\s*$"#, with: "", options: .regularExpression)
451451
.replacingOccurrences(of: "[*_`]", with: "", options: .regularExpression)
452452
.trimmed
@@ -457,10 +457,10 @@ func foldedForSearch(_ text: String) -> String {
457457
text.folding(options: [.caseInsensitive, .diacriticInsensitive], locale: nil)
458458
}
459459

460-
/// The time a transcript line starts with: "**[12:34] Alex:** …".
460+
/// The time a transcript line starts with: "**[12:34] Jane:** …".
461461
private let transcriptStamp = try! NSRegularExpression(pattern: "^\\**\\[(\(stampForm))\\]")
462462

463-
/// Who is speaking in a transcript line once it's plain text: "Alex Rivers: …".
463+
/// Who is speaking in a transcript line once it's plain text: "Jane Doe: …".
464464
private let transcriptSpeaker = try! NSRegularExpression(pattern: #"^([^:]{1,60}):\s+"#)
465465

466466
/// A long line cut to start a few words before `word` (already folded), so the word shows in the two

‎Sources/OatcakeCore/Parse.swift‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public func toggleTodo(_ markdown: String, line: Int, text: String) -> String? {
132132
/**
133133
* A typed to-do in todo.md's form. " - " and " -- " count as the separator (an em dash is awkward
134134
* to type), and `owner` fills in when none is given: "Send the deck - due Fri, Nov 6" with owner
135-
* "Sam" becomes "Send the deck — Sam — due Fri, Nov 6".
135+
* "John" becomes "Send the deck — John — due Fri, Nov 6".
136136
*/
137137
public func typedTodo(_ text: String, owner: String? = nil) -> String {
138138
var parts = text.trimmed.replacingOccurrences(of: #"\s+(?:—|--|-)\s+"#, with: "\u{0}", options: .regularExpression).components(separatedBy: "\u{0}")

‎Tests/OatcakeCoreTests/AnalysisTests.swift‎

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,45 +25,45 @@ import Testing
2525

2626
/// A name is only suggested when it was said: a small model asked for one will sometimes invent it.
2727
@Test func suggestedNames() async throws {
28-
let transcript = "Sam Taylor (recorder): Priya, where are we with pricing?\nSpeaker A: Nearly there.\nSpeaker B: I agree with Priya."
29-
let reply = #"{"speakers":[{"speaker":"Speaker A","name":"Priya","quote":"Priya, where are we"},{"speaker":"B","name":"Jordan Lee","quote":null},{"speaker":"C","name":"Sam","quote":"x"},{"speaker":"Z","name":"Priya","quote":"x"}]}"#
30-
let names = namesIn(reply, unknown: ["A", "B", "C"], transcript: transcript, myName: "Sam Taylor")
28+
let transcript = "John Doe (recorder): Joe Bloggs, where are we with pricing?\nSpeaker A: Nearly there.\nSpeaker B: I agree with Joe Bloggs."
29+
let reply = #"{"speakers":[{"speaker":"Speaker A","name":"Joe Bloggs","quote":"Joe Bloggs, where are we"},{"speaker":"B","name":"Richard Roe","quote":null},{"speaker":"C","name":"John","quote":"x"},{"speaker":"Z","name":"Joe Bloggs","quote":"x"}]}"#
30+
let names = namesIn(reply, unknown: ["A", "B", "C"], transcript: transcript, myName: "John Doe")
3131
// B's name was never said, C's is your own, and Z wasn't asked about.
32-
#expect(names == ["A": Suggestion(name: "Priya", how: .transcript, detail: "Priya, where are we")])
33-
#expect(namesIn(#"{"speakers":[{"speaker":"A","name":"null","quote":"null"},{"speaker":"B","name":"Speaker B","quote":null}]}"#, unknown: ["A", "B"], transcript: transcript, myName: "Sam Taylor").isEmpty)
34-
// Said means said as a word: "Dan" isn't in "abundant", and "Ann" isn't in "announce". A name in two parts is.
35-
let said = "Sam Taylor (recorder): Jean-Luc, the evidence is abundant.\nSpeaker A: I will announce it.\nSpeaker B: Fine."
36-
let made = #"{"speakers":[{"speaker":"A","name":"Dan","quote":null},{"speaker":"B","name":"Ann","quote":null},{"speaker":"C","name":"Jean-Luc","quote":"Jean-Luc, the evidence"}]}"#
37-
#expect(namesIn(made, unknown: ["A", "B", "C"], transcript: said, myName: "Sam Taylor").mapValues(\.name) == ["C": "Jean-Luc"])
32+
#expect(names == ["A": Suggestion(name: "Joe Bloggs", how: .transcript, detail: "Joe Bloggs, where are we")])
33+
#expect(namesIn(#"{"speakers":[{"speaker":"A","name":"null","quote":"null"},{"speaker":"B","name":"Speaker B","quote":null}]}"#, unknown: ["A", "B"], transcript: transcript, myName: "John Doe").isEmpty)
34+
// Said means said as a word: "Smith" isn't in "blacksmith", and "Roe" isn't in "throes". A name in two parts is.
35+
let said = "John Doe (recorder): Joe Bloggs, the blacksmith is here.\nSpeaker A: The work is in its final throes.\nSpeaker B: Fine."
36+
let made = #"{"speakers":[{"speaker":"A","name":"Smith","quote":null},{"speaker":"B","name":"Roe","quote":null},{"speaker":"C","name":"Joe Bloggs","quote":"Joe Bloggs, the blacksmith"}]}"#
37+
#expect(namesIn(made, unknown: ["A", "B", "C"], transcript: said, myName: "John Doe").mapValues(\.name) == ["C": "Joe Bloggs"])
3838

3939
// From a processed recording: the voice nobody recognised gets its name, one that was recognised keeps its own.
4040
let dir = FileManager.default.temporaryDirectory.appendingPathComponent("oatcake-names-\(UUID().uuidString)")
4141
try FileManager.default.createDirectory(at: dir, withIntermediateDirectories: true)
4242
defer { try? FileManager.default.removeItem(at: dir) }
43-
let known = Suggestion(name: "Alex Kim", how: .voice, detail: "voice match 0.81")
43+
let known = Suggestion(name: "Jane Doe", how: .voice, detail: "voice match 0.81")
4444
let analysis = Analysis(title: "Pricing", startedAt: "2026-11-10T14:00:00.000Z", endedAt: "2026-11-10T14:25:00.000Z",
45-
lines: [Line(speaker: me, start: 1, end: 3, text: "Priya, where are we with pricing?"), Line(speaker: "A", start: 4, end: 6, text: "Nearly there."),
45+
lines: [Line(speaker: me, start: 1, end: 3, text: "Joe Bloggs, where are we with pricing?"), Line(speaker: "A", start: 4, end: 6, text: "Nearly there."),
4646
Line(speaker: "B", start: 7, end: 9, text: "Good.")],
4747
speakers: [SpeakerInfo(id: "A", seconds: 40, embedding: nil, suggestion: nil, quotes: []),
4848
SpeakerInfo(id: "B", seconds: 30, embedding: nil, suggestion: known, quotes: [])],
4949
echoLinesRemoved: 0, me: nil, warnings: [], embeddingModel: voiceprintModel)
5050
try encodeJSON(analysis).write(to: dir.appendingPathComponent("analysis.json"), atomically: true, encoding: .utf8)
5151
#expect(hasUnnamedVoices(dir))
52-
let server = try await StandIn.model { _ in #"{"speakers":[{"speaker":"A","name":"Priya","quote":"Priya, where are we"},{"speaker":"B","name":"Priya","quote":null}]}"# }
52+
let server = try await StandIn.model { _ in #"{"speakers":[{"speaker":"A","name":"Joe Bloggs","quote":"Joe Bloggs, where are we"},{"speaker":"B","name":"Joe Bloggs","quote":null}]}"# }
5353
await suggestNames(dir, config: server.config)
5454
let named = try readJSON(Analysis.self, dir.appendingPathComponent("analysis.json"))
55-
#expect(named.speakers.map(\.suggestion?.name) == ["Priya", "Alex Kim"] && named.warnings.isEmpty && !hasUnnamedVoices(dir))
55+
#expect(named.speakers.map(\.suggestion?.name) == ["Joe Bloggs", "Jane Doe"] && named.warnings.isEmpty && !hasUnnamedVoices(dir))
5656
let asked = try #require(server.requests.first)
57-
#expect(asked.messages.user.contains("Sam Taylor (recorder): Priya, where are we with pricing?\nSpeaker A: Nearly there.\nAlex Kim: Good."))
57+
#expect(asked.messages.user.contains("John Doe (recorder): Joe Bloggs, where are we with pricing?\nSpeaker A: Nearly there.\nJane Doe: Good."))
5858
#expect(asked.messages.user.contains("Unidentified speakers: Speaker A\n") && asked.json["response_format"] != nil)
5959
#expect(asked.json["temperature"] as? Double == 0.6)
6060

61-
// The model is shown "Alex Kim:" before the recognised voice's lines. That's a label, not something
62-
// said: it doesn't make Alex Kim a name the other voice can be given.
61+
// The model is shown "Jane Doe:" before the recognised voice's lines. That's a label, not something
62+
// said: it doesn't make Jane Doe a name the other voice can be given.
6363
try encodeJSON(analysis).write(to: dir.appendingPathComponent("analysis.json"), atomically: true, encoding: .utf8)
64-
let echoes = try await StandIn.model { _ in #"{"speakers":[{"speaker":"A","name":"Alex Kim","quote":null}]}"# }
64+
let echoes = try await StandIn.model { _ in #"{"speakers":[{"speaker":"A","name":"Jane Doe","quote":null}]}"# }
6565
await suggestNames(dir, config: echoes.config)
66-
#expect(try readJSON(Analysis.self, dir.appendingPathComponent("analysis.json")).speakers.map(\.suggestion?.name) == [nil, "Alex Kim"])
66+
#expect(try readJSON(Analysis.self, dir.appendingPathComponent("analysis.json")).speakers.map(\.suggestion?.name) == [nil, "Jane Doe"])
6767

6868
// A model that can't be reached is noted for the review screen, and the analysis is left as it was.
6969
try encodeJSON(analysis).write(to: dir.appendingPathComponent("analysis.json"), atomically: true, encoding: .utf8)

0 commit comments

Comments
 (0)