You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
578 B

  1. import { AnnotationRepository } from '@/domain/models/tasks/annotationRepository'
  2. import { Span } from '@/domain/models/tasks/span'
  3. export class APISpanRepository extends AnnotationRepository<Span> {
  4. labelName = 'spans'
  5. toModel(item: { [key: string]: any }): Span {
  6. return new Span(item.id, item.label, item.user, item.start_offset, item.end_offset)
  7. }
  8. toPayload(item: Span): { [key: string]: any } {
  9. return {
  10. id: item.id,
  11. label: item.label,
  12. user: item.user,
  13. start_offset: item.startOffset,
  14. end_offset: item.endOffset
  15. }
  16. }
  17. }