Skip to content

Commit

Permalink
Merge pull request #871 from alpheios-project/i870-lang-detect-bug
Browse files Browse the repository at this point in the history
Turn on language detection for plain text uploaded from file
  • Loading branch information
irina060981 authored Aug 6, 2022
2 parents 6b7e2ea + b78f133 commit bb2337a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/lib/controllers/upload-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ export default class UploadController {
tokenization[optItemName] = optionsSet.items[optItemName].currentValue
})

return SourceText.convertFromJSON(textType, { textId, tokenization, text: fileData.text, sourceType, lang: fileData.lang })
return SourceText.convertFromJSON(textType, { textId, tokenization, text: fileData.text, sourceType, lang: fileData.lang }, false)
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib/data/alignment.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ export default class Alignment {
const docResult = this.createNewDocSource('origin', docSource)

if (!docResult) { return false }
this.origin.docSource = docResult
this.origin.docSource = docResult
} else {
this.origin.docSource.update(docSource)
}
Expand Down
7 changes: 4 additions & 3 deletions src/lib/data/source-text.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default class SourceText {
this.sourceType = docSource && docSource.sourceType ? docSource.sourceType : this.defaultSourceType
this.tokenization = docSource && docSource.tokenization ? docSource.tokenization : {}

this.skipDetected = skipDetected
this.skipDetected = docSource.skipDetected !== undefined ? docSource.skipDetected : skipDetected
this.startedDetection = false

if (docSource && docSource.metadata) {
Expand Down Expand Up @@ -174,7 +174,7 @@ export default class SourceText {
* @param {String} jsonData.direction
* @param {String} jsonData.lang
*/
static convertFromJSON (textType, jsonData) {
static convertFromJSON (textType, jsonData, skipDetected = true) {
if (!jsonData.text) {
console.error(L10nSingleton.getMsgS('SOURCE_TEXT_CONVERT_ERROR'))
NotificationSingleton.addNotification({
Expand All @@ -195,7 +195,8 @@ export default class SourceText {
if (jsonData.textId) {
sourceText.id = jsonData.textId
}
sourceText.skipDetected = true

sourceText.skipDetected = skipDetected
return sourceText
}

Expand Down

0 comments on commit bb2337a

Please sign in to comment.