Skip to content

Commit

Permalink
minor
Browse files Browse the repository at this point in the history
  • Loading branch information
vmonakhov committed Oct 8, 2024
1 parent 364d87b commit 3520ec8
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 50 deletions.
92 changes: 45 additions & 47 deletions src/components/CognateAnalysisModal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down Expand Up @@ -2862,8 +2860,8 @@ class CognateAnalysisModal extends React.Component {
<span className="lingvo-cognate-result-tit">
{ this.context(
fileSuite
? "Json file(s) for complex result:"
: "Please choose result files for merging (use <Ctrl> button for multiselect)"
? "Json file(s) for composite result:"
: "Please choose analyses results for merging (use <Ctrl> button for multiselect)"
)}
</span>

Expand Down Expand Up @@ -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")}
</Modal.Header>

Expand Down
9 changes: 6 additions & 3 deletions src/pages/ToolsRoute/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,13 @@ function ToolsRoute({ user, actions }) {
</Link>
)}
{user.id !== undefined && (
<Button className="card-item" onClick={() => actions.cognateAnalysisOpenModal(null, "complex_distance")}>
<label className="card-item__label">{getTranslation("Get complex distance between languages")}</label>
<Link className="card-item"
to="/tools"
onClick={() => actions.cognateAnalysisOpenModal(null, "complex_distance")}
>
<label className="card-item__label">{getTranslation("Get composite distance between languages")}</label>
<img className="card-item__img card-item__img_map" src={imageMap} />
</Button>
</Link>
)}
</div>
</div>
Expand Down

0 comments on commit 3520ec8

Please sign in to comment.