Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ENH] Match Keywords in Widget Search #3117

Merged
merged 4 commits into from
Jul 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion Orange/canvas/document/quickmenu.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,20 @@ def filterFunc(self):
return self.__filterFunc

def filterAcceptsRow(self, row, parent=QModelIndex()):
accepted = QSortFilterProxyModel.filterAcceptsRow(self, row, parent)
flat_model = self.sourceModel()
index = flat_model.index(row, self.filterKeyColumn(), parent)
description = flat_model.data(index, role=QtWidgetRegistry.WIDGET_DESC_ROLE)
name = description.name
keywords = description.keywords

# match name and keywords
accepted = False
for keyword in [name] + keywords:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about also iterating over filter(None, re.split(r'\W+', description.description.lower()))? This way, many widgets won't even need separate keywords, e.g. K-means already has "clustering", "silhouette", ...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather manually set keywords to be able to finely control what shows up in search, avoiding the overcrowding of search results. Each widget shouldn't need more than a few keywords I think.

if self.filterRegExp().indexIn(keyword) > -1:
accepted = True
break

# if matches query, apply filter function (compatibility with paired widget)
if accepted and self.__filterFunc is not None:
model = self.sourceModel()
index = model.index(row, self.filterKeyColumn(), parent)
Expand Down
1 change: 1 addition & 0 deletions Orange/widgets/data/owconcatenate.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class OWConcatenate(widget.OWWidget):
description = "Concatenate (append) two or more datasets."
priority = 1111
icon = "icons/Concatenate.svg"
keywords = ["append", "join", "extend"]

class Inputs:
primary_data = Input("Primary Data", Orange.data.Table)
Expand Down
2 changes: 1 addition & 1 deletion Orange/widgets/data/owcontinuize.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class OWContinuize(widget.OWWidget):
"optionally, normalize numeric values.")
icon = "icons/Continuize.svg"
category = "Data"
keywords = ["data", "continuize"]
keywords = []

class Inputs:
data = Input("Data", Orange.data.Table)
Expand Down
2 changes: 1 addition & 1 deletion Orange/widgets/data/owcreateclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class OWCreateClass(widget.OWWidget):
description = "Create class attribute from a string attribute"
icon = "icons/CreateClass.svg"
category = "Data"
keywords = ["data"]
keywords = []

class Inputs:
data = Input("Data", Table)
Expand Down
2 changes: 1 addition & 1 deletion Orange/widgets/data/owdatainfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class OWDataInfo(widget.OWWidget):
icon = "icons/DataInfo.svg"
priority = 80
category = "Data"
keywords = ["data", "info"]
keywords = ["information", "inspect"]

class Inputs:
data = Input("Data", Table)
Expand Down
2 changes: 1 addition & 1 deletion Orange/widgets/data/owdatasampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class OWDataSampler(OWWidget):
icon = "icons/DataSampler.svg"
priority = 100
category = "Data"
keywords = ["data", "sample"]
keywords = ["random"]

_MAX_SAMPLE_SIZE = 2 ** 31 - 1

Expand Down
1 change: 1 addition & 0 deletions Orange/widgets/data/owdatasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ class OWDataSets(widget.OWWidget):
icon = "icons/DataSets.svg"
priority = 20
replaces = ["orangecontrib.prototypes.widgets.owdatasets.OWDataSets"]
keywords = ["online"]

# The following constants can be overridden in a subclass
# to reuse this widget for a different repository
Expand Down
1 change: 1 addition & 0 deletions Orange/widgets/data/owdiscretize.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ class OWDiscretize(widget.OWWidget):
name = "Discretize"
description = "Discretize the numeric data features."
icon = "icons/Discretize.svg"
keywords = []

class Inputs:
data = Input("Data", Orange.data.Table, doc="Input data table")
Expand Down
1 change: 1 addition & 0 deletions Orange/widgets/data/oweditdomain.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@ class OWEditDomain(widget.OWWidget):
description = "Rename features and their values."
icon = "icons/EditDomain.svg"
priority = 3125
keywords = []

class Inputs:
data = Input("Data", Orange.data.Table)
Expand Down
1 change: 1 addition & 0 deletions Orange/widgets/data/owfeatureconstructor.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ class OWFeatureConstructor(OWWidget):
description = "Construct new features (data columns) from a set of " \
"existing features in the input dataset."
icon = "icons/FeatureConstructor.svg"
keywords = []

