Package pywurfl :: Package algorithms :: Class Tokenizer
[hide private]
[frames] | no frames]

Class Tokenizer

source code

object --+    
         |    
 Algorithm --+
             |
            Tokenizer

Tokenizer Search Algorithm

Instance Methods [hide private]
 
__init__(self, devwindow=30, use_normalized_ua=True)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
_tokenize(self, s) source code
Device
__call__(self, ua, devices)
Every pywurfl algorithm class must define a __call__ method.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  tokenize_chars = ('/', '.', ',', ';', '-', '_', ' ', '(', ')')
  base_regex = '[\\/\\.\\,\\;\\-\\_\\ \\(\\)]*'
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, devwindow=30, use_normalized_ua=True)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Parameters:
  • devwindow (integer) - If more than devwindow user agents match, return empty device.
  • use_normalized_ua (bool) - Specify whether or not that this algorithm requires a normalized user agent for search.
Overrides: object.__init__

_tokenize(self, s)

source code 
Parameters:
  • s (string) - The user agent to tokenize

__call__(self, ua, devices)
(Call operator)

source code 

Every pywurfl algorithm class must define a __call__ method.

Parameters:
  • ua (string) - The user agent
  • devices (Devices) - The devices object to search
Returns: Device
Overrides: Algorithm.__call__