forked from nique_372/SimPHash
156 lines
No EOL
6 KiB
JSON
156 lines
No EOL
6 KiB
JSON
{
|
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
"title": "SimPHash Config",
|
|
"description": "Config file consumed by SimPHash (see Src/Template/README.md for full parameter docs).",
|
|
"type": "object",
|
|
"properties": {
|
|
"max_attepms": {
|
|
"type": "integer",
|
|
"minimum": 1,
|
|
"description": "Maximum displacement attempts (seed values 0, 1, 2, ...) tried per bucket before giving up."
|
|
},
|
|
"namespace": {
|
|
"type": ["string", "null"],
|
|
"description": "Namespace the generated tables/function are wrapped in. Leave empty or null to skip."
|
|
},
|
|
"file_name_out": {
|
|
"type": "string",
|
|
"description": "Path of the .mqh file to generate."
|
|
},
|
|
"table_prefix": {
|
|
"type": "string",
|
|
"description": "Prefix used for all generated table names (<prefix>_seeds, <prefix>_hashes, <prefix>_values/<prefix>_tindex)."
|
|
},
|
|
"copyright": {
|
|
"type": "string",
|
|
"description": "Text written into the generated file's #property copyright."
|
|
},
|
|
"link": {
|
|
"type": "string",
|
|
"description": "Text written into the generated file's #property link."
|
|
},
|
|
"func_name": {
|
|
"type": "string",
|
|
"description": "Name of the generated lookup function."
|
|
},
|
|
"def_name_table_size": {
|
|
"type": "string",
|
|
"description": "Name of the #define for the final table size."
|
|
},
|
|
"def_bucket_size_name": {
|
|
"type": "string",
|
|
"description": "Name of the #define for the bucket count."
|
|
},
|
|
"invalid_value": {
|
|
"type": ["integer", "number", "string"],
|
|
"description": "Value returned by the generated function when a key isn't found (also used to fill unused slots)."
|
|
},
|
|
"comment_funct": {
|
|
"type": "boolean",
|
|
"description": "If true, the generated function body is wrapped in /* */ (useful when you only want the tables and will write the function yourself)."
|
|
},
|
|
"guard_name": {
|
|
"type": ["string", "null"],
|
|
"description": "Optional #ifndef/#define include guard name for the generated file."
|
|
},
|
|
"bin": {
|
|
"type": "object",
|
|
"description": "Optional: if present, the raw tables are also written as binary files.",
|
|
"properties": {
|
|
"seeds": { "type": "string", "description": "Output path for the seeds .bin file." },
|
|
"values": { "type": "string", "description": "Output path for the values .bin file." },
|
|
"meta": { "type": "string", "description": "Output path for the meta .bin file." },
|
|
"hash": { "type": "string", "description": "Output path for the hashes .bin file." }
|
|
},
|
|
"additionalProperties": false
|
|
},
|
|
"hash": {
|
|
"type": "object",
|
|
"description": "Bucket hash: converts each string key into a ulong before bucketing.",
|
|
"properties": {
|
|
"type": {
|
|
"type": "string",
|
|
"enum": ["TSN_PHASH_TYPE_FNV1A_64", "TSN_PHASH_TYPE_XXHASH_64"],
|
|
"description": "Bucket hash algorithm."
|
|
},
|
|
"config": {
|
|
"type": "object",
|
|
"description": "Algorithm-specific settings. Use 'basis'/'prime' for TSN_PHASH_TYPE_FNV1A_64, or 'seed' for TSN_PHASH_TYPE_XXHASH_64.",
|
|
"properties": {
|
|
"basis": {
|
|
"type": ["string", "integer"],
|
|
"description": "FNV-1a offset basis. Use the string 'def' for the standard FNV-1a-64 constant, or a numeric value to override it."
|
|
},
|
|
"prime": {
|
|
"type": ["string", "integer"],
|
|
"description": "FNV-1a prime. Use the string 'def' for the standard FNV-1a-64 constant, or a numeric value to override it."
|
|
},
|
|
"seed": {
|
|
"type": "integer",
|
|
"description": "xxHash64 seed (only used when hash.type is TSN_PHASH_TYPE_XXHASH_64)."
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
}
|
|
},
|
|
"required": ["type"],
|
|
"additionalProperties": false
|
|
},
|
|
"final_hash": {
|
|
"type": "string",
|
|
"enum": ["HASH_UL1_MUR_MUR", "HASH_UL1_SPLITMIX", "HASH_UL1_FMIX", "HASH_UL1_FIBBO"],
|
|
"description": "Final per-bucket displacement hash, applied to the already-bucketed ulong key plus a seed."
|
|
},
|
|
"perfect_hash": {
|
|
"type": "object",
|
|
"description": "Perfect-hash construction settings.",
|
|
"properties": {
|
|
"elements_por_bucket": {
|
|
"type": "number",
|
|
"exclusiveMinimum": 0,
|
|
"description": "Target average number of keys per bucket (lower = more buckets, generally faster to find a working seed)."
|
|
},
|
|
"load_factor": {
|
|
"type": "number",
|
|
"exclusiveMinimum": 0,
|
|
"maximum": 1,
|
|
"description": "Final table load factor (keys / final table size). Lower leaves more free slots, easing displacement at the cost of memory."
|
|
}
|
|
},
|
|
"required": ["elements_por_bucket", "load_factor"],
|
|
"additionalProperties": false
|
|
},
|
|
"map_use_value": {
|
|
"type": "boolean",
|
|
"description": "true = generate a values table (function returns the value directly). false = generate an indices table (function returns a position for you to index your own array with)."
|
|
},
|
|
"map": {
|
|
"description": "The key set. An object (KEY: value) when map_use_value is true, or an array of key strings when map_use_value is false.",
|
|
"anyOf": [
|
|
{
|
|
"type": "object",
|
|
"description": "Used when map_use_value: true — each key maps to the value the generated function should return.",
|
|
"additionalProperties": {
|
|
"type": ["integer", "number", "string"]
|
|
}
|
|
},
|
|
{
|
|
"type": "array",
|
|
"description": "Used when map_use_value: false — plain list of keys; the generated function returns each key's index.",
|
|
"items": { "type": "string" }
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"required": [
|
|
"file_name_out",
|
|
"func_name",
|
|
"invalid_value",
|
|
"hash",
|
|
"final_hash",
|
|
"perfect_hash",
|
|
"map_use_value",
|
|
"map"
|
|
],
|
|
"additionalProperties": false
|
|
} |