class Inputs:
data = Input("Data", Orange.data.Table)
Expand Down
2 changes: 1 addition & 1 deletion Orange/widgets/data/owfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class OWFile(widget.OWWidget, RecentPathsWComboMixin):
icon = "icons/File.svg"
priority = 10
category = "Data"
keywords = ["data", "file", "load", "read"]
keywords = ["file", "load", "read", "open"]

class Outputs:
data = Output("Data", Table, doc="Attribute-valued dataset read from the input file.")
Expand Down
1 change: 1 addition & 0 deletions Orange/widgets/data/owimpute.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ class OWImpute(OWWidget):
description = "Impute missing values in the data table."
icon = "icons/Impute.svg"
priority = 2130
keywords = ["substitute", "missing"]

class Inputs:
data = Input("Data", Orange.data.Table)
Expand Down
1 change: 1 addition & 0 deletions Orange/widgets/data/owmergedata.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class OWMergeData(widget.OWWidget):
description = "Merge datasets based on the values of selected features."
icon = "icons/MergeData.svg"
priority = 1110
keywords = ["join"]

class Inputs:
data = Input("Data", Orange.data.Table, default=True, replaces=["Data A"])
Expand Down
2 changes: 1 addition & 1 deletion Orange/widgets/data/owoutliers.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class OWOutliers(widget.OWWidget):
icon = "icons/Outliers.svg"
priority = 3000
category = "Data"
keywords = ["data", "outlier", "inlier"]
keywords = ["inlier"]

class Inputs:
data = Input("Data", Table)
Expand Down
2 changes: 1 addition & 1 deletion Orange/widgets/data/owpaintdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,7 @@ class OWPaintData(OWWidget):
description = "Create data by painting data points on a plane."
icon = "icons/PaintData.svg"
priority = 60
keywords = ["data", "paint", "create"]
keywords = ["create", "draw"]

class Inputs:
data = Input("Data", Orange.data.Table)
Expand Down
1 change: 1 addition & 0 deletions Orange/widgets/data/owpreprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -952,6 +952,7 @@ class OWPreprocess(widget.OWWidget):
description = "Construct a data preprocessing pipeline."
icon = "icons/Preprocess.svg"
priority = 2105
keywords = ["process"]

class Inputs:
data = Input("Data", Orange.data.Table)
Expand Down
2 changes: 1 addition & 1 deletion Orange/widgets/data/owpurgedomain.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class OWPurgeDomain(widget.OWWidget):
"Sort values."
icon = "icons/PurgeDomain.svg"
category = "Data"
keywords = ["data", "purge", "domain"]
keywords = ["remove", "delete", "unused"]

class Inputs:
data = Input("Data", Table)
Expand Down
1 change: 1 addition & 0 deletions Orange/widgets/data/owpythonscript.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ class OWPythonScript(widget.OWWidget):
description = "Write a Python script and run it on input data or models."
icon = "icons/PythonScript.svg"
priority = 3150
keywords = ["file", "program"]

