mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-14 13:18:15 +02:00
+14
-14
@@ -19,7 +19,7 @@ const YAML = require('js-yaml');
|
||||
|
||||
const fieldSchema = require('./data/presets/schema/field.json');
|
||||
const presetSchema = require('./data/presets/schema/preset.json');
|
||||
const suggestions = require('name-suggestion-index').names;
|
||||
const suggestions = require('name-suggestion-index').brands.brands;
|
||||
const deprecated = require('./data/deprecated.json').dataDeprecated;
|
||||
|
||||
// fontawesome icons
|
||||
@@ -200,18 +200,18 @@ function generateFields(tstrings, faIcons) {
|
||||
|
||||
function suggestionsToPresets(presets) {
|
||||
|
||||
for (var key in suggestions) {
|
||||
for (var value in suggestions[key]) {
|
||||
for (var name in suggestions[key][value]) {
|
||||
addSuggestion(key, value, name);
|
||||
}
|
||||
}
|
||||
}
|
||||
Object.keys(suggestions).forEach(k => {
|
||||
const suggestion = suggestions[k];
|
||||
const qid = suggestion.tags['brand:wikidata'];
|
||||
if (!qid || !/^Q\d+$/.test(qid)) return; // wikidata tag missing or looks wrong..
|
||||
|
||||
const parts = k.split('|', 2);
|
||||
const tag = parts[0].split('/', 2);
|
||||
const key = tag[0];
|
||||
const value = tag[1];
|
||||
const name = parts[1].replace('~', ' ');
|
||||
|
||||
function addSuggestion(key, value, name) {
|
||||
var suggestion = suggestions[key][value][name];
|
||||
var presetID, preset;
|
||||
let presetID, preset;
|
||||
|
||||
// sometimes we can find a more specific preset then key/value..
|
||||
if (suggestion.tags.cuisine) {
|
||||
@@ -238,8 +238,8 @@ function suggestionsToPresets(presets) {
|
||||
return;
|
||||
}
|
||||
|
||||
var wikidataTag = { 'brand:wikidata': suggestion.tags['brand:wikidata'] };
|
||||
var suggestionID = presetID + '/' + name;
|
||||
let wikidataTag = { 'brand:wikidata': qid };
|
||||
let suggestionID = presetID + '/' + name;
|
||||
|
||||
presets[suggestionID] = {
|
||||
name: name,
|
||||
@@ -252,7 +252,7 @@ function suggestionsToPresets(presets) {
|
||||
matchScore: 2,
|
||||
suggestion: true
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
return presets;
|
||||
}
|
||||
|
||||
+651
-367
File diff suppressed because it is too large
Load Diff
@@ -1,16 +1,17 @@
|
||||
import _clone from 'lodash-es/clone';
|
||||
import { filters } from 'name-suggestion-index';
|
||||
|
||||
import { t } from '../util/locale';
|
||||
import { utilPreset } from '../util';
|
||||
import { validationIssue, validationIssueFix } from '../core/validator';
|
||||
import { actionChangeTags } from '../actions';
|
||||
import { discardNames } from '../../node_modules/name-suggestion-index/config/filters.json';
|
||||
|
||||
|
||||
export function validationGenericName() {
|
||||
var type = 'generic_name';
|
||||
|
||||
// known list of generic names (e.g. "bar")
|
||||
var discardNamesRegexes = discardNames.map(function(discardName) {
|
||||
var discardNamesRegexes = filters.discardNames.map(function(discardName) {
|
||||
return new RegExp(discardName, 'i');
|
||||
});
|
||||
|
||||
|
||||
+1
-1
@@ -74,7 +74,7 @@
|
||||
"minimist": "^1.2.0",
|
||||
"mocha": "^6.0.0",
|
||||
"mocha-phantomjs-core": "^2.1.0",
|
||||
"name-suggestion-index": "1.0.6",
|
||||
"name-suggestion-index": "2.0.0",
|
||||
"npm-run-all": "^4.0.0",
|
||||
"osm-community-index": "0.6.0",
|
||||
"phantomjs-prebuilt": "~2.1.11",
|
||||
|
||||
Reference in New Issue
Block a user