1

Validation

This commit is contained in:
Alex Yatskov 2015-06-29 13:13:54 +09:00
parent cf586e853a
commit 34eb387223
2 changed files with 16 additions and 8 deletions

View File

@ -298,14 +298,15 @@
function updateMode() {
if (_.has(_elements, 'mode')) {
_elements.mode.attr({
text: _data.mode
});
}
else {
_elements.mode = _canvas.text(
(_width - _bracketSize) / 2,
_height - _modeSize / 2,
'x'
_data.mode
).attr({
'dominant-baseline': 'middle',
'text-anchor': 'middle'

17
util.go
View File

@ -39,7 +39,7 @@ func fixFeatures(features featureMap) featureMap {
"affordable": 0.0,
"atmospheric": 0.0}
for name, _ := range fixedFeatures {
for name := range fixedFeatures {
value, _ := features[name]
fixedFeatures[name] = value
}
@ -48,13 +48,20 @@ func fixFeatures(features featureMap) featureMap {
}
func fixModes(modes map[string]string) modeMap {
result := make(modeMap)
fixedModes := modeMap{
"nearby": ModeTypeProduct,
"accessible": ModeTypeProduct,
"delicious": ModeTypeProduct,
"accommodating": ModeTypeProduct,
"affordable": ModeTypeProduct,
"atmospheric": ModeTypeProduct}
for name, value := range modes {
result[name] = strToModeType(value)
for name := range fixedModes {
value, _ := modes[name]
fixedModes[name] = strToModeType(value)
}
return result
return fixedModes
}
func innerProduct(features1 featureMap, features2 featureMap) float64 {