|
| 1 | +<ng-container *transloco="let t; read: 'draft_sources'"> |
| 2 | + <h1>{{ t("configure_draft_sources") }}</h1> |
| 3 | + |
| 4 | + <app-notice class="experimental-notice" type="primary" mode="fill-dark" icon="science"> |
| 5 | + This is an experimental simplified page for configuring sources. Please |
| 6 | + <a href="mailto:{{ issueEmail }}" target="_blank">leave us feedback</a> on how it works for you. |
| 7 | + </app-notice> |
| 8 | + |
| 9 | + <mat-expansion-panel class="introduction"> |
| 10 | + <mat-expansion-panel-header>How to configure draft sources</mat-expansion-panel-header> |
| 11 | + <p> |
| 12 | + Generating a draft requires two steps. First we need to teach a model how to translate from one language into |
| 13 | + another. The 'from language' is also known as the 'Source', and the 'to language' is also known as the 'Target'. |
| 14 | + </p> |
| 15 | + <p> |
| 16 | + Source languages already known to the model, or closely related to the Target language usually work best. |
| 17 | + <a href="#" (click)="showModelLanguages($event)">Here is a list of the languages that the model knows already.</a> |
| 18 | + </p> |
| 19 | + <p> |
| 20 | + The current project <strong>{{ currentProjectShortName }}</strong> will be used to train a model that can |
| 21 | + translate into <strong>{{ targetLanguageDisplayName }}</strong |
| 22 | + >. |
| 23 | + </p> |
| 24 | + <h3>Choosing Source Projects for training the model</h3> |
| 25 | + <p> |
| 26 | + Choose one or two texts in the 'Source Language'. Sometimes choosing a Back Translation improves the model. It is |
| 27 | + worth testing with and without the Back Translation to see which setting gives you the best results. |
| 28 | + </p> |
| 29 | + <p> |
| 30 | + There is an option to include other translation examples in training by uploading a spreadsheet with two columns. |
| 31 | + The first column contains the Source text and the second column contains its translation in the Target language. |
| 32 | + </p> |
| 33 | + |
| 34 | + <h3>Choosing a Drafting Source</h3> |
| 35 | + <p> |
| 36 | + The model will create drafts by translating books from the 'Drafting Source Project'. It is rare that the model |
| 37 | + will give useful results if the Drafting Source Project isn't included in the Source projects for training the |
| 38 | + model. |
| 39 | + </p> |
| 40 | + |
| 41 | + <p> |
| 42 | + You will be able to look at the drafts before you need to decide how to use them. Scripture Forge will not |
| 43 | + automatically add the generated drafts to any project. They will only be available in Scripture Forge until you |
| 44 | + add them to a project. |
| 45 | + </p> |
| 46 | + |
| 47 | + <p><a [href]="urls.configuringSources" target="_blank">More help on Configuring Sources</a></p> |
| 48 | + </mat-expansion-panel> |
| 49 | + |
| 50 | + <div class="overview"> |
| 51 | + <mat-card> |
| 52 | + <mat-card-header> |
| 53 | + <mat-card-title>{{ "new_configure_sources.train_language_model" | transloco }}</mat-card-title> |
| 54 | + </mat-card-header> |
| 55 | + <mat-card-content class="training-data"> |
| 56 | + <div class="sources"> |
| 57 | + <h3>{{ t("overview_reference") }} {{ parentheses(referenceLanguageDisplayName) }}</h3> |
| 58 | + |
| 59 | + <div>{{ t("select_primary_reference") }}</div> |
| 60 | + @for (source of trainingSources; track $index) { |
| 61 | + <app-project-select |
| 62 | + [isDisabled]="loading || !appOnline" |
| 63 | + [projects]="projects" |
| 64 | + [resources]="resources" |
| 65 | + [nonSelectableProjects]="nonSelectableProjects" |
| 66 | + [value]="source?.paratextId" |
| 67 | + [hiddenParatextIds]="getHiddenParatextIds(trainingSources, source?.paratextId)" |
| 68 | + (valueChange)="sourceSelected(trainingSources, $index, $event)" |
| 69 | + [placeholder]="projectPlaceholder(source)" |
| 70 | + ></app-project-select> |
| 71 | + } |
| 72 | + |
| 73 | + @if (allowAddingATrainingSource) { |
| 74 | + <div>{{ t("some_projects_use_back_translation") }}</div> |
| 75 | + <button |
| 76 | + mat-button |
| 77 | + (click)="trainingSources.push(undefined); $event.preventDefault()" |
| 78 | + class="add-another-project" |
| 79 | + > |
| 80 | + <mat-icon>add</mat-icon> {{ t("add_another_reference_project") }} |
| 81 | + </button> |
| 82 | + } |
| 83 | + </div> |
| 84 | + <span class="arrow mirror-rtl"><mat-icon>arrow_right_alt</mat-icon></span> |
| 85 | + <div class="targets"> |
| 86 | + <h3>{{ t("overview_translated_project") }} {{ parentheses(targetLanguageDisplayName) }}</h3> |
| 87 | + <div> |
| 88 | + @for (portion of i18n.interpolateVariables("draft_sources.project_always_used"); track $index) { |
| 89 | + @if (portion.id === "currentProjectShortName") { |
| 90 | + <strong>{{ currentProjectShortName }}</strong> |
| 91 | + } |
| 92 | + <!-- prettier-ignore --> |
| 93 | + @else {{{ portion.text }}} |
| 94 | + } |
| 95 | + <!-- Select here any other projects to be used on the target side. All of these should be in the language of the target (<strong>{{ targetLanguageDisplayName }}</strong>). --> |
| 96 | + </div> |
| 97 | + @for (source of trainingTargets; track $index) { |
| 98 | + <app-project-select |
| 99 | + [isDisabled]="true" |
| 100 | + [projects]="projects" |
| 101 | + [resources]="resources" |
| 102 | + [nonSelectableProjects]="nonSelectableProjects" |
| 103 | + [value]="source?.paratextId" |
| 104 | + [hiddenParatextIds]="getHiddenParatextIds(trainingTargets, source?.paratextId)" |
| 105 | + [placeholder]="projectPlaceholder(source)" |
| 106 | + ></app-project-select> |
| 107 | + } |
| 108 | + <div> |
| 109 | + {{ t("training_files_description", { sourceLanguageDisplayName, targetLanguageDisplayName }) }} |
| 110 | + </div> |
| 111 | + <div class="training-files"> |
| 112 | + <app-training-data-multi-select |
| 113 | + [availableTrainingData]="availableTrainingFiles" |
| 114 | + (trainingDataSelect)="onTrainingDataSelect($event)" |
| 115 | + ></app-training-data-multi-select> |
| 116 | + </div> |
| 117 | + </div> |
| 118 | + </mat-card-content> |
| 119 | + </mat-card> |
| 120 | + |
| 121 | + <mat-card> |
| 122 | + <mat-card-header> |
| 123 | + <mat-card-title> |
| 124 | + {{ "new_configure_sources.generate_a_draft_from_the_language_model" | transloco }} |
| 125 | + </mat-card-title> |
| 126 | + </mat-card-header> |
| 127 | + <mat-card-content> |
| 128 | + <div class="translation-data"> |
| 129 | + <h3>{{ t("overview_source") }} {{ parentheses(sourceLanguageDisplayName) }}</h3> |
| 130 | + <div>{{ t("select_project_to_translate") }}</div> |
| 131 | + @for (source of draftingSources; track $index) { |
| 132 | + <app-project-select |
| 133 | + [isDisabled]="loading || !appOnline" |
| 134 | + [projects]="projects" |
| 135 | + [resources]="resources" |
| 136 | + [nonSelectableProjects]="nonSelectableProjects" |
| 137 | + [value]="source?.paratextId" |
| 138 | + [hiddenParatextIds]="getHiddenParatextIds(draftingSources, source?.paratextId)" |
| 139 | + (valueChange)="sourceSelected(draftingSources, $index, $event)" |
| 140 | + [placeholder]="projectPlaceholder(source)" |
| 141 | + ></app-project-select> |
| 142 | + } |
| 143 | + </div> |
| 144 | + </mat-card-content> |
| 145 | + </mat-card> |
| 146 | + </div> |
| 147 | + |
| 148 | + <app-language-codes-confirmation |
| 149 | + class="confirm-language-codes" |
| 150 | + [sources]="draftSourcesAsArray" |
| 151 | + [clearCheckbox]="clearLanguageCodeConfirmationCheckbox" |
| 152 | + (messageIfUserTriesToContinue)="languageCodeConfirmationMessageIfUserTriesToContinue = $event" |
| 153 | + ></app-language-codes-confirmation> |
| 154 | + |
| 155 | + <div class="component-footer"> |
| 156 | + @if (!appOnline) { |
| 157 | + <mat-error id="offline-message"> |
| 158 | + {{ t("offline_message") }} |
| 159 | + </mat-error> |
| 160 | + } |
| 161 | + <div class="page-actions"> |
| 162 | + <button mat-button (click)="cancel()"><mat-icon>close</mat-icon>{{ t("cancel") }}</button> |
| 163 | + <button id="save_button" mat-flat-button color="primary" (click)="save()" [disabled]="!appOnline"> |
| 164 | + <mat-icon>check</mat-icon>{{ t("save_and_sync") }} |
| 165 | + </button> |
| 166 | + </div> |
| 167 | + </div> |
| 168 | + |
| 169 | + @if (getControlState("projectSettings") != null) { |
| 170 | + <mat-card class="saving"> |
| 171 | + <mat-card-header> |
| 172 | + <mat-card-title>{{ t("saving_draft_sources") }}</mat-card-title> |
| 173 | + </mat-card-header> |
| 174 | + <mat-card-content> |
| 175 | + <div class="saving-indicator"> |
| 176 | + @if (getControlState("projectSettings") === ElementState.Submitting) { |
| 177 | + <mat-spinner [diameter]="24" color="primary"></mat-spinner> {{ t("saving") }} |
| 178 | + } @else if (getControlState("projectSettings") === ElementState.Submitted) { |
| 179 | + <mat-icon class="success">checkmark</mat-icon> {{ t("all_changes_saved") }} |
| 180 | + } @else { |
| 181 | + <mat-icon class="failure">error</mat-icon> {{ t("failed_to_save_changes") }} |
| 182 | + } |
| 183 | + </div> |
| 184 | + @for (entry of syncStatus | keyvalue; track entry.key) { |
| 185 | + <div> |
| 186 | + @if (entry.value.knownToBeOnSF) { |
| 187 | + @if (entry.value.isSyncing) { |
| 188 | + <mat-spinner [diameter]="24"></mat-spinner> {{ entry.value.shortName }} - {{ t("state_syncing") }} |
| 189 | + } @else { |
| 190 | + @if (entry.value.lastSyncSuccessful) { |
| 191 | + <mat-icon class="success">check</mat-icon> {{ entry.value.shortName }} - |
| 192 | + {{ t("state_sync_successful") }} |
| 193 | + } @else { |
| 194 | + <mat-icon class="failure">error</mat-icon> {{ entry.value.shortName }} - |
| 195 | + {{ t("state_sync_failed") }} |
| 196 | + } |
| 197 | + } |
| 198 | + } @else { |
| 199 | + <mat-spinner [diameter]="24"></mat-spinner> {{ entry.value.shortName }} - {{ t("state_connecting") }} |
| 200 | + } |
| 201 | + </div> |
| 202 | + } |
| 203 | + </mat-card-content> |
| 204 | + @if (allProjectsSavedAndSynced || getControlState("projectSettings") === ElementState.Error) { |
| 205 | + <mat-card-actions align="end"> |
| 206 | + <button mat-button (click)="navigateToDrafting()"><mat-icon>close</mat-icon> {{ t("close") }}</button> |
| 207 | + </mat-card-actions> |
| 208 | + } |
| 209 | + </mat-card> |
| 210 | + } |
| 211 | +</ng-container> |
0 commit comments