Files
AI-Studio/app/MindWork AI Studio/Tools/RAG/LocationRange.cs
T

15 lines
671 B
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
namespace AIStudio.Tools.RAG;
/// <summary>
/// Where a passage is in its document, counted from one: the pages it spans, or the part it is of a
/// document without pages.
/// </summary>
/// <param name="First">The page the passage starts on, or its part.</param>
/// <param name="Last">The page the passage ends on; the first one again when it stays on one, and always for a part.</param>
public readonly record struct LocationRange(int First, int Last)
{
/// <summary>
/// The range as it is written, e.g., "4" or "4–5".
/// </summary>
public override string ToString() => this.First == this.Last ? $"{this.First}" : $"{this.First}–{this.Last}";
}