@knaw-huc/text-annotation-segmenter 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -11,7 +11,7 @@ However, HTML is hierarchical. How to display these kinds of annotations that do
11
11
 
12
12
  The `segment` function creates an array of segments: a flat, non-overlapping list where each segment links to both the text and all the annotations that apply. Each segment translates into a single DOM element. Elements linked to multiple overlapping annotations can now be decorated with their own styling, classes and callbacks.
13
13
 
14
- A special case is the marker: an annotation of zero width marking a position in the text. Markers result in zero-width segments, also linking all annotations that start at, end at, or span across that position.
14
+ A special case is the marker: an annotation of zero width marking a position in the text. Markers result in zero-width segments, also linking all annotations that start at or span across that position.
15
15
 
16
16
  ## API
17
17
 
package/dist/Model.d.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  /**
2
- * Input list of objects linking annotations to the text using character offsets.
2
+ * Input: object linking annotation to the text using character offsets.
3
3
  */
4
- export type AnnotationSegment<T = unknown> = {
4
+ export type AnnotationOffsets<T = unknown> = {
5
5
  begin: number;
6
6
  end: number;
7
7
  body: T;
8
8
  };
9
9
  /**
10
- * Output list of segments with character offsets and the annotations that apply.
10
+ * Output: segment of text and the annotations that apply.
11
11
  */
12
12
  export type TextSegment<T = unknown> = {
13
13
  id: SegmentId;
package/dist/index.d.ts CHANGED
@@ -2,4 +2,4 @@ export { segment } from './segment.ts';
2
2
  export type { AnnotationSegmentsByChar } from './segment.ts';
3
3
  export { groupSegments } from './groupSegments.ts';
4
4
  export type { Group } from './groupSegments.ts';
5
- export type { AnnotationSegment, TextSegment, SegmentId, } from './Model.ts';
5
+ export type { AnnotationOffsets, TextSegment, SegmentId, } from './Model.ts';
package/dist/segment.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- import { AnnotationSegment, TextSegment } from './Model';
1
+ import { AnnotationOffsets, TextSegment } from './Model';
2
2
  /**
3
3
  * Split a text into {@link TextSegment}s with character offsets and a list of applying annotations.
4
4
  */
5
- export declare function segment<T>(text: string, annotations: AnnotationSegment<T>[]): TextSegment<T>[];
5
+ export declare function segment<T>(text: string, annotations: AnnotationOffsets<T>[]): TextSegment<T>[];
6
6
  export type AnnotationSegmentsByChar<T = unknown> = {
7
7
  charIndex: number;
8
- starting: AnnotationSegment<T>[];
9
- ending: AnnotationSegment<T>[];
8
+ starting: AnnotationOffsets<T>[];
9
+ ending: AnnotationOffsets<T>[];
10
10
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knaw-huc/text-annotation-segmenter",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/knaw-huc/text-annotation-segmenter.git"