PHI-Model-8B/PHI.Data.Generator/RLHF.Generator/LmStudio/SentenceTenses.cs

43 lines
1.0 KiB
C#

namespace RLHF.Generator.LmStudio;
public static class SentenceTenses
{
public const string Past = "past";
public const string Present = "present";
public const string Future = "future";
public static bool TryNormalize(string? value, out string? normalized)
{
normalized = null;
if (value is null)
{
return true;
}
string trimmedValue = value.Trim();
if (trimmedValue.Length == 0)
{
return false;
}
if (string.Equals(trimmedValue, Past, StringComparison.OrdinalIgnoreCase))
{
normalized = Past;
return true;
}
if (string.Equals(trimmedValue, Present, StringComparison.OrdinalIgnoreCase))
{
normalized = Present;
return true;
}
if (string.Equals(trimmedValue, Future, StringComparison.OrdinalIgnoreCase))
{
normalized = Future;
return true;
}
return false;
}
}