|
@@ -347,7 +347,7 @@ def ffpb_ensurenodeid(nodedata):
|
|
|
|
|
|
return result
|
|
|
|
|
|
-def ffpb_findnode(name, alfred_data=None):
|
|
|
+def ffpb_findnode(name, alfred_data=None, allow_fuzzymatching=True):
|
|
|
"""helper: try to identify the node the user meant by the given name"""
|
|
|
|
|
|
# no name, no node
|
|
@@ -356,6 +356,12 @@ def ffpb_findnode(name, alfred_data=None):
|
|
|
|
|
|
name = str(name).strip()
|
|
|
|
|
|
+ # disable fuzzy matching if name is enclosed in quotes
|
|
|
+ if name.startswith('\'') and name.endswith('\'') or \
|
|
|
+ name.startswith('"') and name.endswith('"'):
|
|
|
+ name = name[1:-1]
|
|
|
+ allow_fuzzymatching = False
|
|
|
+
|
|
|
names = {}
|
|
|
|
|
|
if not alfred_data is None:
|
|
@@ -433,7 +439,7 @@ def ffpb_findnode(name, alfred_data=None):
|
|
|
}
|
|
|
|
|
|
# do a similar name lookup in the ALFRED data
|
|
|
- if not alfred_data is None:
|
|
|
+ if allow_fuzzymatching and not alfred_data is None:
|
|
|
allnames = [x for x in names]
|
|
|
possibilities = difflib.get_close_matches(name, allnames, cutoff=0.75)
|
|
|
print('findnode: Fuzzy matching \'{0}\' got {1} entries: {2}'.format(
|