Skip to content

Commit faa38e0

Browse files
committed
fix(octra): combine phrases tool doesn't work properly
1 parent bdab099 commit faa38e0

File tree

2 files changed

+14
-53
lines changed

2 files changed

+14
-53
lines changed

apps/octra/src/app/core/store/idb/idb-effects.service.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
import { inject, Injectable } from '@angular/core';
22
import { Actions, createEffect, ofType } from '@ngrx/effects';
33
import { Action, Store } from '@ngrx/store';
4-
import {
5-
ASRContext,
6-
IAnnotJSON,
7-
OAnnotJSON,
8-
OctraAnnotation,
9-
OctraAnnotationSegment,
10-
} from '@octra/annotation';
4+
import { ASRContext, IAnnotJSON, OAnnotJSON, OctraAnnotation, OctraAnnotationSegment } from '@octra/annotation';
115
import { ProjectDto, TaskDto } from '@octra/api-types';
126
import { hasProperty } from '@octra/utilities';
137
import { SessionStorageService } from 'ngx-webstorage';
@@ -25,12 +19,9 @@ import {
2519
Subject,
2620
tap,
2721
timer,
28-
withLatestFrom,
22+
withLatestFrom
2923
} from 'rxjs';
30-
import {
31-
IIDBApplicationOptions,
32-
IIDBModeOptions,
33-
} from '../../shared/octra-database';
24+
import { IIDBApplicationOptions, IIDBModeOptions } from '../../shared/octra-database';
3425
import { AudioService } from '../../shared/service';
3526
import { ConsoleEntry } from '../../shared/service/bug-report.service';
3627
import { IDBService } from '../../shared/service/idb.service';
@@ -834,6 +825,7 @@ export class IDBEffects {
834825
AuthenticationActions.loginLocal.prepare,
835826
AnnotationActions.addMultipleASRSegments.success,
836827
AnnotationActions.initTranscriptionService.success,
828+
AnnotationActions.combinePhrases.success,
837829
),
838830
withLatestFrom(this.store),
839831
mergeMap(([action, appState]) => {

apps/octra/src/app/core/store/login-mode/annotation/annotation.effects.ts

Lines changed: 10 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,19 @@ import {
1313
OctraAnnotationSegment,
1414
OctraAnnotationSegmentLevel,
1515
OLabel,
16-
PraatTextgridConverter,
16+
PraatTextgridConverter
1717
} from '@octra/annotation';
1818
import {
1919
ProjectDto,
2020
TaskDto,
2121
TaskInputOutputCreatorType,
2222
TaskInputOutputDto,
2323
TaskStatus,
24-
ToolConfigurationAssetDto,
24+
ToolConfigurationAssetDto
2525
} from '@octra/api-types';
2626
import { SampleUnit } from '@octra/media';
2727
import { OctraAPIService } from '@octra/ngx-octra-api';
28-
import {
29-
appendURLQueryParams,
30-
extractFileNameFromURL,
31-
hasProperty,
32-
SubscriptionManager,
33-
} from '@octra/utilities';
28+
import { appendURLQueryParams, extractFileNameFromURL, hasProperty, SubscriptionManager } from '@octra/utilities';
3429
import {
3530
catchError,
3631
exhaustMap,
@@ -42,26 +37,24 @@ import {
4237
Subscription,
4338
tap,
4439
timer,
45-
withLatestFrom,
40+
withLatestFrom
4641
} from 'rxjs';
4742
import { AppInfo } from '../../../../app.info';
4843
import { ErrorModalComponent } from '../../../modals/error-modal/error-modal.component';
4944
import { NgbModalWrapper } from '../../../modals/ng-modal-wrapper';
5045
import { OctraModalService } from '../../../modals/octra-modal.service';
51-
import { TranscriptionSendingModalComponent } from '../../../modals/transcription-sending-modal/transcription-sending-modal.component';
46+
import {
47+
TranscriptionSendingModalComponent
48+
} from '../../../modals/transcription-sending-modal/transcription-sending-modal.component';
5249
import {
5350
createSampleProjectDto,
5451
createSampleTask,
5552
createSampleUser,
5653
findCompatibleFileFromIO,
5754
isValidAnnotation,
58-
StatisticElem,
55+
StatisticElem
5956
} from '../../../shared';
60-
import {
61-
AlertService,
62-
AudioService,
63-
UserInteractionsService,
64-
} from '../../../shared/service';
57+
import { AlertService, AudioService, UserInteractionsService } from '../../../shared/service';
6558
import { AppStorageService } from '../../../shared/service/appstorage.service';
6659
import { RoutingService } from '../../../shared/service/routing.service';
6760
import { ApplicationActions } from '../../application/application.actions';
@@ -1129,34 +1122,10 @@ export class AnnotationEffects {
11291122
}
11301123
duration = lastSegment.time.unix - startPos;
11311124
if (!isSilence(lastSegment) || duration < minSilenceLength) {
1132-
let lastSegmentText =
1133-
lastSegment.getFirstLabelWithoutName('Speaker')?.value;
1134-
let segmentText =
1135-
segment.getFirstLabelWithoutName('Speaker')?.value;
1136-
1137-
if (isSilence(lastSegment)) {
1138-
lastSegmentText = '';
1139-
}
1140-
1141-
if (!isSilence(segment)) {
1142-
segment.changeFirstLabelWithoutName(
1143-
'Speaker',
1144-
`${lastSegmentText} ${segmentText}`,
1145-
);
1146-
wordCounter = countWords(
1147-
`${lastSegmentText} ${segmentText}`,
1148-
);
1149-
} else {
1150-
segmentText = '';
1151-
segment.changeFirstLabelWithoutName(
1152-
'Speaker',
1153-
`${lastSegmentText}`,
1154-
);
1155-
}
11561125
transcript = transcript!.removeItemByIndex(
11571126
i - 1,
11581127
'',
1159-
false,
1128+
true,
11601129
(transcript: string) => {
11611130
return tidyUpAnnotation(
11621131
transcript,

0 commit comments

Comments
 (0)