mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-12-05 06:24:35 +00:00
Added whole documents to the Translation, Grammar & Spelling, and Rewrite & Improve assistants (#1179)
Co-authored-by: Thorsten Sommer <SommerEngineering@users.noreply.github.com>
This commit is contained in:
1 parent
f7666861f1
commit
918572c158
150 files changed
+12850
-302
No files matched your search
@@ -0,0 +1,27 @@
|
||||
using System.Text;
|
||||
|
||||
namespace AIStudio.Tools.DocumentSegments;
|
||||
|
||||
/// <summary>
|
||||
/// Tells whether words hold letters, i.e., whether a model has anything to work on.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Letters count by Unicode scalar values rather than by chars: a letter beyond the Basic Multilingual Plane, e.g.,
|
||||
/// of Adlam or a rare CJK character, takes two chars, neither of which is a letter on its own.
|
||||
/// </remarks>
|
||||
internal static class TextLetterExtensions
|
||||
{
|
||||
/// <param name="text">The words.</param>
|
||||
extension(string text)
|
||||
{
|
||||
/// <summary>
|
||||
/// Whether the words hold any letter.
|
||||
/// </summary>
|
||||
public bool HasLetters => text.EnumerateRunes().Any(Rune.IsLetter);
|
||||
|
||||
/// <summary>
|
||||
/// How many letters the words hold.
|
||||
/// </summary>
|
||||
public int LetterCount => text.EnumerateRunes().Count(Rune.IsLetter);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user