class Inputs:
data = Input("Data", Table, replaces=["in_data"],
Expand Down
1 change: 1 addition & 0 deletions Orange/widgets/data/owrandomize.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class OWRandomize(OWWidget):
description = "Randomize features, class and/or metas in data table."
icon = "icons/Random.svg"
priority = 2100
keywords = []

class Inputs:
data = Input("Data", Table)
Expand Down
1 change: 1 addition & 0 deletions Orange/widgets/data/owrank.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ class OWRank(OWWidget):
description = "Rank and filter data features by their relevance."
icon = "icons/Rank.svg"
priority = 1102
keywords = []

buttons_area_orientation = Qt.Vertical

Expand Down
2 changes: 1 addition & 1 deletion Orange/widgets/data/owsave.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class OWSave(widget.OWWidget):
description = "Save data to an output file."
icon = "icons/Save.svg"
category = "Data"
keywords = ["data", "save"]
keywords = []

class Inputs:
data = Input("Data", Table)
Expand Down
1 change: 1 addition & 0 deletions Orange/widgets/data/owselectcolumns.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ class OWSelectAttributes(widget.OWWidget):
"data features, classes or meta variables."
icon = "icons/SelectColumns.svg"
priority = 100
keywords = ["filter"]

class Inputs:
data = Input("Data", Table)
Expand Down
1 change: 1 addition & 0 deletions Orange/widgets/data/owselectrows.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ class OWSelectRows(widget.OWWidget):
icon = "icons/SelectRows.svg"
priority = 100
category = "Data"
keywords = ["filter"]

class Inputs:
data = Input("Data", Table)
Expand Down
2 changes: 1 addition & 1 deletion Orange/widgets/data/owsql.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class OWSql(OWWidget):
icon = "icons/SQLTable.svg"
priority = 30
category = "Data"
keywords = ["data", "file", "load", "read", "SQL"]
keywords = ["load"]

class Outputs:
data = Output("Data", Table, doc="Attribute-valued dataset read from the input file.")
Expand Down
1 change: 1 addition & 0 deletions Orange/widgets/data/owtable.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,7 @@ class OWDataTable(widget.OWWidget):
description = "View the dataset in a spreadsheet."
icon = "icons/Table.svg"
priority = 50
keywords = []

buttons_area_orientation = Qt.Vertical

Expand Down
1 change: 1 addition & 0 deletions Orange/widgets/data/owtranspose.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class OWTranspose(OWWidget):
description = "Transpose data table."
icon = "icons/Transpose.svg"
priority = 2000
keywords = []

class Inputs:
data = Input("Data", Table)
Expand Down
1 change: 1 addition & 0 deletions Orange/widgets/evaluate/owcalibrationplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class OWCalibrationPlot(widget.OWWidget):
description = "Calibration plot based on evaluation of classifiers."
icon = "icons/CalibrationPlot.svg"
priority = 1030
keywords = []

class Inputs:
evaluation_results = Input("Evaluation Results", Orange.evaluation.Results)
Expand Down
1 change: 1 addition & 0 deletions Orange/widgets/evaluate/owconfusionmatrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ class OWConfusionMatrix(widget.OWWidget):
"the results of classifier evaluations."
icon = "icons/ConfusionMatrix.svg"
priority = 1001
keywords = []

class Inputs:
evaluation_results = Input("Evaluation Results", Orange.evaluation.Results)
Expand Down
1 change: 1 addition & 0 deletions Orange/widgets/evaluate/owliftcurve.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class OWLiftCurve(widget.OWWidget):
"from the evaluation of classifiers."
icon = "icons/LiftCurve.svg"
priority = 1020
keywords = []

class Inputs:
evaluation_results = Input("Evaluation Results", Orange.evaluation.Results)
Expand Down
1 change: 1 addition & 0 deletions Orange/widgets/evaluate/owpredictions.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class OWPredictions(OWWidget):
icon = "icons/Predictions.svg"
priority = 200
description = "Display the predictions of models for an input dataset."
keywords = []

class Inputs:
data = Input("Data", Orange.data.Table)
Expand Down
1 change: 1 addition & 0 deletions Orange/widgets/evaluate/owrocanalysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ class OWROCAnalysis(widget.OWWidget):
"based on the evaluation of classifiers."
icon = "icons/ROCAnalysis.svg"
priority = 1010
keywords = []

class Inputs:
evaluation_results = Input("Evaluation Results", Orange.evaluation.Results)
Expand Down
1 change: 1 addition & 0 deletions Orange/widgets/evaluate/owtestlearners.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ class OWTestLearners(OWWidget):
description = "Cross-validation accuracy estimation."
icon = "icons/TestLearners1.svg"
priority = 100
keywords = []

class Inputs:
train_data = Input("Data", Table, default=True)
Expand Down
1 change: 1 addition & 0 deletions Orange/widgets/model/owadaboost.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class OWAdaBoost(OWBaseLearner):
"Orange.widgets.regression.owadaboostregression.OWAdaBoostRegression",
]
priority = 80
keywords = ["boost"]

LEARNER = SklAdaBoostLearner

Expand Down
1 change: 1 addition & 0 deletions Orange/widgets/model/owconstant.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class OWConstant(OWBaseLearner):
"Orange.widgets.regression.owmean.OWMean",
]
priority = 10
keywords = ["majority", "mean"]

