@@ -7,6 +7,7 @@ import { existsSync, readFileSync } from 'node:fs';
77import * as yaml from 'js-yaml' ;
88import { EventEmitter } from 'node:events' ;
99import { cwd } from 'node:process' ;
10+ import { FIXED_ANNOTATION_FIELDS } from './api.js' ;
1011
1112const old_log = console . log ;
1213
@@ -47,6 +48,15 @@ export enum MatchMode {
4748 Exact = 2 ,
4849}
4950
51+ export function isAnnotated ( e : CommonEntry ) : boolean {
52+ return (
53+ ( e . gloss || e . type === 'phrase' ) &&
54+ ( e . type === 'predicate' && e . body . includes ( '▯' )
55+ ? FIXED_ANNOTATION_FIELDS . every ( field => e [ field ] )
56+ : ! ! e . type )
57+ ) ;
58+ }
59+
5060export function deburrMatch (
5161 what : string [ ] ,
5262 where : string [ ] ,
@@ -118,27 +128,13 @@ export interface Note {
118128 content : string ;
119129}
120130
121- export interface Entry {
122- /// An entry ID string like `AbCdEfGhI`.
123- id : string ;
124- /// An ISO 8601 date string like `2022-12-28T21:38:31.682Z`.
125- date : string ;
131+ export interface CommonEntry {
126132 /// The Toaq word this entry is for.
127133 head : string ;
128134 /// The gloss of the word.
129135 gloss : string | undefined ;
130136 /// The definition of the word.
131137 body : string ;
132- /// The name of the user that added the entry.
133- user : string ;
134- /// The scope (`en`, `toa`...) the entry is in.
135- scope : string ;
136- /// Notes left on this entry.
137- notes : Note [ ] ;
138- /// Map from usernames to individual votes.
139- votes : Record < string , - 1 | 0 | 1 > ;
140- /// Total score of the entry, aggregated from votes.
141- score : number ;
142138 /// The type of the entry, e.g. `"predicate"`.
143139 type : string | undefined ;
144140 /// The pronominal class of the entry, e.g. `"maq"`.
@@ -151,6 +147,23 @@ export interface Entry {
151147 subject : string | undefined ;
152148}
153149
150+ export interface Entry extends CommonEntry {
151+ /// An entry ID string like `AbCdEfGhI`.
152+ id : string ;
153+ /// An ISO 8601 date string like `2022-12-28T21:38:31.682Z`.
154+ date : string ;
155+ /// The name of the user that added the entry.
156+ user : string ;
157+ /// The scope (`en`, `toa`...) the entry is in.
158+ scope : string ;
159+ /// Notes left on this entry.
160+ notes : Note [ ] ;
161+ /// Map from usernames to individual votes.
162+ votes : Record < string , - 1 | 0 | 1 > ;
163+ /// Total score of the entry, aggregated from votes.
164+ score : number ;
165+ }
166+
154167export interface Token {
155168 /// Username the token is for.
156169 name : string ;
0 commit comments