forked from Open-CT/openbrain
Fix small bugs.
This commit is contained in:
parent
268515e83f
commit
0c3363b118
|
@ -32,14 +32,21 @@ func GetWordsetGraph(id string, clusterNumber int, distanceLimit int) *Graph {
|
|||
return nil
|
||||
}
|
||||
|
||||
if len(wordset.Vectors[0].Data) == 0 {
|
||||
allZero := true
|
||||
for _, vector := range wordset.Vectors {
|
||||
if len(vector.Data) != 0 {
|
||||
allZero = false
|
||||
break
|
||||
}
|
||||
}
|
||||
if allZero {
|
||||
return nil
|
||||
}
|
||||
|
||||
runKmeans(wordset.Vectors, clusterNumber)
|
||||
|
||||
g = generateGraph(wordset.Vectors, distanceLimit)
|
||||
graphCache[cacheId] = g
|
||||
//graphCache[cacheId] = g
|
||||
return g
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ class WordsetGraph extends React.Component {
|
|||
strength: 20,
|
||||
distanceMax: 100,
|
||||
clusterNumber: 100,
|
||||
distanceLimit: 14,
|
||||
distanceLimit: this.props.wordset.distanceLimit,
|
||||
selectedType: null,
|
||||
selectedId: null,
|
||||
selectedIds: [],
|
||||
|
@ -315,7 +315,7 @@ class WordsetGraph extends React.Component {
|
|||
</span>
|
||||
</Col>
|
||||
<Col style={{marginTop: '5px', textAlign: 'center'}} span={12}>
|
||||
<InputNumber style={{width: "100%"}} min={5} max={20} step={1} value={this.state.distanceLimit} onChange={value => {
|
||||
<InputNumber style={{width: "100%"}} min={1} max={20} step={1} value={this.state.distanceLimit} onChange={value => {
|
||||
this.setState({
|
||||
distanceLimit: value,
|
||||
});
|
||||
|
|
|
@ -162,7 +162,7 @@ class WordsetListPage extends React.Component {
|
|||
render: (text, record, index) => {
|
||||
return (
|
||||
<div>
|
||||
<Button style={{marginTop: '10px', marginBottom: '10px', marginRight: '10px'}} onClick={() => this.props.history.push(`/wordsets/${record.name}/graph`)}>{i18next.t("general:Result")}</Button>
|
||||
<Button style={{marginTop: '10px', marginBottom: '10px', marginRight: '10px'}} onClick={() => Setting.openLink(`/wordsets/${record.name}/graph`)}>{i18next.t("general:Result")}</Button>
|
||||
<Button style={{marginBottom: '10px', marginRight: '10px'}} type="primary" onClick={() => this.props.history.push(`/wordsets/${record.name}`)}>{i18next.t("general:Edit")}</Button>
|
||||
<Popconfirm
|
||||
title={`Sure to delete wordset: ${record.name} ?`}
|
||||
|
|
Loading…
Reference in New Issue