LEARNER = ConstantLearner

Expand Down
1 change: 1 addition & 0 deletions Orange/widgets/model/owknn.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class OWKNNLearner(OWBaseLearner):
"Orange.widgets.regression.owknnregression.OWKNNRegression",
]
priority = 20
keywords = ["k nearest", "knearest", "neighbor", "neighbour"]

LEARNER = KNNLearner

Expand Down
1 change: 1 addition & 0 deletions Orange/widgets/model/owlinearregression.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class OWLinearRegression(OWBaseLearner):
"Orange.widgets.regression.owlinearregression.OWLinearRegression",
]
priority = 60
keywords = ["ridge", "lasso", "elastic net"]

LEARNER = LinearRegressionLearner

Expand Down
1 change: 1 addition & 0 deletions Orange/widgets/model/owloadmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class OWLoadModel(widget.OWWidget):
priority = 3050
replaces = ["Orange.widgets.classify.owloadclassifier.OWLoadClassifier"]
icon = "icons/LoadModel.svg"
keywords = ["file", "open"]

class Outputs:
model = Output("Model", Model)
Expand Down
1 change: 1 addition & 0 deletions Orange/widgets/model/owlogisticregression.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class OWLogisticRegression(OWBaseLearner):
"Orange.widgets.classify.owlogisticregression.OWLogisticRegression",
]
priority = 60
keywords = []

LEARNER = LogisticRegressionLearner

Expand Down
1 change: 1 addition & 0 deletions Orange/widgets/model/ownaivebayes.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class OWNaiveBayes(OWBaseLearner):
"Orange.widgets.classify.ownaivebayes.OWNaiveBayes",
]
priority = 70
keywords = []

LEARNER = NaiveBayesLearner

Expand Down
1 change: 1 addition & 0 deletions Orange/widgets/model/owneuralnetwork.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class OWNNLearner(OWBaseLearner):
"backpropagation."
icon = "icons/NN.svg"
priority = 90
keywords = ["mlp"]

LEARNER = NNLearner

Expand Down
1 change: 1 addition & 0 deletions Orange/widgets/model/owrandomforest.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class OWRandomForest(OWBaseLearner):
"Orange.widgets.regression.owrandomforestregression.OWRandomForestRegression",
]
priority = 40
keywords = []

LEARNER = RandomForestLearner

Expand Down
1 change: 1 addition & 0 deletions Orange/widgets/model/owrules.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ class OWRuleLearner(OWBaseLearner):
"Orange.widgets.classify.owrules.OWRuleLearner",
]
priority = 19
keywords = []

want_main_area = False
resizing_enabled = False
Expand Down
1 change: 1 addition & 0 deletions Orange/widgets/model/owsavemodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class OWSaveModel(widget.OWWidget):
icon = "icons/SaveModel.svg"
replaces = ["Orange.widgets.classify.owsaveclassifier.OWSaveClassifier"]
priority = 3000
keywords = []

class Inputs:
model = Input("Model", Model)
Expand Down
1 change: 1 addition & 0 deletions Orange/widgets/model/owsgd.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class OWSGD(OWBaseLearner):
"Orange.widgets.regression.owsgdregression.OWSGDRegression",
]
priority = 90
keywords = ["sgd"]

settings_version = 2

Expand Down
1 change: 1 addition & 0 deletions Orange/widgets/model/owsvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class OWSVM(OWBaseLearner):
"Orange.widgets.regression.owsvmregression.OWSVMRegression",
]
priority = 50
keywords = ["support vector machines"]

LEARNER = SVMLearner

Expand Down
1 change: 1 addition & 0 deletions Orange/widgets/model/owtree.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class OWTreeLearner(OWBaseLearner):
"Orange.widgets.regression.owregressiontree.OWTreeLearner",
]
priority = 30
keywords = []

LEARNER = TreeLearner

Expand Down
1 change: 1 addition & 0 deletions Orange/widgets/unsupervised/owcorrespondence.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class OWCorrespondenceAnalysis(widget.OWWidget):
name = "Correspondence Analysis"
description = "Correspondence analysis for categorical multivariate data."
icon = "icons/CorrespondenceAnalysis.svg"
keywords = []

class Inputs:
data = Input("Data", Orange.data.Table)
Expand Down
Loading