Skip to content

pat.pattern: Pattern

olivierlar edited this page May 18, 2015 · 3 revisions

General description

A pattern is considered here as a sequence of descriptions repeated at least twice. Patterns are structured in a prefix tree: each pattern is a node in the tree, and each successive parent corresponds to each successive prefix of the pattern.

Properties

  • parent: the parent of the node corresponding to the pattern in the pattern tree. This corresponds to the longest prefix of the pattern.
  • description: the description of the shortest suffix of the pattern, corresponding to what follows the description of the parent. The sequence of descriptions described by a pattern corresponds to the sequence of description related to each node in the path from the root of the pattern tree to the node corresponding to the pattern.
  • children: the children of the node corresponding to the pattern in the pattern tree. This corresponds to the different possible extensions of the pattern.
  • occurrences: the occurrences of the pattern in the analysed document. Occurrences are object of type pat.occurrence.
  • memory: the associative memory storing the continuations of the pattern, i.e. the notes that immediately follow occurrences of the pattern.
  • address: an ID number reserved to this pattern.
  • closed: whether the pattern is closed or not.

Construction method

pat.pattern(root,parent,desc,paramstruct) creates a new pattern by adding a new node in the pattern tree root, as a child of the node parent, related to the description desc and to the parametric space paramstruct.

At the initialisation of the pattern tree, the root of the tree is constructed by setting root, parent and desc to the empty array [].

The new node is given a specific address (which is also stored in root.address as the latest address assigned).

The associative memory is initialised by calling pat.creatememory.

Clone this wiki locally