diff --git a/src/components/CognateAnalysisModal/index.js b/src/components/CognateAnalysisModal/index.js index 7e1aa9ce..c6c40ff0 100644 --- a/src/components/CognateAnalysisModal/index.js +++ b/src/components/CognateAnalysisModal/index.js @@ -2152,58 +2152,56 @@ class CognateAnalysisModal extends React.Component { computeComplexDistance } = this.props; - if (this.state.lang_mode === "single" || this.state.lang_mode === "multi") { - const groupField = this.fieldDict[this.state.groupFieldIdStr]; - - /* Gathering info of perspectives we are to analyze. */ - let perspectiveInfoList = []; - const multiList = []; - - if (this.state.lang_mode === "multi") { - for (const language of this.state.language_list) { - let p_count = 0; - - for (const { perspective, treePathList: [subLanguage,] } of language.perspective_list) { - const p_key = id2str(perspective.id); - - if (this.state.perspectiveSelectionMap[p_key]) { - perspectiveInfoList.push([ - subLanguage.__typename === "Language" ? subLanguage.id : this.baseLanguageId, - perspective.id, - this.fieldDict[this.state.transcriptionFieldIdStrMap[p_key]].id, - this.fieldDict[this.state.translationFieldIdStrMap[p_key]].id, - this.fieldDict[this.state.lexemeFieldIdStrMap[p_key]].id - ]); - - p_count++; - } - } + const groupField = this.fieldDict[this.state.groupFieldIdStr]; - multiList.push([language.id, p_count]); - } - } else { - perspectiveInfoList = this.perspective_list + /* Gathering info of perspectives we are to analyze. */ + let perspectiveInfoList = []; + const multiList = []; + + if (this.state.lang_mode === "multi") { + for (const language of this.state.language_list) { + let p_count = 0; - .map(({ perspective, treePathList: [subLanguage,] }, index) => [ - subLanguage.__typename === "Language" ? subLanguage.id : this.baseLanguageId, - perspective.id, - this.fieldDict[this.state.transcriptionFieldIdStrList[index]].id, - this.fieldDict[this.state.translationFieldIdStrList[index]].id, - this.fieldDict[this.state.lexemeFieldIdStrList[index]].id - ]) + for (const { perspective, treePathList: [subLanguage,] } of language.perspective_list) { + const p_key = id2str(perspective.id); - .filter((perspective_info, index) => this.state.perspectiveSelectionList[index]); + if (this.state.perspectiveSelectionMap[p_key]) { + perspectiveInfoList.push([ + subLanguage.__typename === "Language" ? subLanguage.id : this.baseLanguageId, + perspective.id, + this.fieldDict[this.state.transcriptionFieldIdStrMap[p_key]].id, + this.fieldDict[this.state.translationFieldIdStrMap[p_key]].id, + this.fieldDict[this.state.lexemeFieldIdStrMap[p_key]].id + ]); + + p_count++; + } + } + + multiList.push([language.id, p_count]); } + } else if (this.state.lang_mode === "single") { + perspectiveInfoList = this.perspective_list - /* Match translations parameter for suggestions. */ + .map(({ perspective, treePathList: [subLanguage,] }, index) => [ + subLanguage.__typename === "Language" ? subLanguage.id : this.baseLanguageId, + perspective.id, + this.fieldDict[this.state.transcriptionFieldIdStrList[index]].id, + this.fieldDict[this.state.translationFieldIdStrList[index]].id, + this.fieldDict[this.state.lexemeFieldIdStrList[index]].id + ]) - const matchTranslationsValue = this.state.matchTranslationsFlag - ? this.state.matchTranslationsValue === "first_three" - ? 1 - : 2 - : 0; + .filter((perspective_info, index) => this.state.perspectiveSelectionList[index]); } + /* Match translations parameter for suggestions. */ + + const matchTranslationsValue = this.state.matchTranslationsFlag + ? this.state.matchTranslationsValue === "first_three" + ? 1 + : 2 + : 0; + /* If we are to perform acoustic analysis, we will try to launch it in the background. */ if (this.props.mode === "acoustic") { @@ -2862,8 +2860,8 @@ class CognateAnalysisModal extends React.Component { { this.context( fileSuite - ? "Json file(s) for complex result:" - : "Please choose result files for merging (use button for multiselect)" + ? "Json file(s) for composite result:" + : "Please choose analyses results for merging (use button for multiselect)" )} @@ -2949,7 +2947,7 @@ class CognateAnalysisModal extends React.Component { : mode === "multi_morphology" ? this.context("Morphology distance multi-language") : mode === "complex_distance" - ? this.context("Complex distance") + ? this.context("Composite distance") : this.context("Cognate analysis")} diff --git a/src/pages/ToolsRoute/index.js b/src/pages/ToolsRoute/index.js index 50253875..1dec17df 100644 --- a/src/pages/ToolsRoute/index.js +++ b/src/pages/ToolsRoute/index.js @@ -80,10 +80,13 @@ function ToolsRoute({ user, actions }) { )} {user.id !== undefined && ( - + )}