syntactic_alias.py 1.58 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
"""
    List of alias for classifiers available on python-weka-wrapper.
    
    Name: weka_alias.py
    Author: Alessandro dos Santos Ferreira ( santosferreira.alessandro@gmail.com )
"""

from interface.interface import InterfaceException as IException

_syntactic_alias = {    
    
    "KTESTABLE": "KTESTABLE"

}

class SyntacticAlias(object): 
    """Class of alias for classifiers available on python-weka-wrapper."""
    
    @staticmethod
    def get_classifier(name):        
        """Return full name of classifier.
        
        Parameters
        ----------
        name : string
            Alias of classifier, not case sensitive.
            
        Returns
        -------
        classifier : string
            Full name of classifier.
        
        Raises
        ------
        IException 'Invalid classifier'
            The user must install the required dependencies to classifiers.
        """
        classifiers = [_syntactic_alias[alias] for alias in _syntactic_alias]
        
        if name in classifiers:
            return name
        
        alias = name.upper().strip()
        aliases = [a.upper() for a in _syntactic_alias]
        
        if alias in aliases:
            return _syntactic_alias.values()[ aliases.index(alias) ]
        
        raise IException('Invalid classifier')


    @staticmethod
    def get_aliases():
        """Return all aliases.
            
        Returns
        -------
        classifier : Dictionary
            Dictionary with all aliases.
        """
        return _syntactic_alias