Package src :: Package com :: Package deviceatlas :: Package device :: Module token_trie_walker :: Class TokenTrieWalker
[frames] | no frames]

Class TokenTrieWalker

Walks a provided identifier to try and find one or more matching components.

@author DeviceAtlas Limited

Instance Methods
 
__init__(self, node, delimiters_handler, meta_data)
 
seek_component(self, identifier)
Loop over the input string character by character and descend down a Trie structure to find matching Components.
Method Details

seek_component(self, identifier)

 

Loop over the input string character by character and descend down a Trie
structure to find matching Components.

The Trie is a shallow Trie created from token values. It expects either
a full match to a token from an incoming identifier or a partial
stats-with match if permitted by a found MatchCandidate.

Although the individual characters(*) are used to walk the Trie it is
easier to think of the input string as a collection of tokens delimited
by characters like spaces, semi-colons etc.

A given branch of the Trie may either be formed from a single token or
formed from a chain of adjacent tokens.

At the end of a token, a matching Node may contain some MatchCandidates.
These MatchCandidates contain a Component and some additional criteria
that must be passed before the Component is added to the "found"
collection.

(* in practice the codePoint is used to walk the trie and not the actual
   character itself)

Note1: See flow diagram in internal-docs/tokentriewalk.drawio.png

NOTE2: Some attempts were made to split the below method into multiple methods
       to add readability. The overall API performance dropped by around 40-50,000
       detections per second with this change so it was reverted.

:param identifier: The identifier to find matching components from.
:return: IdentifierMatchResult Collection of any found matching components.