summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBotond Hende <nettingman@gmail.com>2024-10-19 12:07:12 +0200
committerBotond Hende <nettingman@gmail.com>2024-10-19 12:07:12 +0200
commitd6e55af9f2421641a5d4c8945869a1463b353272 (patch)
tree74e71b15f1218a1b59c0db114604f9b2f94a7c2e
parent3cc11c690197dfd321e9580a6e3a7221bddc1dc9 (diff)
search for processes in /usr/bin instead of using wildcard
-rw-r--r--__main__.py15
-rw-r--r--sentences/process_HesExecuteProcess.yaml4
2 files changed, 14 insertions, 5 deletions
diff --git a/__main__.py b/__main__.py
index 79d6a23..bae42ce 100644
--- a/__main__.py
+++ b/__main__.py
@@ -1,3 +1,4 @@
+import os
import sys
import yaml
@@ -15,7 +16,19 @@ def main():
yaml_path = Path(sys.argv[1])
yaml_file_paths = yaml_path.glob("*.yaml")
- slot_lists = {}
+ processes = []
+ bin_dir = "/usr/bin"
+ for file in os.listdir(bin_dir):
+ if file == "[":
+ continue
+
+ full_path = os.path.join(bin_dir, file)
+ if os.path.isfile(full_path) or os.path.islink(full_path):
+ processes.append(file)
+
+ slot_lists = {
+ "process": TextSlotList.from_strings(processes)
+ }
for yaml_file_path in yaml_file_paths:
with open(yaml_file_path, "r", encoding="utf-8") as yaml_file:
diff --git a/sentences/process_HesExecuteProcess.yaml b/sentences/process_HesExecuteProcess.yaml
index 8d5669e..f24971b 100644
--- a/sentences/process_HesExecuteProcess.yaml
+++ b/sentences/process_HesExecuteProcess.yaml
@@ -7,10 +7,6 @@ intents:
slots:
domain: "process"
-lists:
- process:
- wildcard: true
-
expansion_rules:
process: "[the ]{process}"
execute: "(execute|open|run|start)" \ No newline at end of file