Example #1
0
def getEntitiesByRegexp(data = None, listRegexp = None, verbosity=1, logFolder="./logs"):
    ''' 
        Method to obtain entities by Regexp.

        :param data:    text where the entities will be looked for.
        :param listRegexp:    list of selected regular expressions to be looked for. If None was provided, all the available will be chosen instead.
        :param verbosity:    Verbosity level.
        :param logFolder:    Folder to store the logs.
        
        :return:    a list of the available objects containing the expressions found in the provided data.
        [
          {
            "attributes": [],
            "type": "i3visio.email",
            "value": "*****@*****.**"
          },
          {
            "attributes": [],
            "type": "i3visio.email",
            "value": "*****@*****.**"
        ]
    '''
    logSet.setupLogger(loggerName="osrframework.entify", verbosity=verbosity, logFolder=logFolder)    
    logInstance = logging.getLogger("osrframework.entify")
    if listRegexp == None:
        listRegexp = regexp_selection.getAllRegexp()

    foundExpr = []

    for r in listRegexp:
        foundExpr += r.findExp(data)

    return foundExpr
Example #2
0
def getEntitiesByRegexp(data = None, listRegexp = None, verbosity=1, logFolder="./logs"):
    '''
        Method to obtain entities by Regexp.

        :param data:    text where the entities will be looked for.
        :param listRegexp:    list of selected regular expressions to be looked for. If None was provided, all the available will be chosen instead.
        :param verbosity:    Verbosity level.
        :param logFolder:    Folder to store the logs.

        :return:    a list of the available objects containing the expressions found in the provided data.
        [
          {
            "attributes": [],
            "type": "i3visio.email",
            "value": "*****@*****.**"
          },
          {
            "attributes": [],
            "type": "i3visio.email",
            "value": "*****@*****.**"
        ]
    '''
    logSet.setupLogger(loggerName="osrframework.entify", verbosity=verbosity, logFolder=logFolder)
    logInstance = logging.getLogger("osrframework.entify")
    if listRegexp == None:
        listRegexp = regexp_selection.getAllRegexp()

    foundExpr = []

    for r in listRegexp:
        foundExpr += r.findExp(data)

    return foundExpr