Ejemplo n.º 1
0
def pack_model_editor(editor):
    return PreprocessAction(
        name=editor.name,
        qualname=
        f"orangecontrib.spectroscopy.widgets.peak_editors.{editor.prefix_generic}",
        category=editor.category,
        description=Description(getattr(editor, 'description', editor.name),
                                icon_path(editor.icon)),
        viewclass=editor,
    )
Ejemplo n.º 2
0

class POSTaggingModule(SingleMethodModule):
    Averaged, MaxEnt, Stanford = range(3)
    Methods = {Averaged: AveragedPerceptronTagger, MaxEnt: MaxEntTagger}
    DEFAULT_METHOD = Averaged

    @staticmethod
    def createinstance(params: Dict) -> POSTagger:
        method = params.get("method", POSTaggingModule.DEFAULT_METHOD)
        return POSTaggingModule.Methods[method]()


PREPROCESS_ACTIONS = [
    PreprocessAction("Transformation", "preprocess.transform", "",
                     Description("变换", icon_path("Transform.svg")),
                     TransformationModule),
    PreprocessAction("Tokenization", "preprocess.tokenize", "",
                     Description("分词", icon_path("Tokenize.svg")),
                     TokenizerModule),
    PreprocessAction("Normalization", "preprocess.normalize", "",
                     Description("归一化", icon_path("Normalize.svg")),
                     NormalizationModule),
    PreprocessAction("Filtering", "preprocess.filter", "",
                     Description("过滤", icon_path("Filter.svg")),
                     FilteringModule),
    PreprocessAction("N-grams Range", "preprocess.ngrams", "",
                     Description("N-grams 范围", icon_path("NGrams.svg")),
                     NgramsModule),
    PreprocessAction("POS Tagger", "tag.pos", "",
                     Description("POS 标记", icon_path("POSTag.svg")),
Ejemplo n.º 3
0
class IntegrateAtEditor(IntegrateSimpleEditor):
    qualname = "orangecontrib.infrared.integrate.closest"
    integrator = Integrate.PeakAt

    def set_preview_data(self, data):
        if not self.user_changed:
            x = getx(data)
            if len(x):
                self.set_value("Closest to", min(x))


PREPROCESSORS = [
    PreprocessAction(
        "Integrate", c.qualname, "Integration",
        Description(c.integrator.name, icon_path("Discretize.svg")), c)
    for c in [
        IntegrateSimpleEditor,
        IntegrateBaselineEditor,
        IntegratePeakMaxEditor,
        IntegratePeakMaxBaselineEditor,
        IntegrateAtEditor,
    ]
]


class OWIntegrate(orangecontrib.infrared.widgets.owpreproc.OWPreprocess):
    name = "Integrate Spectra"
    id = "orangecontrib.infrared.widgets.integrate"
    description = "Integrate spectra in various ways."
    icon = "icons/integrate.svg"
Ejemplo n.º 4
0
class POSTaggingModule(SingleMethodModule):
    Averaged, MaxEnt, Stanford = range(3)
    Methods = {Averaged: AveragedPerceptronTagger,
               MaxEnt: MaxEntTagger}
    DEFAULT_METHOD = Averaged

    @staticmethod
    def createinstance(params: Dict) -> POSTagger:
        method = params.get("method", POSTaggingModule.DEFAULT_METHOD)
        return POSTaggingModule.Methods[method]()


PREPROCESS_ACTIONS = [
    PreprocessAction(
        "Transformation", "preprocess.transform", "",
        Description("Transformation", icon_path("Transform.svg")),
        TransformationModule
    ),
    PreprocessAction(
        "Tokenization", "preprocess.tokenize", "",
        Description("Tokenization", icon_path("Tokenize.svg")),
        TokenizerModule
    ),
    PreprocessAction(
        "Normalization", "preprocess.normalize", "",
        Description("Normalization", icon_path("Normalize.svg")),
        NormalizationModule
    ),
    PreprocessAction(
        "Filtering", "preprocess.filter", "",
        Description("Filtering", icon_path("Filter.svg")),
Ejemplo n.º 5
0
    def parameters(self):
        return {"n_genes": self._n_genes}

    @staticmethod
    def createinstance(params):
        n_genes = params.get("n_genes", DropoutEditor.DEFAULT_N_GENES)
        return DropoutGeneSelection(n_genes)

    def __repr__(self):
        return "Number of Genes: {}".format(self._n_genes)


PREPROCESS_ACTIONS = [
    PreprocessAction(
        "Logarithmic Scale", "preprocess.log_scale", "Value-Based",
        Description("Logarithmic Scale", icon_path("LogarithmicScale.svg")),
        LogarithmicScaleEditor),
    PreprocessAction(
        "Binarize Expression", "preprocess.binarize", "Value-Based",
        Description("Binarize Expression", icon_path("Binarize.svg")),
        BinarizeEditor),
    PreprocessAction(
        "Normalize Samples", "preprocess.normalize", "Row-Based",
        Description("Normalize Samples", icon_path("Normalize.svg")),
        NormalizeEditor),
    PreprocessAction(
        "Standardize Genes", "preprocess.standardize", "Column-Based",
        Description("Standardize Genes", icon_path("Standardize.svg")),
        StandardizeEditor),
    PreprocessAction(
        "Select Most Variable Genes", "preprocess.select_genes",
Ejemplo n.º 6
0
def pack_editor(editor):
    return PreprocessAction("", "", "", Description("Packed"), editor)