提交 6b2febf6 编写于 作者: L luxin

add keywords_must and keywords_forbid

上级 50a7f87b
......@@ -10,7 +10,11 @@
],
"children": [],
"node_id": "opencv-626bf6e70ba04d18b1147571c08d85bc",
"title": "OpenCV的起源"
"title": "OpenCV的起源",
"keywords_must": [
"起源"
],
"keywords_forbid": []
}
}
],
......@@ -18,5 +22,9 @@
"helloworld.json"
],
"node_id": "opencv-77f629e4593845b0bf97e74ca8ec95ae",
"title": "OpenCV简介"
"title": "OpenCV简介",
"keywords_must": [
"简介"
],
"keywords_forbid": []
}
\ No newline at end of file
......@@ -4,6 +4,10 @@
"node_id": "opencv-662dbd65c89d4ddb9e392f44ffe16e1a",
"title": "OpenCV安装",
"export": [
"install.json"
]
"install.json"
],
"keywords_must": [
"安装"
],
"keywords_forbid": []
}
\ No newline at end of file
......@@ -8,5 +8,9 @@
"pixel.json",
"hack.json",
"ball.json"
]
],
"keywords_must": [
"基本操作"
],
"keywords_forbid": []
}
\ No newline at end of file
......@@ -3,9 +3,14 @@
"keywords": [],
"children": [],
"export": [
"img_read_write.json",
"video_read_write.json",
"img_buffer_convert.json",
"doodle.json"
]
"img_read_write.json",
"video_read_write.json",
"img_buffer_convert.json",
"doodle.json"
],
"keywords_must": [
"IO",
"GUI"
],
"keywords_forbid": []
}
\ No newline at end of file
{
"keywords": [],
"node_id": "opencv-f7ecf411195447b3897ff2324f7aa11b",
"title": "OpenCV基础"
"title": "OpenCV基础",
"keywords_must": [],
"keywords_forbid": []
}
\ No newline at end of file
......@@ -4,5 +4,9 @@
"children": [],
"export": [
"Grayscale.json"
]
],
"keywords_must": [
"阈值"
],
"keywords_forbid": []
}
\ No newline at end of file
......@@ -4,5 +4,10 @@
"children": [],
"export": [
"erosion_dilation.json"
]
],
"keywords_must": [
"腐蚀",
"膨胀"
],
"keywords_forbid": []
}
\ No newline at end of file
......@@ -5,5 +5,10 @@
"export": [
"open.json",
"close.json"
]
],
"keywords_must": [
"开运算",
"闭运算"
],
"keywords_forbid": []
}
\ No newline at end of file
......@@ -4,5 +4,9 @@
"children": [],
"export": [
"connect.json"
]
],
"keywords_must": [
"连通区域分析"
],
"keywords_forbid": []
}
\ No newline at end of file
......@@ -4,5 +4,9 @@
"children": [],
"export": [
"Contours.json"
]
],
"keywords_must": [
"轮廓"
],
"keywords_forbid": []
}
\ No newline at end of file
{
"node_id": "opencv-c761ca9b99984b2d8633855c527ab10a",
"keywords": []
"keywords": [],
"keywords_must": [],
"keywords_forbid": []
}
\ No newline at end of file
......@@ -4,5 +4,9 @@
"children": [],
"export": [
"flower.json"
]
],
"keywords_must": [
"彩色空间"
],
"keywords_forbid": []
}
\ No newline at end of file
......@@ -4,5 +4,9 @@
"children": [],
"export": [
"fish.json"
]
],
"keywords_must": [
"均衡化"
],
"keywords_forbid": []
}
\ No newline at end of file
......@@ -4,5 +4,9 @@
"children": [],
"export": [
"BoxFilter.json"
]
],
"keywords_must": [
"图像滤波"
],
"keywords_forbid": []
}
\ No newline at end of file
......@@ -4,5 +4,9 @@
"children": [],
"export": [
"Gradient.json"
]
],
"keywords_must": [
"梯度"
],
"keywords_forbid": []
}
\ No newline at end of file
{
"node_id": "opencv-88ba9fbf01cc42af9561dc99151b351a",
"keywords": []
"keywords": [],
"keywords_must": [],
"keywords_forbid": []
}
\ No newline at end of file
......@@ -4,5 +4,9 @@
"children": [],
"export": [
"Affine1.json"
]
],
"keywords_must": [
"仿射变换"
],
"keywords_forbid": []
}
\ No newline at end of file
......@@ -4,5 +4,9 @@
"children": [],
"export": [
"rust_face.json"
]
],
"keywords_must": [
"单应性"
],
"keywords_forbid": []
}
\ No newline at end of file
......@@ -4,5 +4,10 @@
"children": [],
"export": [
"harris.json"
]
],
"keywords_must": [
"图像特征",
"特征提取"
],
"keywords_forbid": []
}
\ No newline at end of file
......@@ -4,5 +4,9 @@
"children": [],
"export": [
"match.json"
]
],
"keywords_must": [
"特征匹配"
],
"keywords_forbid": []
}
\ No newline at end of file
{
"node_id": "opencv-ec67edb4eecb44e396d7e7f7163fedb7",
"keywords": []
"keywords": [],
"keywords_must": [],
"keywords_forbid": []
}
\ No newline at end of file
......@@ -4,5 +4,9 @@
"children": [],
"export": [
"face_detect.json"
]
],
"keywords_must": [
"人脸识别"
],
"keywords_forbid": []
}
\ No newline at end of file
......@@ -4,5 +4,10 @@
"children": [],
"export": [
"detect_bird.json"
]
],
"keywords_must": [
"鸟类",
"鸟图"
],
"keywords_forbid": []
}
\ No newline at end of file
{
"node_id": "opencv-6794162341944f869fcefa767cba00c7",
"keywords": []
"keywords": [],
"keywords_must": [],
"keywords_forbid": []
}
\ No newline at end of file
......@@ -4,5 +4,9 @@
"children": [],
"export": [
"flow.json"
]
],
"keywords_must": [
"光流"
],
"keywords_forbid": []
}
\ No newline at end of file
......@@ -4,5 +4,9 @@
"children": [],
"export": [
"obj_tracker.json"
]
],
"keywords_must": [
"目标跟踪"
],
"keywords_forbid": []
}
\ No newline at end of file
{
"node_id": "opencv-6bd1f503ebb6418da84be85f4766aa83",
"keywords": []
"keywords": [],
"keywords_must": [],
"keywords_forbid": []
}
\ No newline at end of file
......@@ -4,5 +4,9 @@
"children": [],
"export": [
"classification.json"
]
],
"keywords_must": [
"图像分类"
],
"keywords_forbid": []
}
\ No newline at end of file
......@@ -4,5 +4,9 @@
"children": [],
"export": [
"deep_learning_object_detection.json"
]
],
"keywords_must": [
"目标检测"
],
"keywords_forbid": []
}
\ No newline at end of file
......@@ -4,5 +4,9 @@
"children": [],
"export": [
"detect_faces.json"
]
],
"keywords_must": [
"人脸检测"
],
"keywords_forbid": []
}
\ No newline at end of file
......@@ -4,5 +4,9 @@
"children": [],
"export": [
"attitude_estimation.json"
]
],
"keywords_must": [
"姿态估计"
],
"keywords_forbid": []
}
\ No newline at end of file
......@@ -4,5 +4,9 @@
"export": [
"opencv-yolo-inference-vehicle.json"
],
"node_id": "opencv-d3ca3567cef647b9bb960d7216361351"
"node_id": "opencv-d3ca3567cef647b9bb960d7216361351",
"keywords_must": [
"车辆检测"
],
"keywords_forbid": []
}
\ No newline at end of file
{
"node_id": "opencv-81b455e5341a4d26863ee2519c9b2d70",
"keywords": []
"keywords": [],
"keywords_must": [],
"keywords_forbid": []
}
\ No newline at end of file
......@@ -2,5 +2,7 @@
"export": [],
"node_id": "opencv-b943de85e3ad494885f0b4b529053c5a",
"title": "OpenCV初阶",
"keywords":[]
"keywords": [],
"keywords_must": [],
"keywords_forbid": []
}
\ No newline at end of file
......@@ -2,5 +2,7 @@
"export": [],
"keywords": [],
"node_id": "opencv-e92c03e7b84c4c4ea7d23a2c32b88932",
"title": "OpenCV中阶"
"title": "OpenCV中阶",
"keywords_must": [],
"keywords_forbid": []
}
\ No newline at end of file
......@@ -2,5 +2,7 @@
"export": [],
"keywords": [],
"node_id": "opencv-f27da6fd72924d1fbd05c6aff0fed4b7",
"title": "OpenCV高阶"
"title": "OpenCV高阶",
"keywords_must": [],
"keywords_forbid": []
}
\ No newline at end of file
......@@ -2,5 +2,7 @@
"tree_name": "opencv",
"keywords": [],
"title": "OpenCV",
"node_id": "opencv-22ad85b4166044c897cd32f625d21001"
"node_id": "opencv-22ad85b4166044c897cd32f625d21001",
"keywords_must": [],
"keywords_forbid": []
}
\ No newline at end of file
......@@ -27,17 +27,29 @@
],
"children": [],
"node_id": "opencv-626bf6e70ba04d18b1147571c08d85bc",
"title": "OpenCV的起源"
"title": "OpenCV的起源",
"keywords_must": [
"起源"
],
"keywords_forbid": []
}
}
]
],
"keywords_must": [
"简介"
],
"keywords_forbid": []
}
},
{
"OpenCV安装": {
"node_id": "opencv-662dbd65c89d4ddb9e392f44ffe16e1a",
"keywords": [],
"children": []
"children": [],
"keywords_must": [
"安装"
],
"keywords_forbid": []
}
},
{
......@@ -46,17 +58,28 @@
"keywords": [
"OpenCV颜色空间"
],
"children": []
"children": [],
"keywords_must": [
"基本操作"
],
"keywords_forbid": []
}
},
{
"IO与GUI": {
"node_id": "opencv-04cf975c42894174bd5619ed44ea5e87",
"keywords": [],
"children": []
"children": [],
"keywords_must": [
"IO",
"GUI"
],
"keywords_forbid": []
}
}
]
],
"keywords_must": [],
"keywords_forbid": []
}
},
{
......@@ -68,38 +91,62 @@
"阈值": {
"node_id": "opencv-b77391c3fa5648f4bb92e990d6cf1922",
"keywords": [],
"children": []
"children": [],
"keywords_must": [
"阈值"
],
"keywords_forbid": []
}
},
{
"腐蚀与膨胀": {
"node_id": "opencv-43cb627865154bb69eaad017845e8944",
"keywords": [],
"children": []
"children": [],
"keywords_must": [
"腐蚀",
"膨胀"
],
"keywords_forbid": []
}
},
{
"开运算与闭运算": {
"node_id": "opencv-50c11401b1e8431c964f0771cfe7941b",
"keywords": [],
"children": []
"children": [],
"keywords_must": [
"开运算",
"闭运算"
],
"keywords_forbid": []
}
},
{
"连通区域分析": {
"node_id": "opencv-4fa8c9dee0b04714b3a9ac7ba402be5b",
"keywords": [],
"children": []
"children": [],
"keywords_must": [
"连通区域分析"
],
"keywords_forbid": []
}
},
{
"轮廓": {
"node_id": "opencv-9f13f163a994474a9edafc12adcfe529",
"keywords": [],
"children": []
"children": [],
"keywords_must": [
"轮廓"
],
"keywords_forbid": []
}
}
]
],
"keywords_must": [],
"keywords_forbid": []
}
},
{
......@@ -111,31 +158,49 @@
"彩色空间": {
"node_id": "opencv-996898f197114cd3b4195cc6de7edc42",
"keywords": [],
"children": []
"children": [],
"keywords_must": [
"彩色空间"
],
"keywords_forbid": []
}
},
{
"直方图均衡化": {
"node_id": "opencv-42497d66251142e58892ffdd81a59d5a",
"keywords": [],
"children": []
"children": [],
"keywords_must": [
"均衡化"
],
"keywords_forbid": []
}
},
{
"图像滤波": {
"node_id": "opencv-ff01e231d0234005b8167d63652c827b",
"keywords": [],
"children": []
"children": [],
"keywords_must": [
"图像滤波"
],
"keywords_forbid": []
}
},
{
"梯度": {
"node_id": "opencv-bc6db682e6744c048c801360db22b182",
"keywords": [],
"children": []
"children": [],
"keywords_must": [
"梯度"
],
"keywords_forbid": []
}
}
]
],
"keywords_must": [],
"keywords_forbid": []
}
},
{
......@@ -147,31 +212,50 @@
"仿射变换": {
"node_id": "opencv-2ee9206f0d84472cb0458b4c5fd695cc",
"keywords": [],
"children": []
"children": [],
"keywords_must": [
"仿射变换"
],
"keywords_forbid": []
}
},
{
"单应性变换": {
"node_id": "opencv-39059ce222a240309afeb5b18dfe528e",
"keywords": [],
"children": []
"children": [],
"keywords_must": [
"单应性"
],
"keywords_forbid": []
}
},
{
"图像特征与特征提取": {
"node_id": "opencv-fde1c160abc94e49bb7811fa6b90b9a7",
"keywords": [],
"children": []
"children": [],
"keywords_must": [
"图像特征",
"特征提取"
],
"keywords_forbid": []
}
},
{
"特征匹配": {
"node_id": "opencv-47d476b32cc94ce48346eebaf03a61ae",
"keywords": [],
"children": []
"children": [],
"keywords_must": [
"特征匹配"
],
"keywords_forbid": []
}
}
]
],
"keywords_must": [],
"keywords_forbid": []
}
},
{
......@@ -183,17 +267,28 @@
"人脸识别": {
"node_id": "opencv-cc6f5f3a5c2d494c8574a55c8e43c237",
"keywords": [],
"children": []
"children": [],
"keywords_must": [
"人脸识别"
],
"keywords_forbid": []
}
},
{
"鸟图识别": {
"node_id": "opencv-c20cf8a094924526931da798e2642418",
"keywords": [],
"children": []
"children": [],
"keywords_must": [
"鸟类",
"鸟图"
],
"keywords_forbid": []
}
}
]
],
"keywords_must": [],
"keywords_forbid": []
}
},
{
......@@ -205,17 +300,27 @@
"光流": {
"node_id": "opencv-e7cb65bb329040e98c85d2888f18d8bb",
"keywords": [],
"children": []
"children": [],
"keywords_must": [
"光流"
],
"keywords_forbid": []
}
},
{
"目标跟踪": {
"node_id": "opencv-2959bd73f3894090b4a65be4fe8faff6",
"keywords": [],
"children": []
"children": [],
"keywords_must": [
"目标跟踪"
],
"keywords_forbid": []
}
}
]
],
"keywords_must": [],
"keywords_forbid": []
}
},
{
......@@ -227,57 +332,87 @@
"图像分类": {
"node_id": "opencv-a181ede3b8c7487fbcc212796c27ce77",
"keywords": [],
"children": []
"children": [],
"keywords_must": [
"图像分类"
],
"keywords_forbid": []
}
},
{
"目标检测": {
"node_id": "opencv-92964722395c4b9f989694211b07df44",
"keywords": [],
"children": []
"children": [],
"keywords_must": [
"目标检测"
],
"keywords_forbid": []
}
},
{
"人脸检测": {
"node_id": "opencv-a05295f5c1b94fdcaa370a45621cd5a5",
"keywords": [],
"children": []
"children": [],
"keywords_must": [
"人脸检测"
],
"keywords_forbid": []
}
},
{
"姿态估计": {
"node_id": "opencv-8bcc98575f3b4325b84fcb623916e3d2",
"keywords": [],
"children": []
"children": [],
"keywords_must": [
"姿态估计"
],
"keywords_forbid": []
}
},
{
"车辆检测": {
"node_id": "opencv-d3ca3567cef647b9bb960d7216361351",
"keywords": [],
"children": []
"children": [],
"keywords_must": [
"车辆检测"
],
"keywords_forbid": []
}
}
]
],
"keywords_must": [],
"keywords_forbid": []
}
}
]
],
"keywords_must": [],
"keywords_forbid": []
}
},
{
"OpenCV中阶": {
"node_id": "opencv-e92c03e7b84c4c4ea7d23a2c32b88932",
"keywords": [],
"children": []
"children": [],
"keywords_must": [],
"keywords_forbid": []
}
},
{
"OpenCV高阶": {
"node_id": "opencv-f27da6fd72924d1fbd05c6aff0fed4b7",
"keywords": [],
"children": []
"children": [],
"keywords_must": [],
"keywords_forbid": []
}
}
]
],
"keywords_must": [],
"keywords_forbid": []
}
}
\ No newline at end of file
......@@ -109,7 +109,9 @@ class TreeWalker:
root_node = {
"node_id": root["node_id"],
"keywords": root["keywords"],
"children": []
"children": [],
"keywords_must": root["keywords_must"],
"keywords_forbid": root["keywords_forbid"]
}
self.tree[root["tree_name"]] = root_node
self.load_levels(root_node)
......@@ -164,6 +166,8 @@ class TreeWalker:
"node_id": config["node_id"],
"keywords": config["keywords"],
"children": [],
"keywords_must": config["keywords_must"],
"keywords_forbid": config["keywords_forbid"]
}
}
......@@ -215,6 +219,8 @@ class TreeWalker:
"tree_name": self.name,
"keywords": [],
"node_id": self.gen_node_id(),
"keywords_must": [],
"keywords_forbid": []
}
dump_json(config_path, config, exist_ok=True, override=True)
else:
......@@ -244,7 +250,9 @@ class TreeWalker:
if not os.path.exists(config_path):
config = {
"node_id": self.gen_node_id(),
"keywords": []
"keywords": [],
"keywords_must": [],
"keywords_forbid": []
}
dump_json(config_path, config, exist_ok=True, override=True)
else:
......@@ -310,6 +318,8 @@ class TreeWalker:
"node_id": config["node_id"],
"keywords": config["keywords"],
"children": [],
"keywords_must": config["keywords_must"],
"keywords_forbid": config["keywords_forbid"]
}
}
return num, result
......@@ -321,7 +331,9 @@ class TreeWalker:
name: {
"node_id": config["node_id"],
"keywords": config["keywords"],
"children": config.get("children", [])
"children": config.get("children", []),
"keywords_must": config["keywords_must"],
"keywords_forbid": config["keywords_forbid"]
}
}
# if "children" in config:
......@@ -367,20 +379,18 @@ class TreeWalker:
with open(meta_path) as f:
content = f.read()
if content:
try:
meta = json.loads(content)
if "exercise_id" not in meta:
meta["exercise_id"] = uuid.uuid4().hex
if "notebook_enable" not in meta:
meta["notebook_enable"] = self.default_notebook()
if "source" not in meta:
meta["source"] = source
if "author" not in meta:
meta["author"] = user_name(md_file, self.authors)
if "type" not in meta:
meta["type"] = "code_options"
except:
pass
meta = json.loads(content)
if "exercise_id" not in meta:
meta["exercise_id"] = uuid.uuid4().hex
if "notebook_enable" not in meta:
meta["notebook_enable"] = self.default_notebook()
if "source" not in meta:
meta["source"] = source
if "author" not in meta:
meta["author"] = user_name(md_file, self.authors)
if "type" not in meta:
meta["type"] = "code_options"
if meta is None:
meta = {
"type": "code_options",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册