Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions windows-native/Muesli.Windows/Muesli.Windows.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
<Page Include="App.xaml" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="LLamaSharp" Version="0.27.0" />
<PackageReference Include="LLamaSharp.Backend.Cpu" Version="0.27.0" />
<PackageReference Include="NAudio" Version="2.2.1" />
<PackageReference Include="org.k2fsa.sherpa.onnx" Version="1.13.4" />
<PackageReference Include="QuestPDF" Version="2026.5.0" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace Muesli.Windows.Services;

public static class BenchmarkCaptureRetentionPolicy
{
public const long MaximumBytes = 96L * 1024 * 1024;
public const int MaximumDurationMs = 10 * 60 * 1000;

public static bool ShouldRetain(long byteLength, int durationMs) =>
byteLength > 44 &&
byteLength <= MaximumBytes &&
durationMs > 0 &&
durationMs <= MaximumDurationMs;
}
68 changes: 68 additions & 0 deletions windows-native/Muesli.Windows/Services/FillerWordFilter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
using System.Text.RegularExpressions;

namespace Muesli.Windows.Services;

public static partial class FillerWordFilter
{
private static readonly string[] PhraseFillers =
[
"you know",
"i mean",
"sort of",
"kind of"
];

private static readonly string[] WordFillers =
[
"uh", "um", "uhh", "umm", "er", "err", "ah", "ahh", "hmm", "hm", "mm", "mmm"
];

public static string Apply(string text)
{
if (string.IsNullOrWhiteSpace(text))
{
return text;
}

var filtered = text;
filtered = Regex.Replace(
filtered,
@"(?<![\p{L}\p{N}])like\s*,(?![\p{L}\p{N}])",
"",
RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
foreach (var phrase in PhraseFillers)
{
filtered = Regex.Replace(
filtered,
$@"(?<![\p{{L}}\p{{N}}]){Regex.Escape(phrase)}(?:\s*,)?(?![\p{{L}}\p{{N}}])",
"",
RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
}

foreach (var word in WordFillers)
{
filtered = Regex.Replace(
filtered,
$@"(?<![\p{{L}}\p{{N}}]){Regex.Escape(word)}(?:\s*,)?(?![\p{{L}}\p{{N}}])",
"",
RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
}

filtered = WhitespaceBeforePunctuation().Replace(filtered, "$1");
filtered = RepeatedWhitespace().Replace(filtered, " ").Trim();
if (filtered.Length == 0)
{
return filtered;
}

return char.IsLower(filtered[0])
? char.ToUpperInvariant(filtered[0]) + filtered[1..]
: filtered;
}

[GeneratedRegex(@"\s+([,.;:!?])", RegexOptions.CultureInvariant)]
private static partial Regex WhitespaceBeforePunctuation();

[GeneratedRegex(@"\s+", RegexOptions.CultureInvariant)]
private static partial Regex RepeatedWhitespace();
}
Loading
Loading