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.

37 lines
691 B

2 years ago
  1. import { AnnotationModel } from './interface'
  2. export class Span implements AnnotationModel {
  3. constructor(
  4. public id: number,
  5. public label: number,
  6. public user: number,
  7. public startOffset: number,
  8. public endOffset: number
  9. ) {}
  10. static valueOf({
  11. id,
  12. label,
  13. user,
  14. start_offset,
  15. end_offset
  16. }: {
  17. id: number
  18. label: number
  19. user: number
  20. start_offset: number
  21. end_offset: number
  22. }) {
  23. return new Span(id, label, user, start_offset, end_offset)
  24. }
  25. toObject() {
  26. return {
  27. id: this.id,
  28. label: this.label,
  29. user: this.user,
  30. start_offset: this.startOffset,
  31. end_offset: this.endOffset
  32. }
  33. }
  34. }